From f208787c12863b71bd0705a3980ea6c71e30c3ef Mon Sep 17 00:00:00 2001 From: rgrosso Date: Thu, 15 May 2008 12:42:04 +0000 Subject: [PATCH] macro and bash script to check for cdb-paths and entries in an OCDB folder --- STEER/CheckCDBentries.C | 50 +++++++++++++++++++++++++++++++++++++++++ STEER/listCdbEntries.sh | 36 +++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 STEER/CheckCDBentries.C create mode 100755 STEER/listCdbEntries.sh diff --git a/STEER/CheckCDBentries.C b/STEER/CheckCDBentries.C new file mode 100644 index 00000000000..69a7a3e80fc --- /dev/null +++ b/STEER/CheckCDBentries.C @@ -0,0 +1,50 @@ +#if !defined(__CINT__) || defined(__MAKECINT__) +#include "AliCDBManager.h" +#include "AliCDBStorage.h" +#include "AliCDBEntry.h" +#include "AliCDBId.h" +#include +#include +#endif + +void CheckCDBentries(const char* dest) +{ + AliCDBManager* cdb = AliCDBManager::Instance(); + const char* ref="local://$ALICE_ROOT"; + cdb->SetDefaultStorage(ref); + cdb->SetRun(0); + AliCDBStorage* newstor = cdb->GetStorage(dest); + // Missing here a check that newstor is a valid storage + // otherwise exit + TList* allentries = cdb->GetAll("*/*/*"); + TList* allnewentries = newstor->GetAll("*/*/*",0); + Int_t nall = allentries->GetEntries(); + Int_t nallnew = allnewentries->GetEntries(); + Printf("Number of entries in reference OCDB %d and in checked OCDB %d",nall, nallnew); + TString missing; + Int_t nMissing=0; + if(nall!=nallnew) + { + AliCDBEntry *entry, *newentry; + TString cdbpath; + for(Int_t i=0; i(allentries->At(i)); + cdbpath = ((AliCDBId)entry->GetId()).GetPath(); + newentry = newstor->Get(cdbpath.Data(),0); + if(!newentry) + { + missing += cdbpath; + missing.Insert(missing.Length(),'\n'); + nMissing++; + } + } + } + if(nMissing) + { + Printf("\n\nEntries missing in destination OCDB folder %s w.r.t. reference folder %s:",dest,ref); + Printf("%s",missing.Data()); + }else{ + Printf("\n\nNo entry is missing in destination OCDB folder %s w.r.t. reference folder %s:",dest,ref); + } +} diff --git a/STEER/listCdbEntries.sh b/STEER/listCdbEntries.sh new file mode 100755 index 00000000000..8ec7eda1854 --- /dev/null +++ b/STEER/listCdbEntries.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# List all CDB paths present in the current OCDB folder +# The script is meant to check the different CDB path in the reference OCDB +# ($ALICE_ROOT) to make sure all entries are copied to the destination OCDB +# folder. In particular we are interested in the second of the three levels +# composing the CDB-path since usually the copy from one OCDB to the other +# is done by lines of the type +# TList* l = cdb->GetAll("*/Calib/*"); +# TList* l = cdb->GetAll("*/Align/*"); +# (see macro CDBToGrid.C) +# + +stdfname="Run0_999999999" +msg="List of second level strings for CDB entries:" +cd $1 +for i in `find ./ -name 'Run*' | grep -v svn` +do + fname=`echo "$i" | cut -d/ -f5` + if(expr match "$fname" "Run0." > /dev/null) + then + if [[ $fname == Run0_99999999* ]] + then + second=`echo "$i" | cut -d/ -f3` + if [[ $second != Align ]] && [[ $second != Calib ]] && [[ $second != Config ]] + then + #printf "$second in $i\n" + msg="$msg + $second for entry $i" + fi + else + echo "Warning: $i is not a good file name for OCDB" + fi + fi +done +echo "$msg" + -- 2.39.3