/*
$Log$
+Revision 1.58 2007/09/28 15:27:40 acolla
+
+AliDCSClient "multiSplit" option added in the DCS configuration
+in AliDCSMessage: variable MAX_BODY_SIZE set to 500000
+
Revision 1.57 2007/09/27 16:53:13 acolla
Detectors can have more than one AMANDA server. SHUTTLE queries the servers sequentially,
merges the dcs aliases/DPs in one TMap and sends it to the preprocessor.
// Query DCS archive
Int_t nServers = fConfig->GetNServers(fCurrentDetector);
- Log("SHUTTLE", Form("ProcessCurrentDetector -"
- " found %d Amanda servers for %s", nServers, fCurrentDetector.Data()));
for (int iServ=0; iServ<nServers; iServ++)
{
Int_t port = fConfig->GetDCSPort(fCurrentDetector, iServ);
Int_t multiSplit = fConfig->GetMultiSplit(fCurrentDetector, iServ);
+ Log(fCurrentDetector, Form("ProcessCurrentDetector -"
+ " Querying DCS Amanda server %s:%d (%d of %d)",
+ host.Data(), port, iServ+1, nServers));
TMap* aliasMap = 0;
TMap* dpMap = 0;
if (result == 0)
{
Log(fCurrentDetector.Data(), Form("GetValueSet - Can't get entries! Reason: %s",
- client.GetServerError().Data()));
+ client.GetErrorString(client.GetResultErrorCode())));
+ if (client.GetResultErrorCode() == AliDCSClient::fgkServerError)
+ Log(fCurrentDetector.Data(), Form("GetValueSet - Server error code: %s",
+ client.GetServerError().Data()));
return 0;
}
/*
$Log$
+Revision 1.4 2007/09/14 16:46:14 jgrosseo
+1) Connect and Close are called before and after each query, so one can
+keep the same AliDCSClient object.
+2) The splitting of a query is moved to GetDPValues/GetAliasValues.
+3) Splitting interval can be specified in constructor
+
Revision 1.3 2007/09/11 16:42:02 jgrosseo
starting modifying AliDCSClient to transparently switch between single and multi query
first step: same alidcsclient can be used for several queries
AliDCSClient::AliDCSClient(const char* host, Int_t port, UInt_t timeout,
Int_t retries, Int_t multiSplit):
fSocket(NULL), fHost(host), fPort(port), fTimeout(timeout), fRetries(retries), fMultiSplit(multiSplit),
- fServerErrorCode(AliDCSMessage::kNoneError), fServerError("")
+ fServerErrorCode(AliDCSMessage::kNoneError), fServerError(""), fResultErrorCode(0)
{
//
// host: DCS server host
{
AliError("Not connected!");
delete result;
+ fResultErrorCode = fgkBadState;
return 0;
}
{
TObjString* aRequest = (TObjString*) list->At(i);
if (!requestMessage.AddRequestString(aRequest->String()))
+ {
+ delete result;
+ fResultErrorCode = fgkBadMessage;
return 0;
+ }
}
}
- Int_t sResult = 0;
- if ((sResult = SendMessage(requestMessage)) < 0)
+ if ((fResultErrorCode = SendMessage(requestMessage)) < 0)
{
AliError(Form("Can't send request message! Reason: %s",
- GetErrorString(sResult)));
+ GetErrorString(fResultErrorCode)));
Close();
delete result;
return 0;
TObjArray* resultSet = new TObjArray();
resultSet->SetOwner(1);
- if ((sResult = ReceiveValueSet(resultSet)) < 0)
+ if ((fResultErrorCode = ReceiveValueSet(resultSet)) < 0)
{
AliError(Form("Can't get values for %s!" ,
aRequest->String().Data()));
AliDCSMessage::ErrorCode GetServerErrorCode() const
{ return fServerErrorCode;}
+ Int_t GetResultErrorCode() const {return fResultErrorCode;}
const TString& GetServerError() const {return fServerError;}
UInt_t fTimeout; // timeout parameter
Int_t fRetries; // number of retries
Int_t fMultiSplit; // number of datapoints that are queried at a time in a multi dp request, if set to 1 forces single requests
- AliDCSMessage::ErrorCode fServerErrorCode; // error code
+ AliDCSMessage::ErrorCode fServerErrorCode; // server error code
TString fServerError; // server error string
+
+ Int_t fResultErrorCode; // result error code
Bool_t Connect();
TMap* GetValues(const char* host, Int_t port, const char* request,
- UInt_t startTime, UInt_t endTime)
+ UInt_t startTime, UInt_t endTime, Int_t multiSplit)
{
- AliDCSClient client(host, port, 1000, 20, 100);
+ AliDCSClient client(host, port, 1000, 20, multiSplit);
// The 5th parameter switches from single alias to multi aliases!
//Int_t result;
values = client.GetAliasValues(requests, startTime, endTime);
if (!values) {
- cout<<"Communication failure: "<<
- client.GetServerError().Data() <<endl;
+ cout<<"Query failed! Result error: "<<
+ client.GetErrorString(client.GetResultErrorCode()) <<endl;
+ if(client.GetResultErrorCode() == AliDCSClient::fgkServerError)
+ cout<<"Server error: "<<
+ client.GetServerError().Data() <<endl;
return NULL;
}
}
TMap* TestClientAlias(const char* host, Int_t port, const char* request,
- UInt_t startShift, UInt_t endShift) {
+ UInt_t startShift, UInt_t endShift, UInt_t multiSplit) {
gSystem->Load("$ALICE_ROOT/SHUTTLE/DCSClient/AliDCSClient");
TTimeStamp currentTime;
+/*
TMap* values = GetValues(host, port, request,
currentTime.GetSec() - startShift,
- currentTime.GetSec() - endShift);
-
+ currentTime.GetSec() - endShift, multiSplit);
+*/
// SHUTTLE query interval
-/*
+
TMap* values = GetValues(host, port, request,
- 1181300060,
- 1181307260);
-*/
+ 1181300060, 1181307260, multiSplit);
+
if(values) values->Print();
cout << endl;