Implementation of the local caching of the OCDB.
authoracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 4 Sep 2007 17:39:43 +0000 (17:39 +0000)
committeracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 4 Sep 2007 17:39:43 +0000 (17:39 +0000)
- "Remote storage" added to AliCDBManager's possible storages. Remote storage is used if it
is activated and if object is not found in the default storage. This is used in case an
object in the local cache is lost before the job is executed.
- Setting of remote storage added in AliSimulation and AliReconstruction.

STEER/AliReconstruction.cxx
STEER/AliReconstruction.h
STEER/AliSimulation.cxx
STEER/AliSimulation.h

index 238492cd6bd6b603386899042a99504fa706db99..0d19f03a74bf7e1aea625e7ff6056142577b8b31 100644 (file)
@@ -217,6 +217,7 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename, const char* cdb
 
   fAlignObjArray(NULL),
   fCDBUri(cdbUri),
+  fRemoteCDBUri(""),
   fSpecCDBUri()
 {
 // create reconstruction object with default parameters
@@ -268,6 +269,7 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) :
 
   fAlignObjArray(rec.fAlignObjArray),
   fCDBUri(rec.fCDBUri),
+  fRemoteCDBUri(rec.fRemoteCDBUri),
   fSpecCDBUri()
 {
 // copy constructor
@@ -331,6 +333,23 @@ void AliReconstruction::InitCDBStorage()
     man->SetDefaultStorage(fCDBUri);
   }
 
+  // Remote storage (the Grid storage) is used if it is activated
+  // and if the object is not found in the default storage
+  if (man->IsRemoteStorageSet())
+  {
+    AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+    AliWarning("Remote CDB storage has been already set !");
+    AliWarning(Form("Ignoring the remote storage declared in AliReconstruction: %s",fRemoteCDBUri.Data()));
+    AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+    fRemoteCDBUri = "";
+  }
+  else {
+    AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+    AliDebug(2, Form("Remote CDB storage is set to: %s",fRemoteCDBUri.Data()));
+    AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+    man->SetRemoteStorage(fRemoteCDBUri);
+  }
+
   // Now activate the detector specific CDB storage locations
   for (Int_t i = 0; i < fSpecCDBUri.GetEntriesFast(); i++) {
     TObject* obj = fSpecCDBUri[i];
@@ -352,6 +371,17 @@ void AliReconstruction::SetDefaultStorage(const char* uri) {
 
 }
 
+//_____________________________________________________________________________
+void AliReconstruction::SetRemoteStorage(const char* uri) {
+// Store the desired remote CDB storage location
+// Activate it later within the Run() method
+// Remote storage (the Grid storage) is used if it is activated
+// and if the object is not found in the default storage
+
+  fRemoteCDBUri = uri;
+
+}
+
 //_____________________________________________________________________________
 void AliReconstruction::SetSpecificStorage(const char* calibType, const char* uri) {
 // Store a detector-specific CDB storage location
index 99dcade92bed5b1ccb24db821ed728cf2f35cce8..99e67f49c150a8069073a6fcb731d3d386598662 100644 (file)
@@ -85,6 +85,7 @@ public:
   // CDB storage activation
   void InitCDBStorage();
   void SetDefaultStorage(const char* uri);
+  void SetRemoteStorage(const char* uri);
   void SetSpecificStorage(const char* calibType, const char* uri);
 
   Bool_t SetRunNumber();
@@ -174,6 +175,7 @@ private:
   TObjArray*    fAlignObjArray;      // array with the alignment objects to be applied to the geometry
 
   TString       fCDBUri;             // Uri of the default CDB storage
+  TString       fRemoteCDBUri;       // Uri of the remote CDB storage
   TObjArray      fSpecCDBUri;         // Array with detector specific CDB storages
 
   //Quality Assurance
index 0bab59ee41b3e8d78fb446e57fc8d88b994054fe..362d9cceea7d761c5db188a0e3fea5d967b34e52 100644 (file)
@@ -169,6 +169,7 @@ AliSimulation::AliSimulation(const char* configFileName, const char* cdbUri,
   fUseBkgrdVertex(kTRUE),
   fRegionOfInterest(kFALSE),
   fCDBUri(cdbUri),
+  fRemoteCDBUri(""),
   fSpecCDBUri(),
   fEmbeddingFlag(kFALSE)
 {
@@ -203,6 +204,7 @@ AliSimulation::AliSimulation(const AliSimulation& sim) :
   fUseBkgrdVertex(sim.fUseBkgrdVertex),
   fRegionOfInterest(sim.fRegionOfInterest),
   fCDBUri(sim.fCDBUri),
+  fRemoteCDBUri(sim.fRemoteCDBUri),
   fSpecCDBUri(),
   fEmbeddingFlag(sim.fEmbeddingFlag)
 {
@@ -287,6 +289,23 @@ void AliSimulation::InitCDBStorage()
     man->SetDefaultStorage(fCDBUri);
   }
 
+  // Remote storage (the Grid storage) is used if it is activated
+  // and if the object is not found in the default storage
+  if (man->IsRemoteStorageSet())
+  {
+    AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+    AliWarning("Remote CDB storage has been already set !");
+    AliWarning(Form("Ignoring the remote storage declared in AliSimulation: %s",fRemoteCDBUri.Data()));
+    AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+    fRemoteCDBUri = "";
+  }
+  else {
+    AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+    AliDebug(2, Form("Remote CDB storage is set to: %s",fRemoteCDBUri.Data()));
+    AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+    man->SetRemoteStorage(fRemoteCDBUri);
+  }
+
   // Now activate the detector specific CDB storage locations
   for (Int_t i = 0; i < fSpecCDBUri.GetEntriesFast(); i++) {
     TObject* obj = fSpecCDBUri[i];
@@ -308,6 +327,17 @@ void AliSimulation::SetDefaultStorage(const char* uri) {
 
 }
 
+//_____________________________________________________________________________
+void AliSimulation::SetRemoteStorage(const char* uri) {
+// Store the desired remote CDB storage location
+// Activate it later within the Run() method
+// Remote storage (the Grid storage) is used if it is activated
+// and if the object is not found in the default storage (the local cache)
+
+  fRemoteCDBUri = uri;
+
+}
+
 //_____________________________________________________________________________
 void AliSimulation::SetSpecificStorage(const char* calibType, const char* uri) {
 // Store a detector-specific CDB storage location
index 23ea5c9480cb9ac0d7095b5cb153909e9f74209f..8c62847623b39d9272ea0d7f2545339b2bbec3e2 100644 (file)
@@ -73,7 +73,8 @@ public:
   // CDB storage activation
   void InitCDBStorage();
   void SetDefaultStorage(const char* uri);
-  void SetSpecificStorage(const char* calibType, const char* uri);    
+  void SetRemoteStorage(const char* uri);
+  void SetSpecificStorage(const char* calibType, const char* uri);
 
   virtual Bool_t Run(Int_t nEvents = 0);
 
@@ -124,6 +125,7 @@ private:
   Bool_t         fRegionOfInterest;   // digitization in region of interest
 
   TString       fCDBUri;             // Uri of the default CDB storage
+  TString       fRemoteCDBUri;       // Uri of the remote CDB storage
   TObjArray      fSpecCDBUri;         // Array with detector specific CDB storages
   Bool_t         fEmbeddingFlag;      // Flag for embedding
   ClassDef(AliSimulation, 4)  // class for running generation, simulation and digitization