]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New Configuration Parameter to set Alien Path for CDB implemented.
authorzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 16 May 2008 13:50:06 +0000 (13:50 +0000)
committerzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 16 May 2008 13:50:06 +0000 (13:50 +0000)
SHUTTLE/AliShuttle.cxx
SHUTTLE/AliShuttleConfig.cxx
SHUTTLE/AliShuttleConfig.h
SHUTTLE/schema/Global.ldif
SHUTTLE/schema/shuttle.schema
SHUTTLE/schema_prod/Global.ldif

index adf38f7a9fb6545f75dd30c13cc186bd10c4e2fb..9a2a46a532ec29dbd0e8e6f5ca4bb8eb17f1ea3e 100644 (file)
@@ -616,8 +616,8 @@ Bool_t AliShuttle::StoreRunMetadataFile(const char* localFile, const char* gridF
                                lhcPeriod.Data()));
        }
                
-       TString target = Form("%s/GRP/RunMetadata/alice/data/%d/%s/%09d/raw/%s", 
-                               localBaseFolder.Data(), GetCurrentYear(), 
+       TString target = Form("%s/GRP/RunMetadata%s%d/%s/%09d/raw/%s", 
+                               localBaseFolder.Data(), fConfig->GetAlienPath(), GetCurrentYear(), 
                                lhcPeriod.Data(), GetCurrentRun(), gridFileName);
                                        
        return CopyFileLocally(localFile, target);
@@ -736,10 +736,10 @@ Bool_t AliShuttle::CopyFilesToGrid(const char* type)
                        lhcPeriod.Append(Form("_%s", partition.Data()));
                }
                
-               dir = Form("%s/GRP/RunMetadata/alice/data/%d/%s/%09d/raw", 
-                               localBaseFolder.Data(), GetCurrentYear(), 
+               dir = Form("%s/GRP/RunMetadata%s%d/%s/%09d/raw", 
+                               localBaseFolder.Data(), fConfig->GetAlienPath(), GetCurrentYear(), 
                                lhcPeriod.Data(), GetCurrentRun());
-               alienDir = dir(dir.Index("/alice/data/"), dir.Length());
+               alienDir = dir(dir.Index(fConfig->GetAlienPath()), dir.Length());
                
                begin = "";
        }
@@ -1273,12 +1273,12 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry)
        }       
        
        if (fgkMainCDB.Length() == 0)
-               fgkMainCDB = Form("alien://folder=/alice/data/%d/%s/OCDB?user=alidaq?cacheFold=/tmp/OCDBCache", 
-                                       GetCurrentYear(), lhcPeriod.Data());
+               fgkMainCDB = Form("alien://folder=%s%d/%s/OCDB?user=alidaq?cacheFold=/tmp/OCDBCache", 
+                                       fConfig->GetAlienPath(), GetCurrentYear(), lhcPeriod.Data());
        
        if (fgkMainRefStorage.Length() == 0)
-               fgkMainRefStorage = Form("alien://folder=/alice/data/%d/%s/Reference?user=alidaq?cacheFold=/tmp/OCDBCache", 
-                                       GetCurrentYear(), lhcPeriod.Data());
+               fgkMainRefStorage = Form("alien://folder=%s%d/%s/Reference?user=alidaq?cacheFold=/tmp/OCDBCache", 
+                                       fConfig->GetAlienPath(), GetCurrentYear(), lhcPeriod.Data());
        
        // Loop on detectors in the configuration
        TIter iter(fConfig->GetDetectors());
@@ -3288,36 +3288,61 @@ Bool_t AliShuttle::TouchFile()
                return kFALSE;
        }
 
+       TString dir;
+       dir.Form("%s%d/%s/SHUTTLE_DONE", fConfig->GetAlienPath(), GetCurrentYear(), GetLHCPeriod());
+       // checking whether directory for touch command exists
+       TString commandLs;
+       commandLs.Form("ls %s",dir.Data());
+       TGridResult *resultLs = dynamic_cast<TGridResult*>(gGrid->Command(commandLs));
+       if (!resultLs){
+               Log("SHUTTLE",Form("No result for %s command, returning without touching",commandLs.Data()));
+               return kFALSE;
+       }
+       TMap *mapLs = dynamic_cast<TMap*>(resultLs->At(0));
+       if (!mapLs){
+               Log("SHUTTLE",Form("No map for %s command, returning without touching",commandLs.Data()));
+               return kFALSE;
+       }
+       TObjString *valueLsPath = dynamic_cast<TObjString*>(mapLs->GetValue("path"));
+       if (!valueLsPath || (TString)(valueLsPath->GetString()).CompareTo(dir)!=1){ 
+               Log("SHUTTLE",Form("No directory %s found, creating it",dir.Data()));
+
+               // creating the directory
+
+               Bool_t boolMkdir = gGrid->Mkdir(dir.Data());
+               if (!boolMkdir) {
+                       Log("SHUTTLE",Form("Impossible to create dir %s in alien catalogue for run %i!",dir.Data(),GetCurrentRun()));
+                       return kFALSE;
+               }
+               Log("SHUTTLE",Form("Directory %s successfully created in alien catalogue for run %i",dir.Data(),GetCurrentRun()));
+       }
+       else {
+               Log("SHUTTLE",Form("Directory %s correctly found for run %i",dir.Data(),GetCurrentRun()));
+       }
+
        TString command;
-       command.Form("touch /alice/data/%d/%s/SHUTTLE_DONE/%i", GetCurrentYear(), GetLHCPeriod(), GetCurrentRun());
+       command.Form("touch %s/%i", dir.Data(), GetCurrentRun());
        Log("SHUTTLE", Form("Creating entry in file catalog: %s", command.Data()));
        TGridResult *resultTouch = dynamic_cast<TGridResult*>(gGrid->Command(command));
-       if (resultTouch){
-               TMap *mapTouch = dynamic_cast<TMap*>(resultTouch->At(0));
-               if (mapTouch){
-                       TObjString *valueTouch = dynamic_cast<TObjString*>(mapTouch->GetValue("__result__"));
-                       if (valueTouch){
-                               if (valueTouch->GetString()=="1"){
-                               return kTRUE;
-                               }       
-                               else {
-                                       Log("SHUTTLE",Form("No value for __result__ key set in the map for touching command"));
-                               }
-                       }
-                       else {
-                               Log("SHUTTLE",Form("No value set in the map for touching command"));
-                       }
-               }
-               else {
-                       Log("SHUTTLE",Form("No map for touching command"));
-               }
+       if (!resultTouch){
+               Log("SHUTTLE",Form("No result for touching command, returning without touching for run %i",GetCurrentRun()));
+               return kFALSE;
        }
-
-       else {
-               Log("SHUTTLE",Form("No result for touching command"));
+       TMap *mapTouch = dynamic_cast<TMap*>(resultTouch->At(0));
+       if (!mapTouch){
+               Log("SHUTTLE",Form("No map for touching command, returning without touching for run %i",GetCurrentRun()));
+               return kFALSE;
+       }
+       TObjString *valueTouch = dynamic_cast<TObjString*>(mapTouch->GetValue("__result__"));
+       if (!valueTouch){
+               Log("SHUTTLE",Form("No value for \"__result__\" key set in the map for touching command, returning without touching for run %i",GetCurrentRun()));
+               return kFALSE;
        }
-       Log("SHUTTLE",Form("Could not touch file for run %i",GetCurrentRun()));
-       return kFALSE;
+       if (valueTouch->GetString()!="1"){
+               Log("SHUTTLE",Form("Failing the touching command, returning without touching for run %i",GetCurrentRun()));
+               return kFALSE;
+       }
+       return kTRUE;
 }
 
 
index b62416990440c41138f562beb063a2617dbff37c..8f1db046a77f519823fe23c616628d9967866e0e 100644 (file)
@@ -1045,6 +1045,13 @@ UInt_t AliShuttleConfig::SetGlobalConfig(TList* list)
        } 
        
        
+       anAttribute = anEntry->GetAttribute("AlienPath");
+       if (!anAttribute) {
+               AliError("Can't find AlienPath attribute!");
+               return 4;
+       }
+       fAlienPath = anAttribute->GetValue();
+
        anAttribute = anEntry->GetAttribute("daqLbHost");
        if (!anAttribute) {
                AliError("Can't find daqLbHost attribute!");
index dfd56971404d9dd9af3a6961f84b80fe9bc6e2ea..a296be7b1d172b3510c231c04a601f68b19c255c 100644 (file)
@@ -34,6 +34,8 @@ public:
 
        const char* GetConfigHost() const {return fConfigHost.Data();}
 
+       const char* GetAlienPath() const {return fAlienPath.Data();}
+
        const char* GetDAQlbHost() const {return fDAQlbHost.Data();}
        UInt_t      GetDAQlbPort() const {return fDAQlbPort;}
        const char* GetDAQlbUser() const {return fDAQlbUser.Data();}
@@ -187,6 +189,8 @@ private:
        
        TString fConfigHost;            // Host of the Shuttle configuration LDAP server
 
+       TString fAlienPath;             // Alien Path for CDB/Reference objs in the Alien catalogue
+
        TString fDAQlbHost;             // Host of the DAQ logbook MySQL Server
        UInt_t  fDAQlbPort;             // port of the DAQ logbook MySQL Server
        TString fDAQlbUser;             // username of the DAQ logbook MySQL Server
index be4f27ab2b4c32652831df9a6e1d874da1c81030..bec14100b1ba8464c6a736a9fae9fa102b2f2035 100644 (file)
@@ -23,4 +23,5 @@ ppmaxRetries: 2
 ppTimeOut: 1200
 sendMail: 1
 passwdFilePath: /home/shuttle/.shuttle
+AliEnPath: /alice/testdata/
 
index 5753c9facf06b45956c22457f1c3d16fac9ba196..8b5807e4a339fd189786b6bfd6ce2e2547044ac2 100644 (file)
@@ -77,12 +77,13 @@ attributetype ( GLOBAL_CONFIG:19 NAME 'keepTempFolder'      DESC 'keep temp folder f
 attributetype ( GLOBAL_CONFIG:20 NAME 'dcsTimeOut'      DESC 'seconds before dcs abort'           EQUALITY integerMatch    SUP uidNumber SINGLE-VALUE )
 attributetype ( GLOBAL_CONFIG:21 NAME 'nDCSretries'     DESC 'number of dcs retries before abort'      EQUALITY integerMatch    SUP uidNumber SINGLE-VALUE )
 attributetype ( GLOBAL_CONFIG:22 NAME 'passwdFilePath' DESC 'PWD File Path'                 EQUALITY caseIgnoreMatch SUP name SINGLE-VALUE )
+attributetype ( GLOBAL_CONFIG:23 NAME 'AliEnPath'      DESC 'AliEn Path'                    EQUALITY caseIgnoreMatch SUP name SINGLE-VALUE )
 
 objectclass ( GLOBAL_CONFIG
         NAME 'globalConfig'
         DESC 'ALICE: settings for DAQ logbook access'
         SUP top
-        MUST (name $ passwdFilePath $ daqLbHost $ daqLbUser $ daqLbDB $ daqLbTable $ shuttleLbTable $ runTypeLbTable $ ppMaxRetries $ ppTimeOut $ ppMaxMem $ dcsTimeOut $ nDCSretries $ monitorHost $ monitorTable)
+        MUST (name $ passwdFilePath $ AlienPath $ daqLbHost $ daqLbUser $ daqLbDB $ daqLbTable $ shuttleLbTable $ runTypeLbTable $ ppMaxRetries $ ppTimeOut $ ppMaxMem $ dcsTimeOut $ nDCSretries $ monitorHost $ monitorTable)
         MAY ( daqLbPort $ triggerWait $ mode $ keepDCSMap $ keepTempFolder $ shuttleAdmin $ amandaAdmin $ sendMail) )
 
 
index 2d0fc5fb04fa24e06cfad2ad0bbde040fef9bccc..56dc89ca9c655dff62cab0a644fae0d249005db8 100644 (file)
@@ -23,4 +23,5 @@ amandaAdmin: svetozar.kapusta@cern.ch
 nDCSretries: 5
 ppmaxRetries: 2
 passwdFilePath: /home/shuttle/.shuttle_prod
+AliEnPath: /alice/testdata/