14 #define CHMODE(u,g,o) ((u << 6) + (g << 3) + o)
81 if (!no_existing_file) {
95 cout << endl <<
"Updating runlist : " << flush;
103 TIter next(dir_list);
126 if (!no_existing_file) {
149 lnewruns.
Add(run_num);
151 tmp_file << run_num <<
'|' << filedate.
AsSQLString() <<
'|' << objs->
GetName() << endl;
157 cout << '>
' << flush;
160 cout << " DONE" << endl;
162 // If runs not present in the database were found, emit an informational message
163 if (lnewruns.GetNValues())
164 Info("Update", "Found %d runs not in database :\n\tlist:%s", lnewruns.GetNValues(), lnewruns.AsString());
170 if (CheckDirectoryForAvailableRunsFile()) {
171 if (no_existing_file) {
172 //use "lockfile" to make sure nobody else tries to modify available_runs file
173 //while we are working on it
174 if (!runlist_lock.Lock(runlist.Data())) return;
177 //copy temporary file to KVFiles directory, overwrite previous
178 gSystem->CopyFile(tmp_file_path, runlist, kTRUE);
179 //set access permissions to 664
180 gSystem->Chmod(runlist.Data(), CHMODE(6, 6, 4));
183 runlist_lock.Release();
186 gSystem->Unlink(tmp_file_path);
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
char * Form(const char *fmt,...)
Handles lists of available runs using Data Management Systems.
virtual ~DMSAvailableRunsFile()
Destructor.
DMSAvailableRunsFile()
Default constructor.
virtual void Update(Bool_t no_existing_file=kFALSE)
KVDatime GetModTime() const
Handles lists of available runs for different datasets and types of data.
Bool_t ExtractDateFromFileName(const Char_t *name, KVDatime &date)
const Char_t * GetDataType() const
const Char_t * GetFileName() const
const KVDataSet * GetDataSet() const
KVLockfile runlist_lock
for locking runlist file
KVNameValueList * RunHasFileWithDateAndName(Int_t run, const Char_t *filename, TDatime modtime, Int_t &OccNum)
const Char_t * GetFullPathToAvailableRunsFile() const
Int_t IsRunFileName(const Char_t *filename)
static void OpenTempFile(TString &base, std::ofstream &fp)
virtual Int_t GetNumber() const
Description of an experimental run in database ,.
Base class for managing repositories of experimental data.
virtual KVUniqueNameList * GetDirectoryListing(const KVDataSet *dataset, const Char_t *datatype="", const Char_t *subdir="")
Manage an experimental dataset corresponding to a given experiment or campaign.
KVDataRepository * GetRepository() const
Get pointer to data repository in which dataset is stored.
KVExpDB * GetDataBase(Option_t *opt="") const
Extension of TDatime to handle various useful date formats.
KVDBRun * GetDBRun(Int_t number) const
Bool_t Lock(const Char_t *filename="")
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
const Char_t * GetStringValue(const Char_t *name) const
Bool_t HasParameter(const Char_t *name) const
Strings used to represent a set of ranges of values.
void Add(Int_t)
Add value 'n' to the list.
virtual Int_t GetSize() const
Optimised list in which named objects can only be placed once.
const char * AsSQLString() const
virtual const char * GetName() const
const char * Data() const
Double_t Max(Double_t a, Double_t b)