From 542b6cc878cc2fe12fd1450c43f63f1e286d464e Mon Sep 17 00:00:00 2001 From: acolla Date: Fri, 28 Sep 2007 15:27:40 +0000 Subject: [PATCH 1/1] AliDCSClient "multiSplit" option added in the DCS configuration in AliDCSMessage: variable MAX_BODY_SIZE set to 500000 --- SHUTTLE/AliShuttle.cxx | 65 +++++----------------- SHUTTLE/AliShuttle.h | 4 +- SHUTTLE/AliShuttleConfig.cxx | 54 +++++++++++++++++- SHUTTLE/AliShuttleConfig.h | 7 +++ SHUTTLE/DCSClient/AliDCSMessage.h | 2 +- SHUTTLE/DCSClient/macros/TestClientAlias.C | 12 +++- SHUTTLE/schema/shuttle.schema | 11 ++-- 7 files changed, 90 insertions(+), 65 deletions(-) diff --git a/SHUTTLE/AliShuttle.cxx b/SHUTTLE/AliShuttle.cxx index d2c7da05132..ee585800392 100644 --- a/SHUTTLE/AliShuttle.cxx +++ b/SHUTTLE/AliShuttle.cxx @@ -15,6 +15,10 @@ /* $Log$ +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. + Revision 1.56 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. @@ -1581,6 +1585,8 @@ Bool_t AliShuttle::ProcessCurrentDetector() TString host(fConfig->GetDCSHost(fCurrentDetector, iServ)); Int_t port = fConfig->GetDCSPort(fCurrentDetector, iServ); + Int_t multiSplit = fConfig->GetMultiSplit(fCurrentDetector, iServ); + TMap* aliasMap = 0; TMap* dpMap = 0; @@ -1588,7 +1594,8 @@ Bool_t AliShuttle::ProcessCurrentDetector() if (fConfig->GetDCSAliases(fCurrentDetector, iServ)->GetEntries() > 0) { aliasMap = GetValueSet(host, port, - fConfig->GetDCSAliases(fCurrentDetector, iServ), kAlias); + fConfig->GetDCSAliases(fCurrentDetector, iServ), + kAlias, multiSplit); if (!aliasMap) { Log(fCurrentDetector, @@ -1604,7 +1611,8 @@ Bool_t AliShuttle::ProcessCurrentDetector() if (fConfig->GetDCSDataPoints(fCurrentDetector, iServ)->GetEntries() > 0) { dpMap = GetValueSet(host, port, - fConfig->GetDCSDataPoints(fCurrentDetector, iServ), kDP); + fConfig->GetDCSDataPoints(fCurrentDetector, iServ), + kDP, multiSplit); if (!dpMap) { Log(fCurrentDetector, @@ -1789,64 +1797,17 @@ AliShuttleLogbookEntry* AliShuttle::QueryRunParameters(Int_t run) return entry; } -//______________________________________________________________________________________________ -Bool_t AliShuttle::GetValueSet(const char* host, Int_t port, const char* entry, - TObjArray* valueSet, DCSType type) -{ - // Retrieve all "entry" data points from the DCS server - // host, port: TSocket connection parameters - // entry: name of the alias or data point - // valueSet: array of retrieved AliDCSValue's - // type: kAlias or kDP - - // TODO The last parameter switches from single query to multy query! - AliDCSClient client(host, port, fTimeout, fRetries, 1); - if (!client.IsConnected()) - { - return kFALSE; - } - - Int_t result=0; - - if (type == kAlias) - { - result = client.GetAliasValues(entry, - GetCurrentStartTime(), GetCurrentEndTime(), valueSet); - } else - if (type == kDP) - { - result = client.GetDPValues(entry, - GetCurrentStartTime(), GetCurrentEndTime(), valueSet); - } - - if (result < 0) - { - Log(fCurrentDetector.Data(), Form("GetValueSet - Can't get '%s'! Reason: %s", - entry, AliDCSClient::GetErrorString(result))); - - if (result == AliDCSClient::fgkServerError) - { - Log(fCurrentDetector.Data(), Form("GetValueSet - Server error: %s", - client.GetServerError().Data())); - } - - return kFALSE; - } - - return kTRUE; -} - //______________________________________________________________________________________________ TMap* AliShuttle::GetValueSet(const char* host, Int_t port, const TSeqCollection* entries, - DCSType type) + DCSType type, Int_t multiSplit) { // Retrieve all "entry" data points from the DCS server // host, port: TSocket connection parameters // entries: list of name of the alias or data point // type: kAlias or kDP // returns TMap of values, 0 when failure - - AliDCSClient client(host, port, fTimeout, fRetries); + + AliDCSClient client(host, port, fTimeout, fRetries, multiSplit); TMap* result = 0; if (type == kAlias) diff --git a/SHUTTLE/AliShuttle.h b/SHUTTLE/AliShuttle.h index 9f85f8eefbf..a34311dbd0e 100644 --- a/SHUTTLE/AliShuttle.h +++ b/SHUTTLE/AliShuttle.h @@ -91,10 +91,8 @@ private: Bool_t QueryShuttleLogbook(const char* whereClause, TObjArray& entries); Bool_t RetrieveConditionsData(const TObjArray& shuttleLogbookEntries); - Bool_t GetValueSet(const char* host, Int_t port, const char* alias, - TObjArray* result, DCSType type); TMap* GetValueSet(const char* host, Int_t port, const TSeqCollection* entries, - DCSType type); + DCSType type, Int_t valueSet); Bool_t RetrieveFile(UInt_t system, const char* daqFileName, const char* localFileName); diff --git a/SHUTTLE/AliShuttleConfig.cxx b/SHUTTLE/AliShuttleConfig.cxx index 0a294a7453f..200f7eea399 100644 --- a/SHUTTLE/AliShuttleConfig.cxx +++ b/SHUTTLE/AliShuttleConfig.cxx @@ -15,6 +15,10 @@ /* $Log$ +Revision 1.22 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. + Revision 1.21 2007/04/27 07:06:48 jgrosseo GetFileSources returns empty list in case of no files, but successful query No mails sent in testmode @@ -157,6 +161,7 @@ some docs added AliShuttleConfig::AliShuttleDCSConfigHolder::AliShuttleDCSConfigHolder(const TLDAPEntry* entry): fDCSHost(""), fDCSPort(0), +fMultiSplit(100), fDCSAliases(0), fDCSDataPoints(0), fDCSAliasesComp(0), @@ -194,6 +199,18 @@ fIsValid(kFALSE) TString portStr = anAttribute->GetValue(); fDCSPort = portStr.Atoi(); + anAttribute = entry->GetAttribute("multiSplit"); // MAY + if (anAttribute) + { + TString multiSplitStr = anAttribute->GetValue(); + fMultiSplit = multiSplitStr.Atoi(); + if(fMultiSplit == 0) { + AliError("MultiSplit must be a positive integer!"); + return; + } + + } + anAttribute = entry->GetAttribute("dcsAlias"); // MAY if (anAttribute) { @@ -384,6 +401,21 @@ Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSPort(Int_t iServ) const return aHolder->GetDCSPort(); } +//______________________________________________________________________________________________ +Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetMultiSplit(Int_t iServ) const +{ + // + // returns DCS "multi split" value + // + + if (iServ < 0 || iServ >= GetNServers()) return 0; + + AliShuttleDCSConfigHolder *aHolder = dynamic_cast + (fDCSConfig->At(iServ)); + + return aHolder->GetMultiSplit(); +} + //______________________________________________________________________________________________ const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSAliases(Int_t iServ) const { @@ -659,6 +691,24 @@ Int_t AliShuttleConfig::GetDCSPort(const char* detector, Int_t iServ) const return aHolder->GetDCSPort(iServ); } +//______________________________________________________________________________________________ +Int_t AliShuttleConfig::GetMultiSplit(const char* detector, Int_t iServ) const +{ + // + // returns i-th DCS "multi split" value + // + + + AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector); + if (!aHolder) { + AliError(Form("There isn't configuration for detector: %s", + detector)); + return 0; + } + + return aHolder->GetMultiSplit(iServ); +} + //______________________________________________________________________________________________ const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector, Int_t iServ) const { @@ -1191,8 +1241,8 @@ void AliShuttleConfig::Print(Option_t* option) const Int_t count=0; while ((dcsHolder = dynamic_cast (dcsIter.Next()))) { - result += Form("\tAmanda server [%d]: %s:%d \n", count, - dcsHolder->GetDCSHost(), dcsHolder->GetDCSPort()); + result += Form("\tAmanda server [%d]: %s:%d - MultiSplit = %d\n", count, + dcsHolder->GetDCSHost(), dcsHolder->GetDCSPort(), dcsHolder->GetMultiSplit()); const TObjArray* aliases = 0; if (optStr.Contains("uncompact",TString::kIgnoreCase)) diff --git a/SHUTTLE/AliShuttleConfig.h b/SHUTTLE/AliShuttleConfig.h index f5c47533547..7f0bf23771d 100644 --- a/SHUTTLE/AliShuttleConfig.h +++ b/SHUTTLE/AliShuttleConfig.h @@ -64,6 +64,8 @@ public: const char* GetDCSHost(const char* detector, Int_t iServ) const; Int_t GetDCSPort(const char* detector, Int_t iServ) const; + Int_t GetMultiSplit(const char* detector, Int_t iServ) const; + const TObjArray* GetDCSAliases(const char* detector, Int_t iServ) const; const TObjArray* GetDCSDataPoints(const char* detector, Int_t iServ) const; const TObjArray* GetCompactDCSAliases(const char* detector, Int_t iServ) const; @@ -88,6 +90,8 @@ private: const char* GetDCSHost() const {return fDCSHost;} Int_t GetDCSPort() const {return fDCSPort;} + Int_t GetMultiSplit() const {return fMultiSplit;} + const TObjArray* GetDCSAliases() const {return fDCSAliases;} const TObjArray* GetDCSDataPoints() const {return fDCSDataPoints;} const TObjArray* GetCompactDCSAliases() const {return fDCSAliasesComp;} @@ -102,6 +106,7 @@ private: TString fDCSHost; // Host name of the DCS server Int_t fDCSPort; // port of the DCS server + Int_t fMultiSplit; // N. of DPs to be queried in each query chunk TObjArray* fDCSAliases; // List of DCS aliases to be retrieved TObjArray* fDCSDataPoints; // List of DCS data points to be retrieved TObjArray* fDCSAliasesComp; // Compact list of DCS aliases to be printed @@ -124,6 +129,8 @@ private: const char* GetDCSHost(Int_t iServ) const; Int_t GetDCSPort(Int_t iServ) const; + Int_t GetMultiSplit(Int_t iServ) const; + const TObjArray* GetDCSAliases(Int_t iServ) const; const TObjArray* GetDCSDataPoints(Int_t iServ) const; const TObjArray* GetCompactDCSAliases(Int_t iServ) const; diff --git a/SHUTTLE/DCSClient/AliDCSMessage.h b/SHUTTLE/DCSClient/AliDCSMessage.h index 26450aa2fb0..73c16bd4b8b 100644 --- a/SHUTTLE/DCSClient/AliDCSMessage.h +++ b/SHUTTLE/DCSClient/AliDCSMessage.h @@ -22,7 +22,7 @@ #define TYPE_OFFSET 3 #define BODY_SIZE_OFFSET 4 -#define MAX_BODY_SIZE 40000 +#define MAX_BODY_SIZE 500000 #define REQUEST_TYPE_OFFSET HEADER_SIZE #define START_TIME_OFFSET (HEADER_SIZE + 1) diff --git a/SHUTTLE/DCSClient/macros/TestClientAlias.C b/SHUTTLE/DCSClient/macros/TestClientAlias.C index 7e35bd69816..d33b1515016 100644 --- a/SHUTTLE/DCSClient/macros/TestClientAlias.C +++ b/SHUTTLE/DCSClient/macros/TestClientAlias.C @@ -1,8 +1,8 @@ TMap* GetValues(const char* host, Int_t port, const char* request, UInt_t startTime, UInt_t endTime) { - AliDCSClient client(host, port, 1000, 20, 1); - // The last parameter switches from single alias to multi aliases! + AliDCSClient client(host, port, 1000, 20, 100); + // The 5th parameter switches from single alias to multi aliases! //Int_t result; @@ -99,10 +99,18 @@ 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); + +// SHUTTLE query interval +/* + TMap* values = GetValues(host, port, request, + 1181300060, + 1181307260); +*/ if(values) values->Print(); cout << endl; diff --git a/SHUTTLE/schema/shuttle.schema b/SHUTTLE/schema/shuttle.schema index 8451ddfc62a..fe4401bef1b 100644 --- a/SHUTTLE/schema/shuttle.schema +++ b/SHUTTLE/schema/shuttle.schema @@ -15,17 +15,18 @@ objectclass ( DETECTOR_CONFIG objectidentifier DCS_CONFIG SHUTTLE_BASE:2 -attributetype ( DCS_CONFIG:1 NAME 'dcsHost' DESC 'DCS host' EQUALITY caseIgnoreMatch SUP name SINGLE-VALUE ) -attributetype ( DCS_CONFIG:2 NAME 'dcsPort' DESC 'DCS port' SUP ipServicePort SINGLE-VALUE ) -attributetype ( DCS_CONFIG:3 NAME 'dcsAlias' DESC 'alias name(s)' EQUALITY caseIgnoreMatch SUP name ) -attributetype ( DCS_CONFIG:4 NAME 'dcsDP' DESC 'Data Point name(s)' EQUALITY caseIgnoreMatch SUP name ) +attributetype ( DCS_CONFIG:1 NAME 'dcsHost' DESC 'DCS host' EQUALITY caseIgnoreMatch SUP name SINGLE-VALUE ) +attributetype ( DCS_CONFIG:2 NAME 'dcsPort' DESC 'DCS port' SUP ipServicePort SINGLE-VALUE ) +attributetype ( DCS_CONFIG:3 NAME 'dcsAlias' DESC 'alias name(s)' EQUALITY caseIgnoreMatch SUP name ) +attributetype ( DCS_CONFIG:4 NAME 'dcsDP' DESC 'Data Point name(s)' EQUALITY caseIgnoreMatch SUP name ) +attributetype ( DCS_CONFIG:5 NAME 'multiSplit' DESC 'N. of DPs in multiRequest' EQUALITY integerMatch SUP uidNumber SINGLE-VALUE ) objectclass ( DCS_CONFIG NAME 'dcsConfig' DESC 'ALICE: Shuttle configuration of the DCS Amanda server(s).' SUP top MUST (dcsHost $ dcsPort) - MAY (dcsAlias $ dcsDP) ) + MAY (dcsAlias $ dcsDP $ multiSplit) ) objectidentifier FXS_CONFIG SHUTTLE_BASE:3 -- 2.39.3