Result error code added to AliDCSClient data members (it was "lost" with the new...
authoracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Oct 2007 12:40:55 +0000 (12:40 +0000)
committeracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Oct 2007 12:40:55 +0000 (12:40 +0000)
SHUTTLE/AliShuttle.cxx
SHUTTLE/DCSClient/AliDCSClient.cxx
SHUTTLE/DCSClient/AliDCSClient.h
SHUTTLE/DCSClient/macros/TestClientAlias.C

index ee5858003928041206ef2fe39175a7027e1eb0d9..95b6debfc0de4fa77ca18b8fdb2631f29e27edf1 100644 (file)
 
 /*
 $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.
@@ -1577,8 +1582,6 @@ Bool_t AliShuttle::ProcessCurrentDetector()
 
                // 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++)
                {
@@ -1587,6 +1590,9 @@ Bool_t AliShuttle::ProcessCurrentDetector()
                        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;
@@ -1824,7 +1830,10 @@ TMap* AliShuttle::GetValueSet(const char* host, Int_t port, const TSeqCollection
        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;
        }
index 80ea035b4fabafd9f7e91bdfc840a81603167910..f20801bca4a82fe453616eaf6b624d6f19452725 100644 (file)
 
 /*
 $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
@@ -102,7 +108,7 @@ const char* AliDCSClient::fgkServerErrorString = "ServerError";
 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
@@ -344,6 +350,7 @@ TMap* AliDCSClient::GetValues(AliDCSMessage::RequestType reqType,
                {
                        AliError("Not connected!");
                        delete result;
+                       fResultErrorCode = fgkBadState;
                        return 0;
                }
 
@@ -370,15 +377,18 @@ TMap* AliDCSClient::GetValues(AliDCSMessage::RequestType reqType,
                        {
                                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;
@@ -391,7 +401,7 @@ TMap* AliDCSClient::GetValues(AliDCSMessage::RequestType reqType,
                        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()));
index 91f01173f0462f60fdddffa5c241fc6dc7df1249..4719b0e89a4a61d7e17d8bd0e1195a220db0ac36 100644 (file)
@@ -51,6 +51,7 @@ public:
         AliDCSMessage::ErrorCode GetServerErrorCode() const
                 { return fServerErrorCode;}
 
+       Int_t GetResultErrorCode() const {return fResultErrorCode;}
         const TString& GetServerError() const {return fServerError;}
 
 
@@ -75,8 +76,10 @@ private:
        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();
 
index d33b1515016778a4a5e1b34c664952bcfa2407ee..9d1977993eeee82396fc5401dffc965bf8f2d8e5 100644 (file)
@@ -1,7 +1,7 @@
 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;
@@ -38,8 +38,11 @@ TMap* GetValues(const char* host, Int_t port, const char* request,
        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;
        }
        
@@ -90,7 +93,7 @@ TMap* GetValues(const char* host, Int_t port, const char* request,
 }
 
 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");
 
@@ -100,17 +103,17 @@ TMap* TestClientAlias(const char* host, Int_t port, const char* request,
        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;