Implementation of FXS database updates: fileChecksum, file size fields.
Setters to OCDB and reference storages, Shuttle log and temp dir in AliShuttle
and AliTestShuttle.
Small bugfixes.
#include "AliTestPreprocessor.h"
#include "AliCDBMetaData.h"
+#include "AliCDBEntry.h"
#include "AliDCSValue.h"
#include "AliLog.h"
#include "AliTestDataDCS.h"
#include <TTimeStamp.h>
+#include <TObjString.h>
//
// This class is an example for a simple preprocessor.
Log(Form("Number of events not put in logbook!"));
}
+ // Example of how to retrieve a condition object from OCDB
+
+ AliCDBEntry *entry = GetFromOCDB("Calib", "Data");
+ if (!entry)
+ {
+ Log("No object found in OCDB!");
+ } else {
+ TObjString *obj = dynamic_cast<TObjString*> (entry->GetObject());
+ Log(Form("Got TPC/Calib/Data object from OCDB. The object says: %s",obj->GetName()));
+ }
+
//Now we have to store the final CDB file
AliCDBMetaData metaData;
/*
$Log$
+Revision 1.8 2007/02/13 11:22:25 acolla
+Shuttle getters and setters of main/local OCDB/Reference storages, temp and log
+folders moved to AliShuttleInterface
+
Revision 1.6 2006/11/06 14:22:47 jgrosseo
major update (Alberto)
o) reading of run parameters from the logbook
sourceList->Add(new TObjString(source), new TObjString(fileName));
}
+//______________________________________________________________________________________________
+Bool_t AliTestShuttle::AddInputCDBEntry(AliCDBEntry* entry)
+{
+ // This function adds an object in the OCDB to be later retrieved with GetFromOCDB
+
+ AliCDBStorage *sto = AliCDBManager::Instance()->GetStorage(fgkMainCDB);
+ if (!sto)
+ {
+ Log("SHUTTLE", "GetFromOCDB - Cannot activate main OCDB for query!");
+ return 0;
+ }
+
+ return sto->Put(entry);
+}
+
+//______________________________________________________________________________________________
+AliCDBEntry* AliTestShuttle::GetFromOCDB(const AliCDBPath& path)
+{
+// returns obiect from OCDB valid for current run
+
+ AliCDBStorage *sto = AliCDBManager::Instance()->GetStorage(fgkMainCDB);
+ if (!sto)
+ {
+ Log("SHUTTLE", "GetFromOCDB - Cannot activate main OCDB for query!");
+ return 0;
+ }
+
+ return (AliCDBEntry*) sto->Get(path, fRun);
+}
+
//______________________________________________________________________________________________
void AliTestShuttle::Process()
{
return value->GetName();
}
+//______________________________________________________________________________________________
+void AliTestShuttle::SetShuttleTempDir(const char* tmpDir)
+{
+// sets Shuttle temp directory
+
+ fgkShuttleTempDir = gSystem->ExpandPathName(tmpDir);
+}
+
+//______________________________________________________________________________________________
+void AliTestShuttle::SetShuttleLogDir(const char* logDir)
+{
+// sets Shuttle log directory
+
+ fgkShuttleLogDir = gSystem->ExpandPathName(logDir);
+}
+
class TList;
class AliCDBMetaData;
class AliCDBPath;
+class AliCDBPath;
class AliTestShuttle : public AliShuttleInterface
{
void AddInputFile(Int_t system, const char* detector, const char* id, const char* source, const char* fileName);
void SetDCSInput(TMap* dcsAliasMap) { fDcsAliasMap = dcsAliasMap; }
void AddInputRunParameter(const char* key, const char* value);
+ Bool_t AddInputCDBEntry(AliCDBEntry* entry);
void Process();
virtual const char* GetFile(Int_t system, const char* detector, const char* id, const char* source);
virtual TList* GetFileSources(Int_t system, const char* detector, const char* id);
virtual const char* GetRunParameter(const char* key);
+ virtual AliCDBEntry* GetFromOCDB(const AliCDBPath& path);
virtual void Log(const char* detector, const char* message);
virtual void RegisterPreprocessor(AliPreprocessor* preprocessor);
+ static void SetMainCDB (TString mainCDB) {fgkMainCDB = mainCDB;}
+ static void SetLocalCDB (TString localCDB) {fgkLocalCDB = localCDB;}
+
+ static void SetMainRefStorage (TString mainRefStorage) {fgkMainRefStorage = mainRefStorage;}
+ static void SetLocalRefStorage (TString localRefStorage) {fgkLocalRefStorage = localRefStorage;}
+
+ static void SetShuttleTempDir (const char* tmpDir);
+ static void SetShuttleLogDir (const char* logDir);
+
protected:
Int_t fRun; // run that is simulated with the AliTestShuttle
// load library
gSystem->Load("libTestShuttle.so");
+ // create AliTestShuttle instance
+ // The parameters are run, startTime, endTime
+ AliTestShuttle* shuttle = new AliTestShuttle(7, 0, 1);
+
+
+ printf("Test Shuttle temp dir: %s\n", AliShuttleInterface::GetShuttleTempDir());
+
// TODO if needed, change location of OCDB and Reference test folders
// by default they are set to $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB and TestReference
- AliShuttleInterface::SetMainCDB("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
- AliShuttleInterface::SetMainRefStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
+ AliTestShuttle::SetTestShuttleCDB("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
+ AliTestShuttle::SetTestShuttleRefStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestReference");
printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data());
printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data());
- // TODO if needed, change location of temp and log folders (however they are not explicitly used here)
- // by default they are set to $ALICE_ROOT/SHUTTLE/TestShuttle/temp and log
- AliShuttleInterface::SetShuttleTempDir("$ALICE_ROOT/SHUTTLE/TestShuttle/temp");
- AliShuttleInterface::SetShuttleLogDir("$ALICE_ROOT/SHUTTLE/TestShuttle/log");
-
- printf("Test Shuttle temp dir: %s\n", AliShuttleInterface::GetShuttleTempDir());
- printf("Test Shuttle log dir: %s\n", AliShuttleInterface::GetShuttleLogDir());
-
-
- // create AliTestShuttle instance
- // The parameters are run, startTime, endTime
- AliTestShuttle* shuttle = new AliTestShuttle(7, 0, 1);
// TODO(1)
//
shuttle->AddInputRunParameter("NumberOfGDCs", "15");
// TODO(4)
+ //
+ // The shuttle can query condition parameters valid from the current run from the OCDB
+ // To test it, we must first store the object into the OCDB. It will be retrieved in the preprocessor
+ // using GetFromOCDB function.
+
+ TObjString obj("This is a condition parameter stored in OCDB");
+ AliCDBId id("TPC/Calib/Data", 0, AliCDBRunRange::Infinity());
+ AliCDBMetaData md;
+ AliCDBEntry entry(&obj, id, &md);
+
+ shuttle->AddInputCDBEntry(&entry);
+
+
+ // TODO(5)
// Create the preprocessor that should be tested, it registers itself automatically to the shuttle
AliPreprocessor* test = new AliTestPreprocessor(shuttle);
// Test the preprocessor
shuttle->Process();
- // TODO(5)
+ // TODO(6)
// In the preprocessor AliShuttleInterface::Store should be called to put the final
// data to the CDB. To check if all went fine have a look at the files produced in
// $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB/<detector>/SHUTTLE/Data
//
// Check the file which should have been created
- AliCDBEntry* entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())
+ AliCDBEntry* chkEntry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())
->Get("TPC/SHUTTLE/Data", 7);
- if (!entry)
+ if (!chkEntry)
{
printf("The file is not there. Something went wrong.\n");
return;
}
- AliTestDataDCS* output = dynamic_cast<AliTestDataDCS*> (entry->GetObject());
+ AliTestDataDCS* output = dynamic_cast<AliTestDataDCS*> (chkEntry->GetObject());
// If everything went fine, draw the result
if (output)
output->Draw();
}
delete filesources;
- // DCS
- TString filename = GetFile(AliShuttleInterface::kDCS, "DCSFile", 0);
- if(!filename.Length()) {
- AliError(Form("Error: retrieval of file from DCS failed!"));
- return 0;
- }
- TString command = Form("more %s", filename.Data());
- gSystem->Exec(command.Data());
-
- // STORAGE! The First file name will be stored into CDB, the second into reference storage
- TObjString filenameObj(filename);
- AliCDBMetaData metaData;
- result = Store("Calib", "DCSData", &filenameObj, &metaData);
-
- // HLT
- filesources = GetFileSources(AliShuttleInterface::kHLT, "HLTFile");
-
- if(!filesources) {
- Log(Form("No sources found for HLTFile for run %d !", fRun));
- return 0;
- }
-
- AliInfo("Here's the list of sources for HLTFile");
- filesources->Print();
-
- TIter iter2(filesources);
- i = 0;
- while((source=dynamic_cast<TObjString*> (iter2.Next()))){
- printf("\n\n Getting file #%d\n",++i);
- //if(i==1) continue;
- TString filename = GetFile(AliShuttleInterface::kHLT, "HLTFile", source->GetName());
- if(!filename.Length()) {
- AliError(Form("Error: retrieval of file from source %s failed!", source->GetName()));
- delete filesources;
- return 0;
- }
- TString command = Form("more %s",filename.Data());
- gSystem->Exec(command.Data());
-
- // STORAGE! The First file name will be stored into CDB, the second into reference storage
- TObjString filenameObj(filename);
- AliCDBMetaData metaData;
- if(i==1) result = Store("Calib", "HLTData", &filenameObj, &metaData);
- if(i==2) result = StoreReferenceData("Calib", "RefHLTData", &filenameObj, &metaData);
-
- }
- delete filesources;
+// // DCS
+// TString filename = GetFile(AliShuttleInterface::kDCS, "DCSFile", 0);
+// if(!filename.Length()) {
+// AliError(Form("Error: retrieval of file from DCS failed!"));
+// return 0;
+// }
+// TString command = Form("more %s", filename.Data());
+// gSystem->Exec(command.Data());
+//
+// // STORAGE! The First file name will be stored into CDB, the second into reference storage
+// TObjString filenameObj(filename);
+// AliCDBMetaData metaData;
+// result = Store("Calib", "DCSData", &filenameObj, &metaData);
+
+ // HLT
+ filesources = GetFileSources(AliShuttleInterface::kHLT, "HLTFile");
+
+ if(!filesources) {
+ Log(Form("No sources found for HLTFile for run %d !", fRun));
+ return 0;
+ }
+
+ AliInfo("Here's the list of sources for HLTFile");
+ filesources->Print();
+
+ TIter iter2(filesources);
+ i = 0;
+ while((source=dynamic_cast<TObjString*> (iter2.Next()))){
+ printf("\n\n Getting file #%d\n",++i);
+ //if(i==1) continue;
+ TString filename = GetFile(AliShuttleInterface::kHLT, "HLTFile", source->GetName());
+ if(!filename.Length()) {
+ AliError(Form("Error: retrieval of file from source %s failed!", source->GetName()));
+ delete filesources;
+ return 0;
+ }
+ TString command = Form("more %s",filename.Data());
+ gSystem->Exec(command.Data());
+
+ // STORAGE! The First file name will be stored into CDB, the second into reference storage
+ TObjString filenameObj(filename);
+ AliCDBMetaData metaData;
+ if(i==1) result = Store("Calib", "HLTData", &filenameObj, &metaData);
+ if(i==2) result = StoreReferenceData("Calib", "RefHLTData", &filenameObj, &metaData);
+
+ }
+ delete filesources;
return result;