From 9827400ba13b4f7020ce4c5025bd315d99384a00 Mon Sep 17 00:00:00 2001 From: jgrosseo Date: Wed, 4 Apr 2007 10:33:36 +0000 Subject: [PATCH] 1) Storing of files to the Grid is now done _after_ your preprocessors succeeded. This is transparent, which means that you can still use the same functions (Store, StoreReferenceData) to store files to the Grid. However, the Shuttle first stores them locally and transfers them after the preprocessor finished. The return code of these two functions has changed from UInt_t to Bool_t which gives you the success of the storing. In case of an error with the Grid, the Shuttle will retry the storing later, the preprocessor does not need to be run again. 2) The meaning of the return code of the preprocessor has changed. 0 is now success and any other value means failure. This value is stored in the log and you can use it to keep details about the error condition. 3) New function StoreReferenceFile to _directly_ store a file (without opening it) to the reference storage. 4) The memory usage of the preprocessor is monitored. If it exceeds 2 GB it is terminated. 5) New function AliPreprocessor::ProcessDCS(). If you do not need to have DCS data in all cases, you can skip the processing by implemting this function and returning kFALSE under certain conditions. E.g. if there is a certain run type. If you always need DCS data (like before), you do not need to implement it. 6) The run type has been added to the monitoring page --- SHUTTLE/AliShuttle.cxx | 685 ++++++++++++++------ SHUTTLE/AliShuttle.h | 21 +- SHUTTLE/AliShuttleConfig.cxx | 18 +- SHUTTLE/AliShuttleConfig.h | 4 +- SHUTTLE/AliShuttleLogbookEntry.cxx | 139 ++-- SHUTTLE/AliShuttleLogbookEntry.h | 11 +- SHUTTLE/DATENotifier.cxx | 7 - SHUTTLE/Shuttle.C | 10 + SHUTTLE/TestShuttle/AliTestPreprocessor.cxx | 37 +- SHUTTLE/TestShuttle/AliTestPreprocessor.h | 1 + SHUTTLE/TestShuttle/AliTestShuttle.cxx | 99 +-- SHUTTLE/TestShuttle/AliTestShuttle.h | 13 +- SHUTTLE/TestShuttle/TestPreprocessor.C | 5 +- SHUTTLE/TestShuttle/file1.root | Bin 0 -> 318 bytes SHUTTLE/schema/shuttle.schema | 3 +- STEER/AliGRPPreprocessor.cxx | 28 +- STEER/AliPreprocessor.cxx | 15 +- STEER/AliPreprocessor.h | 8 +- STEER/AliShuttleInterface.h | 5 +- 19 files changed, 711 insertions(+), 398 deletions(-) create mode 100644 SHUTTLE/TestShuttle/file1.root diff --git a/SHUTTLE/AliShuttle.cxx b/SHUTTLE/AliShuttle.cxx index 06347be7d97..3b2b4b7dcdc 100644 --- a/SHUTTLE/AliShuttle.cxx +++ b/SHUTTLE/AliShuttle.cxx @@ -15,6 +15,10 @@ /* $Log$ +Revision 1.33 2007/04/03 13:56:01 acolla +Grid Storage at the end of preprocessing. Added virtual method to disable DCS query according to the +run type. + Revision 1.32 2007/02/28 10:41:56 acolla Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by AliPreprocessor::GetRunType() function. @@ -181,6 +185,11 @@ some docs added #include #include #include +#include +#include +#include +#include +#include #include @@ -191,8 +200,6 @@ some docs added ClassImp(AliShuttle) -Bool_t AliShuttle::fgkProcessDCS(kTRUE); - //______________________________________________________________________________________________ AliShuttle::AliShuttle(const AliShuttleConfig* config, UInt_t timeout, Int_t retries): @@ -205,7 +212,9 @@ fStatusEntry(0), fMonitoringMutex(0), fLastActionTime(0), fLastAction(), -fMonaLisa(0) +fMonaLisa(0), +fTestMode(kNone), +fReadTestMode(kFALSE) { // // config: AliShuttleConfig used @@ -230,7 +239,9 @@ fMonaLisa(0) //______________________________________________________________________________________________ AliShuttle::~AliShuttle() { -// destructor + // + // destructor + // fPreprocessorMap.DeleteAll(); for(int iSys=0;iSys<4;iSys++) @@ -277,26 +288,24 @@ void AliShuttle::RegisterPreprocessor(AliPreprocessor* preprocessor) Bool_t AliShuttle::Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite) { - // Stores a CDB object in the storage for offline reconstruction. Objects that are not needed for - // offline reconstruction, but should be stored anyway (e.g. for debugging) should NOT be stored - // using this function. Use StoreReferenceData instead! - // It calls StoreLocally function which temporarily stores the data locally; when the preprocessor - // finishes the data are transferred to the main storage (Grid). + // Stores a CDB object in the storage for offline reconstruction. Objects that are not needed for + // offline reconstruction, but should be stored anyway (e.g. for debugging) should NOT be stored + // using this function. Use StoreReferenceData instead! + // It calls StoreLocally function which temporarily stores the data locally; when the preprocessor + // finishes the data are transferred to the main storage (Grid). return StoreLocally(fgkLocalCDB, path, object, metaData, validityStart, validityInfinite); - } //______________________________________________________________________________________________ Bool_t AliShuttle::StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData) { - // Stores a CDB object in the storage for reference data. This objects will not be available during - // offline reconstrunction. Use this function for reference data only! - // It calls StoreLocally function which temporarily stores the data locally; when the preprocessor - // finishes the data are transferred to the main storage (Grid). + // Stores a CDB object in the storage for reference data. This objects will not be available during + // offline reconstrunction. Use this function for reference data only! + // It calls StoreLocally function which temporarily stores the data locally; when the preprocessor + // finishes the data are transferred to the main storage (Grid). return StoreLocally(fgkLocalRefStorage, path, object, metaData); - } //______________________________________________________________________________________________ @@ -304,25 +313,31 @@ Bool_t AliShuttle::StoreLocally(const TString& localUri, const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite) { - // Store object temporarily in local storage. Parameters are passed by Store and StoreReferenceData functions. - // when the preprocessor finishes the data are transferred to the main storage (Grid). - // The parameters are: - // 1) Uri of the backup storage (Local) - // 2) the object's path. - // 3) the object to be stored - // 4) the metaData to be associated with the object - // 5) the validity start run number w.r.t. the current run, - // if the data is valid only for this run leave the default 0 - // 6) specifies if the calibration data is valid for infinity (this means until updated), - // typical for calibration runs, the default is kFALSE - // - // returns 0 if fail, 1 otherwise + // Store object temporarily in local storage. Parameters are passed by Store and StoreReferenceData functions. + // when the preprocessor finishes the data are transferred to the main storage (Grid). + // The parameters are: + // 1) Uri of the backup storage (Local) + // 2) the object's path. + // 3) the object to be stored + // 4) the metaData to be associated with the object + // 5) the validity start run number w.r.t. the current run, + // if the data is valid only for this run leave the default 0 + // 6) specifies if the calibration data is valid for infinity (this means until updated), + // typical for calibration runs, the default is kFALSE + // + // returns 0 if fail, 1 otherwise + if (fTestMode & kErrorStorage) + { + Log(fCurrentDetector, "StoreLocally - In TESTMODE - Simulating error while storing locally"); + return kFALSE; + } + const char* cdbType = (localUri == fgkLocalCDB) ? "CDB" : "Reference"; Int_t firstRun = GetCurrentRun() - validityStart; if(firstRun < 0) { - AliError("First valid run happens to be less than 0! Setting it to 0."); + AliWarning("First valid run happens to be less than 0! Setting it to 0."); firstRun=0; } @@ -352,7 +367,7 @@ Bool_t AliShuttle::StoreLocally(const TString& localUri, if(!result) { - Log("SHUTTLE", Form("StoreLocally - Can't store %s data!", fCurrentDetector.Data())); + Log(fCurrentDetector, Form("StoreLocally - Can't store object <%s>!", id.ToString().Data())); } return result; @@ -361,16 +376,29 @@ Bool_t AliShuttle::StoreLocally(const TString& localUri, //______________________________________________________________________________________________ Bool_t AliShuttle::StoreOCDB() { - // Called when preprocessor ends successfully or when previous storage attempt failed (kStoreError status) - // Calls underlying StoreOCDB(const char*) function twice, for OCDB and Reference storage. - + // + // Called when preprocessor ends successfully or when previous storage attempt failed (kStoreError status) + // Calls underlying StoreOCDB(const char*) function twice, for OCDB and Reference storage. + // Then calls StoreRefFilesToGrid to store reference files. + // + + if (fTestMode & kErrorGrid) + { + Log("SHUTTLE", "StoreOCDB - In TESTMODE - Simulating error while storing in the Grid"); + Log(fCurrentDetector, "StoreOCDB - In TESTMODE - Simulating error while storing in the Grid"); + return kFALSE; + } + AliInfo("Storing OCDB data ..."); Bool_t resultCDB = StoreOCDB(fgkMainCDB); AliInfo("Storing reference data ..."); Bool_t resultRef = StoreOCDB(fgkMainRefStorage); - - return resultCDB && resultRef; + + AliInfo("Storing reference files ..."); + Bool_t resultRefFiles = StoreRefFilesToGrid(); + + return resultCDB && resultRef && resultRefFiles; } //______________________________________________________________________________________________ @@ -486,10 +514,158 @@ Bool_t AliShuttle::StoreOCDB(const TString& gridURI) return result; } +//______________________________________________________________________________________________ +Bool_t AliShuttle::StoreReferenceFile(const char* detector, const char* localFile, const char* gridFileName) +{ + // + // Stores reference file directly (without opening it). This function stores the file locally + // renaming it to #runNumber_gridFileName. + // + + if (fTestMode & kErrorStorage) + { + Log(fCurrentDetector, "StoreReferenceFile - In TESTMODE - Simulating error while storing locally"); + return kFALSE; + } + + AliCDBManager* man = AliCDBManager::Instance(); + AliCDBStorage* sto = man->GetStorage(fgkLocalRefStorage); + + TString localBaseFolder = sto->GetBaseFolder(); + + TString targetDir; + targetDir.Form("%s/%s", localBaseFolder.Data(), detector); + + TString target; + target.Form("%s/%d_%s", targetDir.Data(), GetCurrentRun(), gridFileName); + + Int_t result = gSystem->GetPathInfo(targetDir, 0, (Long64_t*) 0, 0, 0); + if (result) + { + result = gSystem->mkdir(targetDir, kTRUE); + if (result != 0) + { + Log("SHUTTLE", Form("StoreReferenceFile - Error creating base directory %s", targetDir.Data())); + return kFALSE; + } + } + + result = gSystem->CopyFile(localFile, target); + + if (result == 0) + { + Log("SHUTTLE", Form("StoreReferenceFile - Stored file %s locally to %s", localFile, target.Data())); + return kTRUE; + } + else + { + Log("SHUTTLE", Form("StoreReferenceFile - Storing file %s locally to %s failed", localFile, target.Data())); + return kFALSE; + } +} + +//______________________________________________________________________________________________ +Bool_t AliShuttle::StoreRefFilesToGrid() +{ + // + // Transfers the reference file to the Grid. + // The final full path of the file is: + // gridBaseReferenceFolder/DET/#runNumber_gridFileName + // + + AliCDBManager* man = AliCDBManager::Instance(); + AliCDBStorage* sto = man->GetStorage(fgkLocalRefStorage); + if (!sto) + return kFALSE; + TString localBaseFolder = sto->GetBaseFolder(); + + TString dir; + dir.Form("%s/%s", localBaseFolder.Data(), fCurrentDetector.Data()); + + AliCDBStorage* gridSto = man->GetStorage(fgkMainRefStorage); + if (!gridSto) + return kFALSE; + TString gridBaseFolder = gridSto->GetBaseFolder(); + TString alienDir; + alienDir.Form("%s%s", gridBaseFolder.Data(), fCurrentDetector.Data()); + + if(!gGrid) + return kFALSE; + + // check that DET folder exists, otherwise create it + TGridResult* result = gGrid->Ls(alienDir.Data()); + + if(!result) + return kFALSE; + + if(!result->GetFileName(0)) { + if(!gGrid->Mkdir(alienDir.Data(),"",0)){ + Log("SHUTTLE", Form("StoreRefFilesToGrid - Cannot create directory %s", + alienDir.Data())); + return kFALSE; + } + + } + + TString begin; + begin.Form("%d_", GetCurrentRun()); + + TSystemDirectory* baseDir = new TSystemDirectory("/", dir); + TList* dirList = baseDir->GetListOfFiles(); + if (!dirList) + return kTRUE; + + Int_t nDirs = dirList->GetEntries(); + + Bool_t success = kTRUE; + + for (Int_t iDir=0; iDir (dirList->At(iDir)); + if (!entry) + continue; + + if (entry->IsDirectory()) + continue; + + TString fileName(entry->GetName()); + if (!fileName.BeginsWith(begin)) + continue; + + TString fullLocalPath; + fullLocalPath.Form("%s/%s", dir.Data(), fileName.Data()); + + TString fullGridPath; + fullGridPath.Form("alien://%s/%s", alienDir.Data(), fileName.Data()); + + Log("SHUTTLE", Form("StoreRefFilesToGrid - Copying local file %s to %s", fullLocalPath.Data(), fullGridPath.Data())); + + TFileMerger fileMerger; + Bool_t result = fileMerger.Cp(fullLocalPath, fullGridPath); + + if (result) + { + Log("SHUTTLE", Form("StoreRefFilesToGrid - Copying local file %s to %s succeeded", fullLocalPath.Data(), fullGridPath.Data())); + RemoveFile(fullLocalPath); + } + else + { + Log("SHUTTLE", Form("StoreRefFilesToGrid - Copying local file %s to %s failed", fullLocalPath.Data(), fullGridPath.Data())); + success = kFALSE; + } + } + + delete baseDir; + + return success; +} + //______________________________________________________________________________________________ void AliShuttle::CleanLocalStorage(const TString& uri) { -// Called in case the preprocessor is declared failed. Remove remaining objects from the local storages. + // + // Called in case the preprocessor is declared failed. Remove remaining objects from the local storages. + // const char* type = 0; if(uri == fgkLocalCDB) { @@ -526,7 +702,9 @@ void AliShuttle::CleanLocalStorage(const TString& uri) //______________________________________________________________________________________________ void AliShuttle::RemoveFile(const char* filename) { -// removes local file + // + // removes local file + // TString command(Form("rm -f %s", filename)); @@ -541,7 +719,9 @@ void AliShuttle::RemoveFile(const char* filename) //______________________________________________________________________________________________ AliShuttleStatus* AliShuttle::ReadShuttleStatus() { -// Reads the AliShuttleStatus from the CDB + // + // Reads the AliShuttleStatus from the CDB + // if (fStatusEntry){ delete fStatusEntry; @@ -566,7 +746,9 @@ AliShuttleStatus* AliShuttle::ReadShuttleStatus() //______________________________________________________________________________________________ Bool_t AliShuttle::WriteShuttleStatus(AliShuttleStatus* status) { -// writes the status for one subdetector + // + // writes the status for one subdetector + // if (fStatusEntry){ delete fStatusEntry; @@ -596,7 +778,9 @@ Bool_t AliShuttle::WriteShuttleStatus(AliShuttleStatus* status) //______________________________________________________________________________________________ void AliShuttle::UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount) { - // changes the AliShuttleStatus for the given detector and run to the given status + // + // changes the AliShuttleStatus for the given detector and run to the given status + // if (!fStatusEntry){ AliError("UNEXPECTED: fStatusEntry empty"); @@ -652,9 +836,9 @@ void AliShuttle::SendMLInfo() //______________________________________________________________________________________________ Bool_t AliShuttle::ContinueProcessing() { -// this function reads the AliShuttleStatus information from CDB and -// checks if the processing should be continued -// if yes it returns kTRUE and updates the AliShuttleStatus with nextStatus + // this function reads the AliShuttleStatus information from CDB and + // checks if the processing should be continued + // if yes it returns kTRUE and updates the AliShuttleStatus with nextStatus if (!fConfig->HostProcessDetector(fCurrentDetector)) return kFALSE; @@ -711,7 +895,8 @@ Bool_t AliShuttle::ContinueProcessing() Log("SHUTTLE", Form("ContinueProcessing - %s: Grid storage of one or more objects failed. Trying again now", fCurrentDetector.Data())); - if(StoreOCDB()){ + UpdateShuttleStatus(AliShuttleStatus::kStoreStarted); + if (StoreOCDB()){ Log("SHUTTLE", Form("ContinueProcessing - %s: all objects successfully stored into main storage", fCurrentDetector.Data())); UpdateShuttleStatus(AliShuttleStatus::kDone); @@ -720,8 +905,7 @@ Bool_t AliShuttle::ContinueProcessing() Log("SHUTTLE", Form("ContinueProcessing - %s: Grid storage failed again", fCurrentDetector.Data())); - // trigger ML information manually because we do not had a status change - SendMLInfo(); + UpdateShuttleStatus(AliShuttleStatus::kStoreError); } return kFALSE; } @@ -739,24 +923,29 @@ Bool_t AliShuttle::ContinueProcessing() // there may still be objects in local OCDB and reference storage // and FXS databases may be not updated: do it now! - CleanLocalStorage(fgkLocalCDB); - CleanLocalStorage(fgkLocalRefStorage); - UpdateTableFailCase(); + + // TODO Currently disabled, we want to keep files in case of failure! + // CleanLocalStorage(fgkLocalCDB); + // CleanLocalStorage(fgkLocalRefStorage); + // UpdateTableFailCase(); + + // Send mail to detector expert! + AliInfo(Form("Sending mail to %s expert...", fCurrentDetector.Data())); + if (!SendMail()) + Log("SHUTTLE", Form("ContinueProcessing - Could not send mail to %s expert", + fCurrentDetector.Data())); } else { Log("SHUTTLE", Form("ContinueProcessing - %s: restarting. " "Aborted before with %s. Retry number %d.", fCurrentDetector.Data(), status->GetStatusName(), status->GetCount())); - UpdateShuttleStatus(AliShuttleStatus::kStarted, kTRUE); + Bool_t increaseCount = kTRUE; + if (status->GetStatus() == AliShuttleStatus::kDCSError || status->GetStatus() == AliShuttleStatus::kDCSStarted) + increaseCount = kFALSE; + UpdateShuttleStatus(AliShuttleStatus::kStarted, increaseCount); cont = kTRUE; } - // Send mail to detector expert! - AliInfo(Form("Sending mail to %s expert...", fCurrentDetector.Data())); - if (!SendMail()) - Log("SHUTTLE", Form("ContinueProcessing - Could not send mail to %s expert", - fCurrentDetector.Data())); - return cont; } @@ -770,37 +959,68 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry) // Returns kFALSE in case of error occured and kTRUE otherwise // - if(!entry) return kFALSE; + if (!entry) return kFALSE; fLogbookEntry = entry; - if (fLogbookEntry->IsDone()) - { - Log("SHUTTLE","Process - Shuttle is already DONE. Updating logbook"); - UpdateShuttleLogbook("shuttle_done"); - fLogbookEntry = 0; - return kTRUE; - } + AliInfo(Form("\n\n \t\t\t^*^*^*^*^*^*^*^*^*^*^*^* run %d: START ^*^*^*^*^*^*^*^*^*^*^*^* \n", + GetCurrentRun())); // create ML instance that monitors this run fMonaLisa = new TMonaLisaWriter(Form("%d", GetCurrentRun()), "SHUTTLE", "aliendb1.cern.ch"); // disable monitoring of other parameters that come e.g. from TFile gMonitoringWriter = 0; - AliInfo(Form("\n\n \t\t\t^*^*^*^*^*^*^*^*^*^*^*^* run %d: START ^*^*^*^*^*^*^*^*^*^*^*^* \n", - GetCurrentRun())); - - // Set run type from run type logbook into current fLogbookEntry - SetRunType(); - // Send the information to ML TMonaLisaText mlStatus("SHUTTLE_status", "Processing"); + TMonaLisaText mlRunType("SHUTTLE_runtype", Form("%s (%s)", entry->GetRunType(), entry->GetRunParameter("log"))); TList mlList; mlList.Add(&mlStatus); + mlList.Add(&mlRunType); fMonaLisa->SendParameters(&mlList); + if (fLogbookEntry->IsDone()) + { + Log("SHUTTLE","Process - Shuttle is already DONE. Updating logbook"); + UpdateShuttleLogbook("shuttle_done"); + fLogbookEntry = 0; + return kTRUE; + } + + // read test mode if flag is set + if (fReadTestMode) + { + TString logEntry(entry->GetRunParameter("log")); + //printf("log entry = %s\n", logEntry.Data()); + TString searchStr("Testmode: "); + Int_t pos = logEntry.Index(searchStr.Data()); + //printf("%d\n", pos); + if (pos >= 0) + { + TSubString subStr = logEntry(pos + searchStr.Length(), logEntry.Length()); + //printf("%s\n", subStr.String().Data()); + TString newStr(subStr.Data()); + TObjArray* token = newStr.Tokenize(' '); + if (token) + { + //token->Print(); + TObjString* tmpStr = dynamic_cast (token->First()); + if (tmpStr) + { + Int_t testMode = tmpStr->String().Atoi(); + if (testMode > 0) + { + Log("SHUTTLE", Form("Enabling test mode %d", testMode)); + SetTestMode((TestMode) testMode); + } + } + delete token; + } + } + } + fLogbookEntry->Print("all"); // Initialization @@ -849,8 +1069,11 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry) if (expiredTime > fConfig->GetPPTimeOut()) { - Log("SHUTTLE", Form("%s: Process time out. Run time: %d seconds. Killing...", - fCurrentDetector.Data(), expiredTime)); + TString tmp; + tmp.Form("Process of %s time out. Run time: %d seconds. Killing...", + fCurrentDetector.Data(), expiredTime); + Log("SHUTTLE", tmp); + Log(fCurrentDetector, tmp); kill(pid, 9); @@ -862,9 +1085,55 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry) else { if (expiredTime % 60 == 0) - Log("SHUTTLE", Form("Checked process. Run time: %d seconds.", + Log("SHUTTLE", Form("Checked process. Run time: %d seconds.", expiredTime)); gSystem->Sleep(1000); + + TString checkStr; + checkStr.Form("ps -o vsize --pid %d | tail -n 1", pid); + FILE* pipe = gSystem->OpenPipe(checkStr, "r"); + if (!pipe) + { + Log("SHUTTLE", Form("Error: Could not open pipe to %s", checkStr.Data())); + continue; + } + + char buffer[100]; + if (!fgets(buffer, 100, pipe)) + { + Log("SHUTTLE", "Error: ps did not return anything"); + gSystem->ClosePipe(pipe); + continue; + } + gSystem->ClosePipe(pipe); + + //Log("SHUTTLE", Form("ps returned %s", buffer)); + + Int_t mem = 0; + if ((sscanf(buffer, "%d\n", &mem) != 1) || !mem) + { + Log("SHUTTLE", "Error: Could not parse output of ps"); + continue; + } + + if (expiredTime % 60 == 0) + Log("SHUTTLE", Form("The process consumes %d KB of memory.", mem)); + + if (mem > fConfig->GetPPMaxMem()) + { + TString tmp; + tmp.Form("Process exceeds maximum allowed memory (%d KB > %d KB). Killing...", + mem, fConfig->GetPPMaxMem()); + Log("SHUTTLE", tmp); + Log(fCurrentDetector, tmp); + + kill(pid, 9); + + UpdateShuttleStatus(AliShuttleStatus::kPPOutOfMemory); + hasError = kTRUE; + + gSystem->Sleep(1000); + } } } @@ -878,7 +1147,7 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry) Log("SHUTTLE", Form("%s: the return code is %d", fCurrentDetector.Data(), returnCode)); - if (returnCode != 0) hasError = kTRUE; + if (returnCode == 0) hasError = kTRUE; } } else if (pid == 0) @@ -886,22 +1155,9 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry) // client AliInfo(Form("In client process of %d - %s", GetCurrentRun(), aDetector->GetName())); - UInt_t returnCode = ProcessCurrentDetector(); // 0 means success - - - if (returnCode > 0) // TODO: returnCode>0 means Preprocessor ERROR! Preprocessors should follow this! - { - if (returnCode == kDCSErrCode) - { - AliInfo(Form("\n \t\t\t****** run %d - %s: DCS ERROR ****** \n\n", - GetCurrentRun(), aDetector->GetName())); - } else { - - AliInfo(Form("\n \t\t\t****** run %d - %s: PREPROCESSOR ERROR ****** \n\n", - GetCurrentRun(), aDetector->GetName())); - } - } else { // Preprocessor finished successfully! - + Bool_t success = ProcessCurrentDetector(); + if (success) // Preprocessor finished successfully! + { // Update time_processed field in FXS DB if (UpdateTable() == kFALSE) Log("SHUTTLE", Form("Process - %s: Could not update FXS databases!")); @@ -913,11 +1169,12 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry) AliInfo(Form("\n \t\t\t****** run %d - %s: STORAGE ERROR ****** \n\n", GetCurrentRun(), aDetector->GetName())); UpdateShuttleStatus(AliShuttleStatus::kStoreError); - returnCode = kStorErrCode; + success = kFALSE; } else { AliInfo(Form("\n \t\t\t****** run %d - %s: DONE ****** \n\n", GetCurrentRun(), aDetector->GetName())); UpdateShuttleStatus(AliShuttleStatus::kDone); + UpdateShuttleLogbook(fCurrentDetector, "DONE"); } } @@ -927,10 +1184,10 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry) } AliInfo(Form("Client process of %d - %s is exiting now with %d.", - GetCurrentRun(), aDetector->GetName(), returnCode)); + GetCurrentRun(), aDetector->GetName(), success)); // the client exits here - gSystem->Exit(returnCode); + gSystem->Exit(success); AliError("We should never get here!!!"); } @@ -983,7 +1240,7 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry) } //______________________________________________________________________________________________ -UInt_t AliShuttle::ProcessCurrentDetector() +Bool_t AliShuttle::ProcessCurrentDetector() { // // Makes data retrieval just for a specific detector (fCurrentDetector). @@ -1004,12 +1261,15 @@ UInt_t AliShuttle::ProcessCurrentDetector() Bool_t processDCS = aPreprocessor->ProcessDCS(); - // TODO Test only... I've added a flag that allows to - // exclude DCS archive DB query - if (!processDCS || !fgkProcessDCS) + if (!processDCS || fTestMode & kSkipDCS) { - AliInfo("Skipping DCS processing!"); - aDCSError = kFALSE; + AliInfo("In TESTMODE - Skipping DCS processing!"); + } + else if (fTestMode & kErrorDCS) + { + AliInfo("In TESTMODE - Simulating DCS error"); + UpdateShuttleStatus(AliShuttleStatus::kDCSError); + return kFALSE; } else { UpdateShuttleStatus(AliShuttleStatus::kDCSStarted); @@ -1041,7 +1301,7 @@ UInt_t AliShuttle::ProcessCurrentDetector() anAlias->GetName())); UpdateShuttleStatus(AliShuttleStatus::kDCSError); dcsMap.DeleteAll(); - return kDCSErrCode; + return kFALSE; } } @@ -1068,7 +1328,7 @@ UInt_t AliShuttle::ProcessCurrentDetector() aDP->GetName())); UpdateShuttleStatus(AliShuttleStatus::kDCSError); dcsMap.DeleteAll(); - return kDCSErrCode; + return kFALSE; } } } @@ -1080,26 +1340,29 @@ UInt_t AliShuttle::ProcessCurrentDetector() if (returnValue > 0) // Preprocessor error! { + Log(fCurrentDetector, Form("Preprocessor failed. Process returned %d.", returnValue)); UpdateShuttleStatus(AliShuttleStatus::kPPError); - - } else { // preprocessor ok! - UpdateShuttleStatus(AliShuttleStatus::kPPDone); - UpdateShuttleLogbook(fCurrentDetector, "DONE"); - Log("SHUTTLE", Form("ProcessCurrentDetector - %s preprocessor returned success", - fCurrentDetector.Data())); - } + dcsMap.DeleteAll(); + return kFALSE; + } + + // preprocessor ok! + UpdateShuttleStatus(AliShuttleStatus::kPPDone); + Log(fCurrentDetector, Form("ProcessCurrentDetector - %s preprocessor returned success", + fCurrentDetector.Data())); dcsMap.DeleteAll(); - return returnValue; + return kTRUE; } //______________________________________________________________________________________________ Bool_t AliShuttle::QueryShuttleLogbook(const char* whereClause, TObjArray& entries) { -// Query DAQ's Shuttle logbook and fills detector status object. -// Call QueryRunParameters to query DAQ logbook for run parameters. + // Query DAQ's Shuttle logbook and fills detector status object. + // Call QueryRunParameters to query DAQ logbook for run parameters. + // entries.SetOwner(1); @@ -1118,15 +1381,9 @@ Bool_t AliShuttle::QueryShuttleLogbook(const char* whereClause, AliDebug(2,Form("Query = %s", sqlQuery.Data())); if(aResult->GetRowCount() == 0) { -// if(sqlQuery.EndsWith("where shuttle_done=0 order by run")){ -// Log("SHUTTLE", "QueryShuttleLogbook - All runs in Shuttle Logbook are already DONE"); -// delete aResult; -// return kTRUE; -// } else { - AliInfo("No entries in Shuttle Logbook match request"); - delete aResult; - return kTRUE; -// } + AliInfo("No entries in Shuttle Logbook match request"); + delete aResult; + return kTRUE; } // TODO Check field count! @@ -1154,9 +1411,6 @@ Bool_t AliShuttle::QueryShuttleLogbook(const char* whereClause, delete aRow; } -// if(sqlQuery.EndsWith("where shuttle_done=0 order by run")) -// Log("SHUTTLE", Form("QueryShuttleLogbook - Found %d unprocessed runs in Shuttle Logbook", -// entries.GetEntriesFast())); delete aResult; return kTRUE; } @@ -1229,11 +1483,11 @@ AliShuttleLogbookEntry* AliShuttle::QueryRunParameters(Int_t run) 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 + // 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 AliDCSClient client(host, port, fTimeout, fRetries); if (!client.IsConnected()) @@ -1275,14 +1529,21 @@ Bool_t AliShuttle::GetValueSet(const char* host, Int_t port, const char* entry, const char* AliShuttle::GetFile(Int_t system, const char* detector, const char* id, const char* source) { -// Get calibration file from file exchange servers -// First queris the FXS database for the file name, using the run, detector, id and source info -// then calls RetrieveFile(filename) for actual copy to local disk -// run: current run being processed (given by Logbook entry fLogbookEntry) -// detector: the Preprocessor name -// id: provided as a parameter by the Preprocessor -// source: provided by the Preprocessor through GetFileSources function - + // Get calibration file from file exchange servers + // First queris the FXS database for the file name, using the run, detector, id and source info + // then calls RetrieveFile(filename) for actual copy to local disk + // run: current run being processed (given by Logbook entry fLogbookEntry) + // detector: the Preprocessor name + // id: provided as a parameter by the Preprocessor + // source: provided by the Preprocessor through GetFileSources function + + // check if test mode should simulate a FXS error + if (fTestMode & kErrorFXSFiles) + { + Log(detector, Form("GetFile - In TESTMODE - Simulating error while connecting to %s FXS", GetSystemName(system))); + return 0; + } + // check connection, in case connect if (!Connect(system)) { @@ -1432,7 +1693,9 @@ const char* AliShuttle::GetFile(Int_t system, const char* detector, //______________________________________________________________________________________________ Bool_t AliShuttle::RetrieveFile(UInt_t system, const char* fxsFileName, const char* localFileName) { -// Copies file from FXS to local Shuttle machine + // + // Copies file from FXS to local Shuttle machine + // // check temp directory: trying to cd to temp; if it does not exist, create it AliDebug(2, Form("Copy file %s from %s FXS into %s/%s", @@ -1483,13 +1746,22 @@ Bool_t AliShuttle::RetrieveFile(UInt_t system, const char* fxsFileName, const ch //______________________________________________________________________________________________ TList* AliShuttle::GetFileSources(Int_t system, const char* detector, const char* id) { -// Get sources producing the condition file Id from file exchange servers + // + // Get sources producing the condition file Id from file exchange servers + // + + // check if test mode should simulate a FXS error + if (fTestMode & kErrorFXSSources) + { + Log(detector, Form("GetFileSources - In TESTMODE - Simulating error while connecting to %s FXS", GetSystemName(system))); + return 0; + } + if (system == kDCS) { AliError("DCS system has only one source of data!"); return NULL; - } // check connection, in case connect @@ -1553,8 +1825,9 @@ TList* AliShuttle::GetFileSources(Int_t system, const char* detector, const char //______________________________________________________________________________________________ Bool_t AliShuttle::Connect(Int_t system) { -// Connect to MySQL Server of the system's FXS MySQL databases -// DAQ Logbook, Shuttle Logbook and DAQ FXS db are on the same host + // Connect to MySQL Server of the system's FXS MySQL databases + // DAQ Logbook, Shuttle Logbook and DAQ FXS db are on the same host + // // check connection: if already connected return if(fServer[system] && fServer[system]->IsConnected()) return kTRUE; @@ -1612,7 +1885,9 @@ Bool_t AliShuttle::Connect(Int_t system) //______________________________________________________________________________________________ Bool_t AliShuttle::UpdateTable() { -// Update FXS table filling time_processed field in all rows corresponding to current run and detector + // + // Update FXS table filling time_processed field in all rows corresponding to current run and detector + // Bool_t result = kTRUE; @@ -1692,9 +1967,9 @@ Bool_t AliShuttle::UpdateTable() //______________________________________________________________________________________________ Bool_t AliShuttle::UpdateTableFailCase() { -// Update FXS table filling time_processed field in all rows corresponding to current run and detector -// this is called in case the preprocessor is declared failed for the current run, because -// the fields are updated only in case of success + // Update FXS table filling time_processed field in all rows corresponding to current run and detector + // this is called in case the preprocessor is declared failed for the current run, because + // the fields are updated only in case of success Bool_t result = kTRUE; @@ -1800,7 +2075,9 @@ Bool_t AliShuttle::UpdateShuttleLogbook(const char* detector, const char* status //______________________________________________________________________________________________ Int_t AliShuttle::GetCurrentRun() const { -// Get current run from logbook entry + // + // Get current run from logbook entry + // return fLogbookEntry ? fLogbookEntry->GetRun() : -1; } @@ -1808,7 +2085,9 @@ Int_t AliShuttle::GetCurrentRun() const //______________________________________________________________________________________________ UInt_t AliShuttle::GetCurrentStartTime() const { -// get current start time + // + // get current start time + // return fLogbookEntry ? fLogbookEntry->GetStartTime() : 0; } @@ -1816,7 +2095,9 @@ UInt_t AliShuttle::GetCurrentStartTime() const //______________________________________________________________________________________________ UInt_t AliShuttle::GetCurrentEndTime() const { -// get current end time from logbook entry + // + // get current end time from logbook entry + // return fLogbookEntry ? fLogbookEntry->GetEndTime() : 0; } @@ -1824,7 +2105,9 @@ UInt_t AliShuttle::GetCurrentEndTime() const //______________________________________________________________________________________________ void AliShuttle::Log(const char* detector, const char* message) { -// Fill log string with a message + // + // Fill log string with a message + // void* dir = gSystem->OpenDirectory(GetShuttleLogDir()); if (dir == NULL) { @@ -1868,12 +2151,12 @@ void AliShuttle::Log(const char* detector, const char* message) //______________________________________________________________________________________________ Bool_t AliShuttle::Collect(Int_t run) { -// -// Collects conditions data for all UNPROCESSED run written to DAQ LogBook in case of run = -1 (default) -// If a dedicated run is given this run is processed -// -// In operational mode, this is the Shuttle function triggered by the EOR signal. -// + // + // Collects conditions data for all UNPROCESSED run written to DAQ LogBook in case of run = -1 (default) + // If a dedicated run is given this run is processed + // + // In operational mode, this is the Shuttle function triggered by the EOR signal. + // if (run == -1) Log("SHUTTLE","Collect - Shuttle called. Collecting conditions data for unprocessed runs"); @@ -1949,7 +2232,9 @@ Bool_t AliShuttle::Collect(Int_t run) //______________________________________________________________________________________________ Bool_t AliShuttle::RetrieveConditionsData(const TObjArray& dateEntries) { -// Retrieve conditions data for all runs that aren't processed yet + // + // Retrieve conditions data for all runs that aren't processed yet + // Bool_t hasError = kFALSE; @@ -1972,6 +2257,10 @@ Bool_t AliShuttle::RetrieveConditionsData(const TObjArray& dateEntries) //______________________________________________________________________________________________ ULong_t AliShuttle::GetTimeOfLastAction() const { + // + // Gets time of last action + // + ULong_t tmp; fMonitoringMutex->Lock(); @@ -1986,7 +2275,9 @@ ULong_t AliShuttle::GetTimeOfLastAction() const //______________________________________________________________________________________________ const TString AliShuttle::GetLastAction() const { + // // returns a string description of the last action + // TString tmp; @@ -2002,7 +2293,9 @@ const TString AliShuttle::GetLastAction() const //______________________________________________________________________________________________ void AliShuttle::SetLastAction(const char* action) { + // // updates the monitoring variables + // fMonitoringMutex->Lock(); @@ -2015,7 +2308,9 @@ void AliShuttle::SetLastAction(const char* action) //______________________________________________________________________________________________ const char* AliShuttle::GetRunParameter(const char* param) { -// returns run parameter read from DAQ logbook + // + // returns run parameter read from DAQ logbook + // if(!fLogbookEntry) { AliError("No logbook entry!"); @@ -2026,14 +2321,22 @@ const char* AliShuttle::GetRunParameter(const char* param) } //______________________________________________________________________________________________ -AliCDBEntry* AliShuttle::GetFromOCDB(const AliCDBPath& path) +AliCDBEntry* AliShuttle::GetFromOCDB(const char* detector, const AliCDBPath& path) { -// returns obiect from OCDB valid for current run + // + // returns object from OCDB valid for current run + // + if (fTestMode & kErrorOCDB) + { + Log(detector, "GetFromOCDB - In TESTMODE - Simulating error with OCDB"); + return 0; + } + AliCDBStorage *sto = AliCDBManager::Instance()->GetStorage(fgkMainCDB); if (!sto) { - Log("SHUTTLE", "GetFromOCDB - Cannot activate main OCDB for query!"); + Log(detector, "GetFromOCDB - Cannot activate main OCDB for query!"); return 0; } @@ -2043,7 +2346,12 @@ AliCDBEntry* AliShuttle::GetFromOCDB(const AliCDBPath& path) //______________________________________________________________________________________________ Bool_t AliShuttle::SendMail() { -// sends a mail to the subdetector expert in case of preprocessor error + // + // sends a mail to the subdetector expert in case of preprocessor error + // + + if (fTestMode != kNone) + return kTRUE; void* dir = gSystem->OpenDirectory(GetShuttleLogDir()); if (dir == NULL) @@ -2137,61 +2445,26 @@ Bool_t AliShuttle::SendMail() } //______________________________________________________________________________________________ -void AliShuttle::SetRunType() +const char* AliShuttle::GetRunType() { -// Gets run type from logbook and fills current Shuttle logbook entry - - // check connection, in case connect - if(!Connect(3)){ - Log("SHUTTLE", "SetRunType - Couldn't connect to DAQ Logbook."); - return; - } - - TString sqlQuery = Form("select detector,run_type from %s where run_number=%d", - fConfig->GetRunTypelbTable(), GetCurrentRun()); - - AliDebug(2, Form("SQL query: \n%s",sqlQuery.Data())); - - // Query execution - TSQLResult* aResult; - aResult = dynamic_cast (fServer[3]->Query(sqlQuery)); - if (!aResult) { - Log("SHUTTLE", Form("SetRunType - Can't execute query <%s>", sqlQuery.Data())); - return; - } - - TSQLRow* aRow; - while ((aRow = aResult->Next())) { - TString det(aRow->GetField(0), aRow->GetFieldLength(0)); - TString runType(aRow->GetField(1), aRow->GetFieldLength(1)); - - fLogbookEntry->SetRunType(det, runType); - delete aRow; - } - - delete aResult; - - return; - -} - -//______________________________________________________________________________________________ -const char* AliShuttle::GetRunType(const char* detCode) -{ -// returns run type read from "run type" logbook + // + // returns run type read from "run type" logbook + // if(!fLogbookEntry) { AliError("No logbook entry!"); return 0; } - return fLogbookEntry->GetRunType(detCode); + return fLogbookEntry->GetRunType(); } //______________________________________________________________________________________________ void AliShuttle::SetShuttleTempDir(const char* tmpDir) { -// sets Shuttle temp directory + // + // sets Shuttle temp directory + // fgkShuttleTempDir = gSystem->ExpandPathName(tmpDir); } @@ -2199,7 +2472,9 @@ void AliShuttle::SetShuttleTempDir(const char* tmpDir) //______________________________________________________________________________________________ void AliShuttle::SetShuttleLogDir(const char* logDir) { -// sets Shuttle log directory + // + // sets Shuttle log directory + // fgkShuttleLogDir = gSystem->ExpandPathName(logDir); } diff --git a/SHUTTLE/AliShuttle.h b/SHUTTLE/AliShuttle.h index 4d7126d34d0..30a0edf3864 100644 --- a/SHUTTLE/AliShuttle.h +++ b/SHUTTLE/AliShuttle.h @@ -32,7 +32,7 @@ class TMonaLisaWriter; class AliShuttle: public AliShuttleInterface { public: enum DCSType {kAlias=0, kDP}; - enum returnCodes {kDCSErrCode=20051975, kStorErrCode=20051976}; + enum TestMode { kNone = 0, kSkipDCS = 1, kErrorDCS = 2, kErrorFXSSources = 4, kErrorFXSFiles = 8, kErrorOCDB = 16, kErrorStorage = 32, kErrorGrid = 64 }; AliShuttle(const AliShuttleConfig* config, UInt_t timeout = 5000, Int_t retries = 5); virtual ~AliShuttle(); @@ -54,17 +54,19 @@ public: virtual Bool_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE); virtual Bool_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData); + virtual Bool_t StoreReferenceFile(const char* detector, const char* localFile, const char* gridFileName); 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* lbEntry); - virtual AliCDBEntry* GetFromOCDB(const AliCDBPath& path); - virtual const char* GetRunType(const char* detCode); + virtual AliCDBEntry* GetFromOCDB(const char* detector, const AliCDBPath& path); + virtual const char* GetRunType(); virtual void Log(const char* detector, const char* message); - //TODO Test only, remove later ! - void SetProcessDCS(Bool_t process) {fgkProcessDCS = process;} void SetLogbookEntry(AliShuttleLogbookEntry* entry) {fLogbookEntry=entry;} + + void SetTestMode(TestMode testMode) { fTestMode = testMode; } + void SetReadTestModeFromLog(Bool_t flag) { fReadTestMode = flag; } Bool_t Connect(Int_t system); @@ -81,7 +83,7 @@ private: AliShuttle(const AliShuttle& other); AliShuttle& operator= (const AliShuttle& other); - UInt_t ProcessCurrentDetector(); + Bool_t ProcessCurrentDetector(); AliShuttleLogbookEntry* QueryRunParameters(Int_t run); Bool_t QueryShuttleLogbook(const char* whereClause, TObjArray& entries); @@ -100,6 +102,7 @@ private: Bool_t StoreOCDB(); Bool_t StoreOCDB(const TString& uri); + Bool_t StoreRefFilesToGrid(); void CleanLocalStorage(const TString& uri); void RemoveFile(const char* filename); @@ -114,8 +117,6 @@ private: void SendMLInfo(); - void SetRunType(); - const AliShuttleConfig* fConfig; // pointer to configuration object UInt_t fTimeout; // DCS server connection timeout parameter @@ -140,8 +141,8 @@ private: TMonaLisaWriter* fMonaLisa; // ML instance that sends the processing information - //TODO Test only, remove later ! - static Bool_t fgkProcessDCS; // flag to enable DCS archive data processing + TestMode fTestMode; // sets test mode flags, that e.g. simulate a dcs error etc. + Bool_t fReadTestMode; // Reads the test mode from the log entry of the given run (only for test) ClassDef(AliShuttle, 0); }; diff --git a/SHUTTLE/AliShuttleConfig.cxx b/SHUTTLE/AliShuttleConfig.cxx index dccd4b60036..335ecd1cd66 100644 --- a/SHUTTLE/AliShuttleConfig.cxx +++ b/SHUTTLE/AliShuttleConfig.cxx @@ -15,6 +15,11 @@ /* $Log$ +Revision 1.19 2007/02/28 10:41:56 acolla +Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by +AliPreprocessor::GetRunType() function. +Added some ldap definition files. + Revision 1.18 2007/01/23 19:20:03 acolla Removed old ldif files, added TOF, MCH ldif files. Added some options in AliShuttleConfig::Print. Added in Ali Shuttle: SetShuttleTempDir and @@ -315,7 +320,7 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port, fIsValid(kFALSE), fConfigHost(host), fDAQlbHost(""), fDAQlbPort(), fDAQlbUser(""), fDAQlbPass(""), fDAQlbDB(""), fDAQlbTable(""), fShuttlelbTable(""), fRunTypelbTable(""), - fMaxRetries(0), fPPTimeOut(0), fDetectorMap(), fDetectorList(), + fMaxRetries(0), fPPTimeOut(0), fPPMaxMem(0), fDetectorMap(), fDetectorList(), fShuttleInstanceHost(""), fProcessedDetectors(), fProcessAll(kFALSE) { // @@ -514,6 +519,15 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port, tmpStr = anAttribute->GetValue(); fPPTimeOut = tmpStr.Atoi(); + anAttribute = anEntry->GetAttribute("PPMaxMem"); + if (!anAttribute) { + AliError("Can't find PPMaxMem attribute!"); + delete aResult; delete anEntry; + return; + } + tmpStr = anAttribute->GetValue(); + fPPMaxMem = tmpStr.Atoi(); + delete aResult; delete anEntry; // FXS configuration (FXS logbook and hosts) @@ -801,7 +815,7 @@ void AliShuttleConfig::Print(Option_t* option) const result += "\n"; } - result += Form("PP time out = %d - Max total retries = %d\n\n", fPPTimeOut, fMaxRetries); + result += Form("PP time out = %d - Max PP memsize = %d KB - Max total retries = %d\n\n", fPPTimeOut, fPPMaxMem, fMaxRetries); result += "------------------------------------------------------\n"; result += Form("Logbook Configuration \n\n \tHost: %s:%d; \tUser: %s; ", diff --git a/SHUTTLE/AliShuttleConfig.h b/SHUTTLE/AliShuttleConfig.h index eaa0afc04fc..5b3a4794d5f 100644 --- a/SHUTTLE/AliShuttleConfig.h +++ b/SHUTTLE/AliShuttleConfig.h @@ -53,6 +53,7 @@ public: Int_t GetMaxRetries() const { return fMaxRetries; } Int_t GetPPTimeOut() const { return fPPTimeOut; } + Int_t GetPPMaxMem() const { return fPPMaxMem; } const TObjArray* GetDetectors() const; @@ -140,7 +141,8 @@ private: Int_t fMaxRetries; // number of retries of a failed preprocessor - Int_t fPPTimeOut; // timeout until a preprocessor is canceled + Int_t fPPTimeOut; // timeout until a preprocessor is killed + Int_t fPPMaxMem; // maximum allowed memory until a preprocessor is killed TMap fDetectorMap; //! Map of the detector-by-detector configuration TObjArray fDetectorList; //! List of detectors with valid configuration diff --git a/SHUTTLE/AliShuttleLogbookEntry.cxx b/SHUTTLE/AliShuttleLogbookEntry.cxx index 0ae9d03bade..62224954869 100644 --- a/SHUTTLE/AliShuttleLogbookEntry.cxx +++ b/SHUTTLE/AliShuttleLogbookEntry.cxx @@ -33,14 +33,12 @@ TObject(), fRun(-1), fRunParameters(0) { - // default constructor + // + // default constructor + // const UInt_t nDet = AliShuttleInterface::NDetectors(); memset(fDetectorStatus, kUnprocessed, nDet*sizeof(Status)); - for (UInt_t i=0;i(aPair->Value()); fRunParameters.Add(aKey->Clone(), aValue->Clone()); } - - for (UInt_t i=0;i= (Int_t) AliShuttleInterface::NDetectors()) { AliError(Form("Invalid parameter: %d", detPos)); @@ -141,7 +138,9 @@ AliShuttleLogbookEntry::Status AliShuttleLogbookEntry::GetDetectorStatus(Int_t d //______________________________________________________________________________________________ void AliShuttleLogbookEntry::SetDetectorStatus(const char* detName, Status status) { -// set detector status from detector code + // + // set detector status from detector code + // Int_t detPos = AliShuttleInterface::GetDetPos(detName); if(detPos<0) return; @@ -151,7 +150,9 @@ void AliShuttleLogbookEntry::SetDetectorStatus(const char* detName, Status statu //______________________________________________________________________________________________ void AliShuttleLogbookEntry::SetDetectorStatus(const char* detName, const char* statusName) { -// set detector status from detector code + // + // set detector status from detector code + // Int_t detPos = AliShuttleInterface::GetDetPos(detName); if(detPos<0) return; @@ -161,7 +162,9 @@ void AliShuttleLogbookEntry::SetDetectorStatus(const char* detName, const char* //______________________________________________________________________________________________ void AliShuttleLogbookEntry::SetDetectorStatus(Status* status) { -// set detector status from detector code + // + // set detector status from detector code + // for(UInt_t i=0; i < AliShuttleInterface::NDetectors(); i++){ fDetectorStatus[i] = status[i]; @@ -171,7 +174,9 @@ void AliShuttleLogbookEntry::SetDetectorStatus(Status* status) //______________________________________________________________________________________________ void AliShuttleLogbookEntry::SetDetectorStatus(UInt_t detPos, Status status) { -// set detector status from detector code + // + // set detector status from detector code + // if(detPos >= AliShuttleInterface::NDetectors()) { AliError(Form("Shuttle has only %d subdetectors!", AliShuttleInterface::NDetectors())); @@ -183,7 +188,9 @@ void AliShuttleLogbookEntry::SetDetectorStatus(UInt_t detPos, Status status) //______________________________________________________________________________________________ void AliShuttleLogbookEntry::SetDetectorStatus(UInt_t detPos, const char* statusName) { -// set detector status from detector code + // + // set detector status from detector code + // if(detPos >= AliShuttleInterface::NDetectors()) { AliError(Form("Shuttle has only %d subdetectors!", AliShuttleInterface::NDetectors())); @@ -203,55 +210,11 @@ void AliShuttleLogbookEntry::SetDetectorStatus(UInt_t detPos, const char* status } } - - -//______________________________________________________________________________________________ -const char* AliShuttleLogbookEntry::GetRunType(Int_t detPos) const -{ -// get detector status from detector code - - if(detPos < 0 || detPos >= (Int_t) AliShuttleInterface::NDetectors()) { - AliError(Form("Invalid parameter: %d", detPos)); - return 0; - } - return (fRunType[detPos].Length() > 0) ? fRunType[detPos].Data() : 0; -} - -//______________________________________________________________________________________________ -void AliShuttleLogbookEntry::SetRunType(const char* detName, const char* runType) -{ -// set detector status from detector code - - Int_t detPos = AliShuttleInterface::GetDetPos(detName); - if(detPos<0) return; - SetRunType(detPos, runType); -} - -//______________________________________________________________________________________________ -void AliShuttleLogbookEntry::SetRunType(const TString* runType) -{ -// set detector status from detector code - - for (UInt_t i=0; i < AliShuttleInterface::NDetectors(); i++) { - fRunType[i] = runType[i]; - } -} - -//______________________________________________________________________________________________ -void AliShuttleLogbookEntry::SetRunType(UInt_t detPos, const char* runType) -{ -// set detector status from detector code - - if(detPos >= AliShuttleInterface::NDetectors()) { - AliError(Form("Shuttle has only %d subdetectors!", AliShuttleInterface::NDetectors())); - return; - } - fRunType[detPos] = runType; -} - //______________________________________________________________________________________________ Bool_t AliShuttleLogbookEntry::IsDone() const{ -// return TRUE if all subdetectors are in status DONE, FAILED or INACTIVE + // + // return TRUE if all subdetectors are in status DONE, FAILED or INACTIVE + // for(UInt_t i=0; i < AliShuttleInterface::NDetectors(); i++){ if(fDetectorStatus[i] == kUnprocessed) return kFALSE; @@ -262,7 +225,9 @@ Bool_t AliShuttleLogbookEntry::IsDone() const{ //______________________________________________________________________________________________ const char* AliShuttleLogbookEntry::GetDetectorStatusName(Status status) { - // returns a name (string) of the detector status + // + // returns a name (string) of the detector status + // switch (status){ case kUnprocessed: return "UNPROCESSED"; @@ -277,7 +242,9 @@ const char* AliShuttleLogbookEntry::GetDetectorStatusName(Status status) //______________________________________________________________________________________________ void AliShuttleLogbookEntry::Print(Option_t* option) const { - // print current shuttle logbook entry + // + // print current shuttle logbook entry + // TString message = "\n*** Run parameters ***\n"; TTimeStamp startTimeStamp(GetStartTime()); @@ -289,14 +256,8 @@ void AliShuttleLogbookEntry::Print(Option_t* option) const for (UInt_t i=0; i < AliShuttleInterface::NDetectors(); i++) { - message += Form("\t%2d - %s: %s ", i, AliShuttleInterface::GetDetName(i), + message += Form("\t%2d - %s: %s \n", i, AliShuttleInterface::GetDetName(i), GetDetectorStatusName(fDetectorStatus[i])); - if (fDetectorStatus[i] == kUnprocessed && fRunType[i].Length()>0) - { - message += Form("\t Run type: %s \n", GetRunType(i)); - } else { - message += "\n"; - } } AliInfo(Form("option: %s",option)); @@ -324,7 +285,9 @@ void AliShuttleLogbookEntry::Print(Option_t* option) const } //______________________________________________________________________________________________ void AliShuttleLogbookEntry::SetRunParameter(const char* key, const char* value){ -// set a run parameter (read from the DAQ logbook) + // + // set a run parameter (read from the DAQ logbook) + // TObjString* keyObj = new TObjString(key); if (fRunParameters.Contains(key)) { @@ -337,7 +300,9 @@ void AliShuttleLogbookEntry::SetRunParameter(const char* key, const char* value) } //______________________________________________________________________________________________ const char* AliShuttleLogbookEntry::GetRunParameter(const char* key) const{ -// get a run parameter + // + // get a run parameter + // TObjString* value = dynamic_cast (fRunParameters.GetValue(key)); if(!value) { diff --git a/SHUTTLE/AliShuttleLogbookEntry.h b/SHUTTLE/AliShuttleLogbookEntry.h index 512ae274a93..737291dfb70 100644 --- a/SHUTTLE/AliShuttleLogbookEntry.h +++ b/SHUTTLE/AliShuttleLogbookEntry.h @@ -55,15 +55,7 @@ public: void SetDetectorStatus(const char* detCode, const char* statusName); void SetDetectorStatus(UInt_t detPos, const char* statusName); - const char* GetRunType(const char* detCode) const - {return GetRunType(AliShuttleInterface::GetDetPos(detCode));} - const char* GetRunType(Int_t detPos) const; - TString* GetRunType() const {return (TString*) fRunType;} - - void SetRunType(const char* detCode, const char* runType); - void SetRunType(UInt_t detPos, const char* runType); - void SetRunType(const TString* runType); - + const char* GetRunType() const { return GetRunParameter("run_type"); } Bool_t IsDone() const; @@ -75,7 +67,6 @@ private: Int_t fRun; // Run number TMap fRunParameters; // run parameters written in DAQ logbook Status fDetectorStatus[AliShuttleInterface::kNDetectors]; // Detector status array - TString fRunType[AliShuttleInterface::kNDetectors]; // Run type array ClassDef(AliShuttleLogbookEntry, 0) }; diff --git a/SHUTTLE/DATENotifier.cxx b/SHUTTLE/DATENotifier.cxx index cce88235d9f..475cc8f48a1 100644 --- a/SHUTTLE/DATENotifier.cxx +++ b/SHUTTLE/DATENotifier.cxx @@ -23,10 +23,3 @@ void DATENotifier::errorHandler(int severity, int code, char *msg) Form("DIM Error: severity<%d>, code<%d> , message<%s>", severity, code, msg)); } - -//______________________________________________________________________ -DATENotifier::DATENotifier(const DATENotifier& /*other*/): -DimInfo(), fTrigger(0) { -// copy constructor (not implemented) - -} diff --git a/SHUTTLE/Shuttle.C b/SHUTTLE/Shuttle.C index f8ec03fcf4e..d9285d75747 100644 --- a/SHUTTLE/Shuttle.C +++ b/SHUTTLE/Shuttle.C @@ -12,6 +12,16 @@ Bool_t Shuttle(const char* param = "listen", const char* dets=0) { // gSystem->Load("$ALICE_ROOT/SHUTTLE/test/libTest.so"); AliLog::SetGlobalDebugLevel(2); + + const char* pwd = gSystem->pwd(); + + if( !gSystem->Getenv("SHUTTLE_DIR")) + { + printf("Setting base SHUTTLE folder to %s\n", pwd); + gSystem->Setenv("SHUTTLE_DIR", pwd); + } else { + printf("Shuttle base folder is %s\n", gSystem->Getenv("SHUTTLE_DIR")); + } // Setting local CDB and reference storage locations AliShuttle::SetMainCDB("alien://user=aliprod?folder=testShuttle/OCDB"); diff --git a/SHUTTLE/TestShuttle/AliTestPreprocessor.cxx b/SHUTTLE/TestShuttle/AliTestPreprocessor.cxx index 162fbba582a..476dd257daf 100644 --- a/SHUTTLE/TestShuttle/AliTestPreprocessor.cxx +++ b/SHUTTLE/TestShuttle/AliTestPreprocessor.cxx @@ -8,6 +8,7 @@ #include #include +#include // // This class is an example for a simple preprocessor. @@ -39,20 +40,35 @@ void AliTestPreprocessor::Initialize(Int_t run, UInt_t startTime, AliPreprocessor::Initialize(run, startTime, endTime); - AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, + Log(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString())); fData = new AliTestDataDCS(fRun, fStartTime, fEndTime); } +//______________________________________________________________________________________________ +Bool_t AliTestPreprocessor::ProcessDCS() +{ + // + // decide here if DCS data is to be processed + // + + // TODO implement a decision, e.g. based on the run type + // In this example: Skip DCS if run type is CALIB + if (strcmp(GetRunType(), "CALIB") == 0) + return kFALSE; + + return kTRUE; +} + //______________________________________________________________________________________________ UInt_t AliTestPreprocessor::Process(TMap* dcsAliasMap) { // Fills data into a AliTestDataDCS object if (!dcsAliasMap) - return 0; + return 1; // The processing of the DCS input data is forwarded to AliTestDataDCS fData->ProcessData(*dcsAliasMap); @@ -61,17 +77,21 @@ UInt_t AliTestPreprocessor::Process(TMap* dcsAliasMap) // TODO Here the run type for the "DET" detector must be set manually with SetInputRunType function, // in reality it will be read from the "run type" logbook! TString runType = GetRunType(); - AliInfo(Form("Run type for run %d: %s", fRun, runType.Data())); + Log(Form("Run type for run %d: %s", fRun, runType.Data())); TString fileName = GetFile(kDAQ, "PEDESTALS", "GDC"); if (fileName.Length() > 0) - AliInfo(Form("Got the file %s, now we can extract some values.", fileName.Data())); + Log(Form("Got the file %s, now we can extract some values.", fileName.Data())); //TODO here the file could be opened, some values extracted and written to e.g. fData + //Example to store a file directly to the reference storage + if (!StoreReferenceFile(fileName, "InputData.root")) + return 1; + TList* list = GetFileSources(kDAQ, "DRIFTVELOCITY"); if (list) { - AliInfo("The following sources produced files with the id DRIFTVELOCITY"); + Log("The following sources produced files with the id DRIFTVELOCITY"); list->Print(); delete list; } @@ -107,10 +127,13 @@ UInt_t AliTestPreprocessor::Process(TMap* dcsAliasMap) metaData.SetResponsible("TPC expert"); metaData.SetComment("This preprocessor fills an AliTestDataDCS object."); - UInt_t result = Store("Calib", "Data", fData, &metaData, 0, 0); + Bool_t result = Store("Calib", "Data", fData, &metaData, 0, 0); delete fData; fData = 0; - return result; + if (!result) + return 1; + + return 0; } diff --git a/SHUTTLE/TestShuttle/AliTestPreprocessor.h b/SHUTTLE/TestShuttle/AliTestPreprocessor.h index 9e701a41e3f..94efcc3c171 100644 --- a/SHUTTLE/TestShuttle/AliTestPreprocessor.h +++ b/SHUTTLE/TestShuttle/AliTestPreprocessor.h @@ -16,6 +16,7 @@ class AliTestPreprocessor : public AliPreprocessor protected: virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime); virtual UInt_t Process(TMap* dcsAliasMap); + virtual Bool_t ProcessDCS(); private: AliTestDataDCS *fData; // CDB class that stores the data diff --git a/SHUTTLE/TestShuttle/AliTestShuttle.cxx b/SHUTTLE/TestShuttle/AliTestShuttle.cxx index 1459bb3ee43..9ce785149d9 100644 --- a/SHUTTLE/TestShuttle/AliTestShuttle.cxx +++ b/SHUTTLE/TestShuttle/AliTestShuttle.cxx @@ -15,6 +15,11 @@ /* $Log$ +Revision 1.10 2007/02/28 10:41:01 acolla +Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by +AliPreprocessor::GetRunType() function. +Added some ldap definition files. + 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 @@ -98,7 +103,7 @@ AliTestShuttle::AliTestShuttle(Int_t run, UInt_t startTime, UInt_t endTime) : fEndTime(endTime), fInputFiles(0), fRunParameters(0), - fRunTypeMap(0), + fRunType(), fPreprocessors(0), fDcsAliasMap(0) { @@ -106,12 +111,10 @@ AliTestShuttle::AliTestShuttle(Int_t run, UInt_t startTime, UInt_t endTime) : fInputFiles = new TMap; fRunParameters = new TMap; - fRunTypeMap = new TMap; fPreprocessors = new TObjArray; fInputFiles->SetOwner(1); fRunParameters->SetOwner(1); - fRunTypeMap->SetOwner(1); fPreprocessors->SetOwner(1); } @@ -126,9 +129,6 @@ AliTestShuttle::~AliTestShuttle() delete fRunParameters; fRunParameters = 0; - delete fRunTypeMap; - fRunTypeMap = 0; - delete fPreprocessors; fPreprocessors = 0; @@ -137,7 +137,7 @@ AliTestShuttle::~AliTestShuttle() } //______________________________________________________________________________________________ -UInt_t AliTestShuttle::Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, +Bool_t AliTestShuttle::Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite) { // Stores the CDB object @@ -165,7 +165,7 @@ UInt_t AliTestShuttle::Store(const AliCDBPath& path, TObject* object, AliCDBMeta } //______________________________________________________________________________________________ -UInt_t AliTestShuttle::StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData) +Bool_t AliTestShuttle::StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData) { // Stores the object as reference data // This function should be called at the end of the preprocessor cycle @@ -178,6 +178,51 @@ UInt_t AliTestShuttle::StoreReferenceData(const AliCDBPath& path, TObject* objec return AliCDBManager::Instance()->GetStorage(fgkMainRefStorage)->Put(object, id, metaData); } +//______________________________________________________________________________________________ +Bool_t AliTestShuttle::StoreReferenceFile(const char* detector, const char* localFile, const char* gridFileName) +{ + // + // Stores reference file directly (without opening it). + // + // This implementation just stores it on the local disk, the full AliShuttle + // puts it to the Grid FileCatalog + + AliCDBManager* man = AliCDBManager::Instance(); + AliCDBStorage* sto = man->GetStorage(fgkMainRefStorage); + + TString localBaseFolder = sto->GetBaseFolder(); + + TString targetDir; + targetDir.Form("%s/%s", localBaseFolder.Data(), detector); + + TString target; + target.Form("%s/%d_%s", targetDir.Data(), fRun, gridFileName); + + Int_t result = gSystem->GetPathInfo(targetDir, 0, (Long64_t*) 0, 0, 0); + if (result) + { + result = gSystem->mkdir(targetDir, kTRUE); + if (result != 0) + { + Log("SHUTTLE", Form("StoreReferenceFile - Error creating base directory %s", targetDir.Data())); + return kFALSE; + } + } + + result = gSystem->CopyFile(localFile, target); + + if (result == 0) + { + Log("SHUTTLE", Form("StoreReferenceFile - Stored file %s locally to %s", localFile, target.Data())); + return kTRUE; + } + else + { + Log("SHUTTLE", Form("StoreReferenceFile - Storing file %s locally to %s failed with %d", localFile, target.Data(), result)); + return kFALSE; + } +} + //______________________________________________________________________________________________ const char* AliTestShuttle::GetFile(Int_t system, const char* detector, const char* id, const char* source) { @@ -292,7 +337,7 @@ Bool_t AliTestShuttle::AddInputCDBEntry(AliCDBEntry* entry) } //______________________________________________________________________________________________ -AliCDBEntry* AliTestShuttle::GetFromOCDB(const AliCDBPath& path) +AliCDBEntry* AliTestShuttle::GetFromOCDB(const char* detector, const AliCDBPath& path) { // returns obiect from OCDB valid for current run @@ -353,37 +398,13 @@ void AliTestShuttle::AddInputRunParameter(const char* key, const char* value){ } //______________________________________________________________________________________________ -void AliTestShuttle::AddInputRunType(const char* detCode, const char* runType){ -// set a run type (in reality it will be read from the "run type" logbook) - - if (strcmp("DET", detCode) != 0) - { - if (GetDetPos(detCode) < 0) - { - AliError(Form("Invalid detector name: %s", detCode)); - return; - } - } - TObjString* detObj = new TObjString(detCode); - if (fRunTypeMap->Contains(detCode)) { - AliWarning(Form("Detector %s already inserted: it will be replaced.", detCode)); - delete fRunTypeMap->Remove(detObj); - - } - fRunTypeMap->Add(detObj, new TObjString(runType)); - AliDebug(2, Form("Number of detectors: %d", fRunTypeMap->GetEntries())); -} - -//______________________________________________________________________________________________ -const char* AliTestShuttle::GetRunType(const char* detCode){ -// get a run parameter +const char* AliTestShuttle::GetRunType() +{ + // + // get a run parameter + // - TObjString* value = dynamic_cast (fRunTypeMap->GetValue(detCode)); - if(!value) { - AliError(Form("Input run type not set for detector %s!", detCode)); - return 0; - } - return value->GetName(); + return fRunType; } //______________________________________________________________________________________________ diff --git a/SHUTTLE/TestShuttle/AliTestShuttle.h b/SHUTTLE/TestShuttle/AliTestShuttle.h index db6adba1f73..765e3f33bc5 100644 --- a/SHUTTLE/TestShuttle/AliTestShuttle.h +++ b/SHUTTLE/TestShuttle/AliTestShuttle.h @@ -28,20 +28,21 @@ 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); - void AddInputRunType(const char* detCode, const char* runType); + void SetInputRunType(const char* runType) { fRunType = runType; } Bool_t AddInputCDBEntry(AliCDBEntry* entry); void Process(); // AliShuttleInterface functions - virtual UInt_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, + virtual Bool_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE); - virtual UInt_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData); + virtual Bool_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData); + virtual Bool_t StoreReferenceFile(const char* detector, const char* localFile, const char* gridFileName); 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 const char* GetRunType(const char* detCode); + virtual AliCDBEntry* GetFromOCDB(const char* detector, const AliCDBPath& path); + virtual const char* GetRunType(); virtual void Log(const char* detector, const char* message); virtual void RegisterPreprocessor(AliPreprocessor* preprocessor); @@ -63,7 +64,7 @@ class AliTestShuttle : public AliShuttleInterface TMap* fInputFiles; // files for GetFile, GetFileSources TMap* fRunParameters; // run parameters - TMap* fRunTypeMap; // run type + TString fRunType; // run type TObjArray* fPreprocessors; // list of preprocessors that are to be tested TMap* fDcsAliasMap; // DCS data for testing diff --git a/SHUTTLE/TestShuttle/TestPreprocessor.C b/SHUTTLE/TestShuttle/TestPreprocessor.C index 35384609f72..4b005c7a51c 100644 --- a/SHUTTLE/TestShuttle/TestPreprocessor.C +++ b/SHUTTLE/TestShuttle/TestPreprocessor.C @@ -70,11 +70,10 @@ void TestPreprocessor() // TODO(3) // - // The shuttle can read run type for each detector stored in the "run type" logbook. + // The shuttle can read run type stored in the DAQ logbook. // To test it, we must provide the run type manually. They will be retrieved in the preprocessor // using GetRunType function. - shuttle->AddInputRunType("TPC", "PHYSICS"); - shuttle->AddInputRunType("PHS", "PEDESTALS"); + shuttle->SetInputRunType("PHYSICS"); // TODO(4) // diff --git a/SHUTTLE/TestShuttle/file1.root b/SHUTTLE/TestShuttle/file1.root new file mode 100644 index 0000000000000000000000000000000000000000..6860a7d8a33ae1e81d2c27ae3f7019f3552f8950 GIT binary patch literal 318 zcmXTQ&o5zMIBCGZz>vbgz-R}=96+`i5HkX?1q+k`q`)jK=Z>NeV!{oK*H?9Q?t2dr zCQOzvfDH05GetValue("LHCState"); if(!aliasLHCState) { Log(Form("LHCState not found!!!")); - return 0; + return 1; } AliGRPDCS *dcs1 = new AliGRPDCS(aliasLHCState,iStartTime,iStopTime); TString sLHCState = dcs1->ProcessDCS(3); @@ -102,7 +102,7 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap) { TObjArray *aliasLHCPeriod = (TObjArray *)valueMap->GetValue("LHCPeriod"); if(!aliasLHCPeriod) { Log(Form("LHCPeriod not found!!!")); - return 0; + return 1; } AliGRPDCS *dcs2 = new AliGRPDCS(aliasLHCPeriod,iStartTime,iStopTime); TString sLHCPeriod = dcs2->ProcessDCS(3); @@ -115,7 +115,7 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap) { TObjArray *aliasLHCLuminosity = (TObjArray *)valueMap->GetValue("LHCLuminosity"); if(!aliasLHCLuminosity) { Log(Form("LHCLuminosity not found!!!")); - return 0; + return 1; } AliGRPDCS *dcs3 = new AliGRPDCS(aliasLHCLuminosity,iStartTime,iStopTime); TString sMeanLHCLuminosity = dcs3->ProcessDCS(2); @@ -128,7 +128,7 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap) { TObjArray *aliasBeamIntensity = (TObjArray *)valueMap->GetValue("BeamIntensity"); if(!aliasBeamIntensity) { Log(Form("BeamIntensity not found!!!")); - return 0; + return 1; } AliGRPDCS *dcs4 = new AliGRPDCS(aliasBeamIntensity,iStartTime,iStopTime); TString sMeanBeamIntensity = dcs4->ProcessDCS(2); @@ -141,7 +141,7 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap) { TObjArray *aliasL3Current = (TObjArray *)valueMap->GetValue("L3Current"); if(!aliasL3Current) { Log(Form("L3Current not found!!!")); - return 0; + return 1; } AliGRPDCS *dcs5 = new AliGRPDCS(aliasL3Current,iStartTime,iStopTime); TString sMeanL3Current = dcs5->ProcessDCS(2); @@ -154,7 +154,7 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap) { TObjArray *aliasL3Polarity = (TObjArray *)valueMap->GetValue("L3Polarity"); if(!aliasL3Polarity) { Log(Form("L3Polarity not found!!!")); - return 0; + return 1; } AliGRPDCS *dcs6 = new AliGRPDCS(aliasL3Polarity,iStartTime,iStopTime); TString sL3Polarity = dcs6->ProcessDCS(4); @@ -167,7 +167,7 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap) { TObjArray *aliasDipoleCurrent = (TObjArray *)valueMap->GetValue("DipoleCurrent"); if(!aliasDipoleCurrent) { Log(Form("DipoleCurrent not found!!!")); - return 0; + return 1; } AliGRPDCS *dcs7 = new AliGRPDCS(aliasDipoleCurrent,iStartTime,iStopTime); TString sMeanDipoleCurrent = dcs7->ProcessDCS(2); @@ -180,7 +180,7 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap) { TObjArray *aliasDipolePolarity = (TObjArray *)valueMap->GetValue("DipolePolarity"); if(!aliasDipolePolarity) { Log(Form("DipolePolarity not found!!!")); - return 0; + return 1; } AliGRPDCS *dcs8 = new AliGRPDCS(aliasDipolePolarity,iStartTime,iStopTime); TString sDipolePolarity = dcs8->ProcessDCS(4); @@ -193,7 +193,7 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap) { TObjArray *aliasCavernTemperature = (TObjArray *)valueMap->GetValue("CavernTemperature"); if(!aliasCavernTemperature) { Log(Form("CavernTemperature not found!!!")); - return 0; + return 1; } AliGRPDCS *dcs9 = new AliGRPDCS(aliasCavernTemperature,iStartTime,iStopTime); TString sMeanCavernTemperature = dcs9->ProcessDCS(2); @@ -206,7 +206,7 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap) { TObjArray *aliasCavernPressure = (TObjArray *)valueMap->GetValue("CavernPressure"); if(!aliasCavernPressure) { Log(Form("CavernPressure not found!!!")); - return 0; + return 1; } AliGRPDCS *dcs10 = new AliGRPDCS(aliasCavernPressure,iStartTime,iStopTime); TString sMeanCavernPressure = dcs10->ProcessDCS(2); @@ -331,11 +331,13 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap) { AliCDBMetaData md; md.SetResponsible("Panos"); - Int_t result=0; - result = Store("GRP", "Values", values, &md); + Bool_t result = Store("GRP", "Values", values, &md); delete values; - return result; + if (result) + return 0; + else + return 1; } diff --git a/STEER/AliPreprocessor.cxx b/STEER/AliPreprocessor.cxx index 6ee2c8a884f..a07c20e7547 100644 --- a/STEER/AliPreprocessor.cxx +++ b/STEER/AliPreprocessor.cxx @@ -193,6 +193,17 @@ Bool_t AliPreprocessor::StoreReferenceData(const char* pathLevel2, const char* p return fShuttle->StoreReferenceData(AliCDBPath(offlineDetName, pathLevel2, pathLevel3), object, metaData); } + +//______________________________________________________________________________________________ +Bool_t AliPreprocessor::StoreReferenceFile(const char* localFile, const char* gridFileName) +{ + // + // Stores a file directly (without opening it) in the reference storage in the Grid + // + // The call is delegated to AliShuttleInterface + + return fShuttle->StoreReferenceFile(GetName(), localFile, gridFileName); +} //______________________________________________________________________________________________ const char* AliPreprocessor::GetFile(Int_t system, const char* id, const char* source) @@ -247,7 +258,7 @@ AliCDBEntry* AliPreprocessor::GetFromOCDB(const char* pathLevel2, const char* pa if (!offlineDetName) return 0; return dynamic_cast - (fShuttle->GetFromOCDB(AliCDBPath(offlineDetName, pathLevel2, pathLevel3))); + (fShuttle->GetFromOCDB(GetName(), AliCDBPath(offlineDetName, pathLevel2, pathLevel3))); } //______________________________________________________________________________________________ @@ -257,5 +268,5 @@ const char* AliPreprocessor::GetRunType() // // The call is delegated to AliShuttleInterface - return fShuttle->GetRunType(GetName()); + return fShuttle->GetRunType(); } diff --git a/STEER/AliPreprocessor.h b/STEER/AliPreprocessor.h index 9020b6f009c..e2dd2a04cf3 100644 --- a/STEER/AliPreprocessor.h +++ b/STEER/AliPreprocessor.h @@ -33,14 +33,16 @@ class AliPreprocessor : public TNamed virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime); virtual UInt_t Process(TMap* dcsAliasMap) = 0; - - virtual Bool_t ProcessDCS() {return kTRUE;} - + + virtual Bool_t ProcessDCS() { return kTRUE; } + protected: Bool_t Store(const char* pathLevel2, const char* pathLevel3, TObject* object, AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE); Bool_t StoreReferenceData(const char* pathLevel2, const char* pathLevel3, TObject* object, AliCDBMetaData* metaData); + Bool_t StoreReferenceFile(const char* localFile, const char* gridFileName); + const char* GetFile(Int_t system, const char* id, const char* source); TList* GetFileSources(Int_t system, const char* id); const char* GetRunParameter(const char* param); diff --git a/STEER/AliShuttleInterface.h b/STEER/AliShuttleInterface.h index b8cf5322243..7253973354a 100644 --- a/STEER/AliShuttleInterface.h +++ b/STEER/AliShuttleInterface.h @@ -28,11 +28,12 @@ class AliShuttleInterface : public TObject virtual Bool_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE) = 0; virtual Bool_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData) = 0; + virtual Bool_t StoreReferenceFile(const char* detector, const char* localFile, const char* gridFileName) = 0; virtual const char* GetFile(Int_t system, const char* detector, const char* id, const char* source) = 0; virtual TList* GetFileSources(Int_t system, const char* detector, const char* id) = 0; virtual const char* GetRunParameter(const char* lbEntry) = 0; - virtual AliCDBEntry* GetFromOCDB(const AliCDBPath& path) = 0; - virtual const char* GetRunType(const char* detCode) = 0; + virtual AliCDBEntry* GetFromOCDB(const char* detector, const AliCDBPath& path) = 0; + virtual const char* GetRunType() = 0; virtual void Log(const char* detector, const char* message) = 0; virtual void RegisterPreprocessor(AliPreprocessor* preprocessor) = 0; -- 2.39.3