4 #include "KV_CCIN2P3_Slurm.h"
7 #include "KVDataAnalyser.h"
8 #include "KVDataAnalysisTask.h"
9 #include "KVDataSetAnalyser.h"
10 #include "KVSimDirAnalyser.h"
27 fDefJobTime =
gEnv->
GetValue(
"GE.BatchSystem.DefaultJobTime",
"00:05:00");
28 fDefJobMem =
gEnv->
GetValue(
"GE.BatchSystem.DefaultJobMemory",
"3G");
29 fTimeSet = fMemSet =
kFALSE;
31 SetRunsPerJob(
gEnv->
GetValue(
"GE.BatchSystem.RunsPerJob", 1));
44 fTimeSet = fMemSet =
kFALSE;
60 if (tmp ==
"") tmp = fDefJobTime;
64 fParList.SetValue(
"--time ", tmp);
81 if (tmp ==
"") tmp = fDefJobMem;
82 fParList.SetValue(
"--mem ", tmp);
110 if (!fTimeSet) ChooseJobTime();
112 if (!fMemSet) ChooseJobMemory();
124 cout <<
"Enter max CPU time per job (ss/mn:ss/hh:mn:ss) ["
125 << fDefJobTime <<
"] : ";
143 cout <<
"Enter max memory per job (xKB/xMB/xGB) ["
144 << fDefJobMem.
Data() <<
"] : ";
147 SetJobMemory(tmp.
Data());
158 return fParList.GetStringValue(
"--time ");
169 return fParList.GetStringValue(
"--mem ");
184 env->
SetValue(
"BatchSystem.MultiJobs", MultiJobsMode());
185 if (MultiJobsMode()) env->
SetValue(
"BatchSystem.CurrentRunList", fCurrJobRunList.AsString());
186 env->
SetValue(
"BatchSystem.Time", GetJobTime());
187 env->
SetValue(
"BatchSystem.Memory", GetJobMemory());
190 env->
SetValue(
"SimDirAnalyser.CopyFilesToWorkingDirectory",
true);
206 if (MultiJobsMode()) fCurrJobRunList.SetList(env->
GetValue(
"BatchSystem.CurrentRunList",
""));
207 SetJobTime(env->
GetValue(
"BatchSystem.Time",
""));
208 SetJobMemory(env->
GetValue(
"BatchSystem.Memory",
""));
222 if (!strcmp(
option,
"log")) {
224 cout <<
"* MEM_REQ: " << GetJobMemory() <<
" *" << endl;
272 KVString oldoptions(GetDefaultJobOptions());
274 KVString ressource_list(
" -L xrootd");
276 if ((NeedToAddSPS || repIsSPS)) {
277 ressource_list +=
",sps";
279 oldoptions += ressource_list;
280 SetDefaultJobOptions(oldoptions.
Data());
301 fCurrJobName.ReplaceAll(
":",
"_");
317 if (!CheckJobParameters())
return;
319 if (MultiJobsMode()) {
320 if (fAnalyser->InheritsFrom(
"KVDataSetAnalyser")) {
326 fCurrJobRunList.Clear();
327 while (remaining_runs && !runs.
End()) {
330 fCurrJobRunList.Add(run);
331 if ((fCurrJobRunList.GetNValues() == GetRunsPerJob()) || runs.
End()) {
336 fCurrJobRunList.Clear();
341 else if (fAnalyser->InheritsFrom(
"KVSimDirAnalyser")) {
346 fCurrJobRunList.Clear();
351 while ((of = it())) {
352 cur_file_list.
Add(of);
353 fCurrJobRunList.Add(file_no);
356 if ((fCurrJobRunList.GetNValues() == GetRunsPerJob()) || (remaining_runs == 0)) {
360 fCurrJobRunList.Clear();
361 cur_file_list.
Clear();
402 fCurrJobName = fJobName;
406 fCurrJobName = fAnalyser->ExpandAutoBatchName(fJobName.Data());
407 if (MultiJobsMode() && !fAnalyser->BatchMode()) {
409 if (fCurrJobRunList.GetNValues() > 1)
410 tmp.
Form(
"_R%d-%d", fCurrJobRunList.First(), fCurrJobRunList.Last());
412 tmp.
Form(
"_R%d", fCurrJobRunList.First());
417 return fCurrJobName.Data();
450 nl.
SetValue(
"JobTime", fDefJobTime);
451 nl.
SetValue(
"JobMemory", fDefJobMem);
452 nl.
SetValue(
"MultiJobsMode", MultiJobsMode());
453 nl.
SetValue(
"RunsPerJob", fRunsPerJob);
R__EXTERN TSystem * gSystem
Base class for interface to a batch job management system.
virtual void WriteBatchEnvFile(TEnv *)
virtual void Print(Option_t *="") const
virtual void ChangeDefJobOpt(KVDataAnalyser *da)
virtual void ReadBatchEnvFile(TEnv *)
virtual void SetBatchSystemParameters(const KVNameValueList &)
Use the parameters in the list to set all relevant parameters for batch system.
virtual void GetBatchSystemParameterList(KVNameValueList &)
virtual void Clear(Option_t *opt="")
virtual Bool_t CheckJobParameters()
Checks the job and ask for the job name if needed.
Manager class which sets up and runs data analysis tasks.
virtual KVString GetRootDirectoryOfDataToAnalyse() const
KVDataAnalysisTask * GetAnalysisTask() const
Pilots user analysis of experimental data.
void SetFullRunList(const KVNumberList &nl)
void SetRuns(const KVNumberList &nl, Bool_t check=kTRUE)
const KVNumberList & GetRunList() const
Extended TList class which owns its objects by default.
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Int_t GetIntValue(const Char_t *name) const
void SetValue(const Char_t *name, value_type value)
Bool_t GetBoolValue(const Char_t *name) const
const Char_t * GetStringValue(const Char_t *name) const
Strings used to represent a set of ranges of values.
Class piloting analyses of simulated data.
void SetFileList(TList *l) override
Int_t GetNumberOfFilesToAnalyse() const override
TList * GetFileList() const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Int_t GetNValues(TString delim) const
Interface to CCIN2P3 Grid Engine batch job management system.
virtual void Print(Option_t *="") const
virtual void ChangeDefJobOpt(KVDataAnalyser *)
const Char_t * GetJobName() const
const Char_t * GetJobTime(void) const
returns the parameter string corresponding to the job CPU time
virtual void Clear(Option_t *opt="")
Clear previously set parameters in order to create a new job submission command.
virtual Bool_t CheckJobParameters()
Checks the job and asks for any missing parameters.
void SetJobMemory(const Char_t *h="")
virtual void GetBatchSystemParameterList(KVNameValueList &)
const Char_t * GetJobMemory(void) const
returns the parameter string corresponding to the job Memory
void ChooseJobMemory(void)
void SetJobTime(const Char_t *h="")
virtual void SetBatchSystemParameters(const KVNameValueList &)
Use the parameters in the list to set all relevant parameters for batch system.
void PrintJobs(Option_t *opt="")
Print list of owner's jobs.
virtual void ReadBatchEnvFile(TEnv *)
virtual void SanitizeJobName() const
virtual void WriteBatchEnvFile(TEnv *)
void ls(Option_t *option="") const override
virtual const char * GetValue(const char *name, const char *dflt) const
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
void Clear(Option_t *option="") override
void Add(TObject *obj) override
const char * GetName() const override
std::istream & ReadToDelim(std::istream &str, char delim='\n')
const char * Data() const
TString & Prepend(char c, Ssiz_t rep=1)
void Form(const char *fmt,...)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual const char * WorkingDirectory()
UInt_t GetListOfJobs(TFile *file, TList &jobdirs)