55 fLogFile = (logfile) ? logfile : stdout;
82 if ((lnow = lseek(fileno(
fLogFile), (off_t) 0, SEEK_CUR)) < 0) {
83 Error(
"AddLogFile",
"problems lseeking current position on log file (errno: %d)", errno);
90 lseek(fileno(
fLogFile), (off_t) start, SEEK_SET);
93 const Int_t kMAXBUF = 4096;
95 while (fgets(line,
sizeof(line),
fLogFile)) {
96 if (line[strlen(line)-1] ==
'\n')
97 line[strlen(line)-1] = 0;
102 if (lnow >= 0) lseek(fileno(
fLogFile), lnow, SEEK_SET);
127 if (strlen(sess) < 7 || strncmp(sess,
"session",7))
136 qdir.
Form(
"%s/%s", queriesdir.
Data(), sess);
138 Info(
"RemoveQuery",
"removing directory: %s", qdir.
Data());
145 Warning(
"RemoveQuery",
"cannot open queries directory: %s", queriesdir.
Data());
171 if (strlen(sess) < 7 || strncmp(sess,
"session",7))
188 TString fn =
Form(
"%s/%s/%s/query-result.root", dir, sess, qry);
195 while ((k = (
TKey *)nxk())) {
196 if (!strcmp(k->GetClassName(),
"TProofQueryResult")) {
216 Warning(
"ScanPreviousQueries",
"unable to clone TProofQueryResult '%s:%s'",
263 if (strlen(sess) < 7 || strncmp(sess,
"session",7))
281 TString fn =
Form(
"%s/%s/%s/query-result.root", dir.
Data(), sess, qry);
286 Info(
"ApplyMaxQueries",
"file '%s' cannot be stated: remove it", fn.
Data());
355 Error(
"LockSession",
"locker space undefined");
362 TRegexp re(
"session-.*-.*-.*-.*");
365 Error(
"LockSession",
"bad format: %s", sessiontag);
377 parlog = parlog.
Remove(parlog.
Index(
"master-")+strlen(
"master-"));
381 Info(
"LockSession",
"parent still running: do nothing");
392 if (((*lck)->Lock()) < 0) {
393 Error(
"LockSession",
"problems locking query lock file");
410 Error(
"CleanupSession",
"session tag undefined");
421 Info(
"CleanupSession",
"query dir %s does not exist", qdir.
Data());
442 Info(
"CleanupSession",
"could not lock session %s", sessiontag);
461 TString ofn = fout ? fout :
Form(
"%s/query-result.root", querydir.
Data());
482 Info(
"RemoveQuery",
"Enter");
492 if (otherlist) otherlist->
Add(pqr);
501 Info(
"RemoveQuery",
"removing directory: %s", qdir.
Data());
515 Info(
"RemoveQuery",
"Enter");
525 Info(
"RemoveQuery",
"removing directory: %s", qdir.
Data());
557 qry = queryref.
Atoi();
562 qry = queryref.
Atoi();
571 Info(
"LocateQuery",
"local query: %d", qry);
587 Info(
"LocateQuery",
"previously processed query: %s", queryref.
Data());
615 if (!pq || !proof || !player) {
616 Warning(
"FinalizeQuery",
"bad inputs: query = %p, proof = %p, player: %p ",
617 pq ? pq : 0, proof ? proof : 0, player ? player : 0);
631 PDB(kGlobal, 2)
Info(
"FinalizeQuery",
"query #%d", qn);
634 Info(
"FinalizeQuery",
"%.1f %lld", cpu, bytes);
641 Info(
"FinalizeQuery",
"query %d has been ABORTED <====", qn);
647 Info(
"FinalizeQuery",
648 "query %d has been STOPPED: %lld events processed", qn, np);
653 Info(
"FinalizeQuery",
654 "query %d has been completed: %lld events processed", qn, np);
659 "query %d: unknown exit status (%d)", qn, player->
GetExitStatus());
666 Info(
"FinalizeQuery",
"cpu: %.4f, saved: %.4f, master: %.4f",
704 if (!farc && !fcom) {
722 emsg.
Form(
"Too many saved queries (%d): cannot save %s:%s",
virtual const char * GetName() const
Returns name of object.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual void AddAt(TObject *obj, Int_t idx)
Insert object at position idx in the list.
void RecordEnd(EQueryStatus status, TList *outlist=0)
End of query settings.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Long64_t GetBytesRead() const
Collectable string class.
TString & ReplaceAll(const TString &s1, const TString &s2)
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Int_t LockSession(const char *sessiontag, TProofLockPath **lck)
Try locking query area of session tagged sessiontag.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual EExitStatus GetExitStatus() const =0
void AddLogFile(TProofQueryResult *pq)
Add part of log file concerning TQueryResult pq to its macro container.
virtual int MakeDirectory(const char *name)
Make a directory.
Regular expression class.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
void AddLogLine(const char *logline)
Fill log file.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
void SetVal(const AParamType &val)
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
TQueryResult * CloneInfo()
Return an instance of TQueryResult containing only the local info fields, i.e.
TProofQueryResult * LocateQuery(TString queryref, Int_t &qry, TString &qdir)
Locate query referenced by queryref.
TObject * FindObject(const char *name) const
Find object using its name.
void ScanPreviousQueries(const char *dir)
Scan the queries directory for the results of previous queries.
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual TList * GetOutputList() const =0
virtual int Unlink(const char *name)
Unlink, i.e. remove, a file.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
The TNamed class is the base class for all named ROOT classes.
const char *const kPROOF_QueryDir
Int_t CleanupSession(const char *sessiontag)
Cleanup query dir qdir.
Int_t ApplyMaxQueries(Int_t mxq)
Scan the queries directory and remove the oldest ones (and relative dirs, if empty) in such a way onl...
A sorted doubly linked list.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
A container class for query results.
void SetResultFile(const char *rf)
virtual void SetProcessInfo(Long64_t ent, Float_t cpu=0., Long64_t siz=-1, Float_t inittime=0., Float_t proctime=0.)
Set processing info.
const char * GetName() const
Returns name of object.
void SendAsynMessage(const char *msg, Bool_t lf=kTRUE)
Send an asychronous message to the master / client .
Named parameter, streamable and storable.
R__EXTERN TSystem * gSystem
virtual TObject * Remove(TObject *obj)
Remove object from the list.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
char * Form(const char *fmt,...)
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Bool_t FinalizeQuery(TProofQueryResult *pq, TProof *proof, TVirtualProofPlayer *player)
Final steps after Process() to complete the TQueryResult instance.
static constexpr double nm
Float_t GetUsedCPU() const
virtual void FreeDirectory(void *dirp)
Free a directory.
EQueryStatus GetStatus() const
TString & Remove(Ssiz_t pos)
TQueryResultManager(const char *qdir, const char *stag, const char *sdir, TProofLockPath *lck, FILE *logfile=0)
Constructor.
virtual Long64_t GetEventsProcessed() const =0
virtual Int_t ReadKeys(Bool_t forceRead=kTRUE)
Read the linked list of keys.
This class controls a Parallel ROOT Facility, PROOF, cluster.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Bool_t IsArchived() const
void RemoveQuery(TQueryResult *qr, Bool_t soft=kFALSE)
Remove everything about query qr.
TQueryResult version adapted to PROOF neeeds.
void SaveQuery(TProofQueryResult *qr, const char *fout=0)
Save current status of query 'qr' to file name fout.
virtual ~TQueryResultManager()
Cleanup.
Float_t GetCpuTime() const
R__EXTERN TProofServ * gProofServ
virtual void Add(TObject *obj)
virtual TList * GetListOfKeys() const
Int_t CleanupQueriesDir()
Remove all queries results referring to previous sessions.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Int_t Atoi() const
Return integer value of string.
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
const AParamType & GetVal() const
Abstract interface for the PROOF player.
void Add(TObject *obj)
Add object in sorted list.
const Bool_t kIterBackward
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual const char * GetTitle() const
Returns title of object.
virtual void Close(Option_t *option="")
Close a file.
virtual Int_t IndexOf(const TObject *obj) const
Return index of object in collection.
const char * Data() const