64 :
TNamed(
"",
""), fRemoteProtocol(-1), fServType(kXProofd),
65 fSessions(0), fIntHandler(0)
70 fUrl = (!url || strlen(url) <= 0) ?
TUrl(
"proof://localhost") :
TUrl(url);
84 Info(
"TProofMgr",
"service 'proofd' not found by GetServiceByName"
85 ": using default IANA assigned tcp port 1093");
89 Info(
"TProofMgr",
"port from GetServiceByName: %d", port);
116 gROOT->GetListOfProofs()->Remove(
this);
130 Info(
"AttachSession",
"invalid proofserv id (%d)",
id);
142 Warning(
"AttachSession",
"invalid description object - do nothing");
148 return d->GetProof();
150 Warning(
"AttachSession",
"session not available - do nothing");
163 Warning(
"DetachSession",
"invalid TProofMgr - do nothing");
172 d->GetProof()->Detach(opt);
179 }
else if (
id == 0) {
188 d->GetProof()->Detach(opt);
207 Warning(
"DetachSession",
"invalid TProofMgr - do nothing");
217 d->GetProof()->Detach(opt);
231 if (opt && !strncasecmp(opt,
"L",1))
242 if (
gROOT->GetListOfProofs()) {
248 while ((o = nxp())) {
272 if (!(
gROOT->GetListOfProofs()->FindObject(
d->GetProof()))) {
276 if (opt && !strncasecmp(opt,
"S",1))
297 Warning(
"SendMsgToUsers",
"functionality not supported");
309 Warning(
"Reset",
"functionality not supported");
355 if (p ==
d->GetProof())
374 if (p ==
d->GetProof()) {
388 const char *cfgdir,
Int_t loglevel)
419 if (
gDebug > 0)
Error(
"CreateSession",
"PROOF session creation failed");
463 if (
gROOT->GetListOfProofs()) {
466 while ((o = nxp())) {
477 while ((o = nxp())) {
478 if (!(
gROOT->GetListOfProofs()->FindObject(o))) {
488 Printf(
"No managers found");
500 const char *alias,
Bool_t xpd)
509 if (
proto.IsNull()) {
514 if (
proto ==
"lite" || host ==
"__lite__" ) {
521 ::Info(
"TProofMgr::Create",
"'lite' not yet supported on Windows");
536 const char *url = u.
GetUrl();
544 if (
m->MatchUrl(url))
return m;
567 trystd = (
m && !(
m->IsValid()) &&
m->IsProofd()) ?
kTRUE :
kFALSE;
580 if (
m->IsValid() && !(
m->IsProofd())) {
582 gROOT->GetListOfProofs()->Add(
m);
583 gROOT->GetListOfSockets()->Add(
m);
600 TString prooflib =
"libProofx";
605 ::Error(
"TProofMgr::GetXProofMgrCtor",
606 "can't load %s", prooflib.
Data());
608 ::Error(
"TProofMgr::GetXProofMgrCtor",
609 "can't locate %s", prooflib.
Data());
633 if (!url || (url && strlen(url) <= 0)) {
634 ::Error(
"TProofMgr::Ping",
"empty url - fail");
652 if (!(
s.IsValid())) {
661 memset(&initHS, 0,
sizeof(initHS));
662 int len =
sizeof(initHS);
666 if ((writeCount =
s.SendRaw(&initHS, len)) != len) {
668 ::Info(
"TProofMgr::Ping",
"1st: wrong number of bytes sent: %d (expected: %d)",
675 if ((writeCount =
s.SendRaw(&initHS, len)) != len) {
677 ::Info(
"TProofMgr::Ping",
"1st: wrong number of bytes sent: %d (expected: %d)",
686 if ((writeCount =
s.SendRaw(&dum[0],
sizeof(dum))) !=
sizeof(dum)) {
688 ::Info(
"TProofMgr::Ping",
"2nd: wrong number of bytes sent: %d (expected: %d)",
689 writeCount, (
int)
sizeof(dum));
697 int readCount =
s.RecvRaw(&
type, len);
698 if (readCount != len) {
700 ::Info(
"TProofMgr::Ping",
"1st: wrong number of bytes read: %d (expected: %d)",
711 readCount =
s.RecvRaw(&xbody, len);
712 if (readCount != len) {
714 ::Info(
"TProofMgr::Ping",
"2nd: wrong number of bytes read: %d (expected: %d)",
719 xbody.protover =
net2host(xbody.protover);
720 xbody.msgval =
net2host(xbody.msglen);
721 xbody.msglen =
net2host(xbody.msgval);
723 }
else if (
type == 8) {
725 if (
gDebug > 0)
::Info(
"TProofMgr::Ping",
"server is old %s", (checkxrd ?
"ROOTD" :
"PROOFD"));
747 if (!fn || (fn && strlen(fn) <= 0))
return;
748 if (dirph.
GetSize() <= 0)
return;
754 while (dd.Tokenize(
d, from,
"/")) {
757 if (dirs.
GetSize() <= 0)
return;
768 "requested directory level '%s' is not available in the file path",
803 const char *mss,
const char *
dest)
808 if (!src || (src && src->
GetSize() <= 0)) {
809 ::Warning(
"TProofMgr::UploadFiles",
"list is empty!");
812 if (!mss || (mss && strlen(mss) <= 0)) {
813 ::Warning(
"TProofMgr::UploadFiles",
"MSS is undefined!");
824 while (dst.Tokenize(dt, from,
"/")) {
850 while ((o = nxf())) {
852 if (!strcmp(o->
ClassName(),
"TFileInfo")) {
853 if (!(fi =
dynamic_cast<TFileInfo *
>(o))) {
855 "object of class name '%s' does not cast to %s - ignore",
860 }
else if (!strcmp(o->
ClassName(),
"TObjString")) {
863 "object of class name '%s' does not cast to %s - ignore",
870 "object of unsupported class '%s' found in list - ignore", o->
ClassName());
899 if (idx !=
kNPOS)
ex.Remove(0, idx+1);
948 ::Info(
"TProofMgr::UploadFiles",
"uploading '%s' to '%s'", furl->
GetUrl(), fdst.
Data());
953 ::Error(
"TProofMgr::UploadFiles",
"file %s was not copied", furl->
GetUrl());
988 const char *mss,
const char *
dest)
993 if (!srcfiles || (srcfiles && strlen(srcfiles) <= 0)) {
994 ::Error(
"TProofMgr::UploadFiles",
"input text file or directory undefined!");
997 if (!mss || (mss && strlen(mss) <= 0)) {
998 ::Error(
"TProofMgr::UploadFiles",
"MSS is undefined!");
1007 ::Error(
"TProofMgr::UploadFiles",
1008 "could not get information about the input path '%s':"
1009 " make sure that it exists and is readable", srcfiles);
1021 f.open(inpath.
Data(), std::ifstream::out);
1024 line.ReadToDelim(
f);
1027 if (
line.BeginsWith(
"#"))
continue;
1033 ::Error(
"TProofMgr::UploadFiles",
"unable to open file '%s'", srcfiles);
1039 const char *ent = 0;
1041 if (!strcmp(ent,
".") || !strcmp(ent,
".."))
continue;
1042 line.Form(
"%s/%s", inpath.
Data(), ent);
1048 ::Error(
"TProofMgr::UploadFiles",
"unable to open directory '%s'", inpath.
Data());
1051 ::Error(
"TProofMgr::UploadFiles",
1052 "input path '%s' is neither a regular file nor a directory!", inpath.
Data());
1056 ::Warning(
"TProofMgr::UploadFiles",
"no files found in file or directory '%s'", inpath.
Data());
1072 Error(
"Rm",
"invalid TProofMgr - do nothing");
1077 Error(
"Rm",
"path undefined!");
1088 return (rc == 0) ? 0 : -1;
1102 const char *st[] = {
"unknown",
"idle",
"processing",
"shutting down"};
UShort_t host2net(UShort_t x)
UShort_t net2host(UShort_t x)
void Error(const char *location, const char *msgfmt,...)
R__EXTERN Int_t gErrorIgnoreLevel
TProofMgr *(* TProofMgr_t)(const char *, Int_t, const char *)
R__EXTERN TProof * gProof
R__EXTERN TVirtualMutex * gROOTMutex
void Printf(const char *fmt,...)
Bool_t R_ISREG(Int_t mode)
Bool_t R_ISDIR(Int_t mode)
R__EXTERN TSystem * gSystem
#define R__LOCKGUARD(mutex)
virtual Int_t GetEntries() const
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Class that contains a list of TFileInfo's and accumulated meta data information about its entries.
Int_t Add(TFileInfo *info)
Add TFileInfo to the collection.
Class describing a generic file including meta information.
TUrl * GetFirstUrl() const
virtual Bool_t Cp(const char *dst, Bool_t progressbar=kTRUE, UInt_t buffersize=1000000)
Allows to copy this file to the dst URL.
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
The TNamed class is the base class for all named ROOT classes.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Collectable string class.
const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
void AbstractMethod(const char *method) const
Use this method to implement an "abstract" method that you don't want to leave purely abstract.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Named parameter, streamable and storable.
const char * GetUrl() const
void Print(Option_t *opt="") const
Dump the content to the screen.
Basic TProofMgr functionality implementation in the case of Lite session.
The PROOF manager interacts with the PROOF server coordinator to create or destroy a PROOF session,...
static TProofMgr_t GetXProofMgrHook()
Get the constructor hook fro TXProofMgr.
virtual void ShowWorkers()
Show available workers.
static void ReplaceSubdirs(const char *fn, TString &fdst, TList &dirph)
Parse file name extracting the directory subcomponents in dirs, stored as TObjStrings.
virtual Int_t Reset(Bool_t hard=kFALSE, const char *usr=0)
Send a cleanup request for the sessions associated with the current user.
virtual TList * QuerySessions(Option_t *opt="S")
Get list of sessions accessible to this manager.
static TProofMgr * Create(const char *url, Int_t loglevel=-1, const char *alias=0, Bool_t xpd=kTRUE)
Static method returning the appropriate TProofMgr object using the plugin manager.
virtual ~TProofMgr()
Destroy a TProofMgr instance.
static TList * GetListOfManagers()
Extract pointers to PROOF managers from TROOT::fProofs.
virtual Int_t SendMsgToUsers(const char *, const char *=0)
Send a message to connected users.
virtual Int_t Rm(const char *, const char *=0, const char *=0)
Run 'rm' on 'what'. Locally it is just a call to TSystem::Unlink .
TSignalHandler * fIntHandler
virtual TProof * CreateSession(const char *=0, const char *=0, Int_t=-1)
Create a new remote session (master and associated workers).
static Int_t Ping(const char *url, Bool_t checkxrd=kFALSE)
Non-blocking check for a PROOF (or Xrootd, if checkxrd) service at 'url' Return 0 if a XProofd (or Xr...
virtual Bool_t IsValid() const
static TList fgListOfManagers
static void SetTXProofMgrHook(TProofMgr_t pmh)
Set hook to TXProofMgr ctor.
virtual void DetachSession(Int_t, Option_t *="")
Detach session with 'id' from its proofserv.
virtual void SetAlias(const char *alias="")
virtual TProof * AttachSession(Int_t, Bool_t=kFALSE)
Dummy version provided for completeness.
virtual Bool_t IsProofd() const
virtual TProofDesc * GetProofDesc(Int_t id)
Get TProofDesc instance corresponding to 'id'.
static TProofMgr_t fgTXProofMgrHook
virtual Bool_t MatchUrl(const char *url)
Checks if 'url' refers to the same 'user@host:port' entity as the URL in memory.
virtual void DiscardSession(TProof *p)
Discard TProofDesc of session 'p' from the internal list.
static TFileCollection * UploadFiles(TList *src, const char *mss, const char *dest=0)
Upload files provided via the list 'src' (as TFileInfo or TObjString) to 'mss'.
This class controls a Parallel ROOT Facility, PROOF, cluster.
const char * GetSessionTag() const
Int_t GetSessionID() const
const char * GetGroup() const
Regular expression class.
Int_t Atoi() const
Return integer value of string.
const char * Data() const
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
TString & ReplaceAll(const TString &s1, const TString &s2)
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TString & Remove(Ssiz_t pos)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual int GetServiceByName(const char *service)
Get port # of internet service.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
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 Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
virtual int Unlink(const char *name)
Unlink, i.e.
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
char * DynamicPathName(const char *lib, Bool_t quiet=kFALSE)
Find a dynamic library called lib using the system search paths.
This class represents a WWW compatible URL.
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
const char * GetFile() const
void SetUrl(const char *url, Bool_t defaultIsFile=kFALSE)
Parse url character string and split in its different subcomponents.
void SetProtocol(const char *proto, Bool_t setDefaultPort=kFALSE)
Set protocol and, optionally, change the port accordingly.
const char * GetUser() const
const char * GetHost() const
void SetOptions(const char *opt)
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
void SetHost(const char *host)
const char * GetProtocol() const
static constexpr double nm
static constexpr double s
static constexpr double pi
static constexpr double ns
static constexpr double second
static constexpr double cm
Double_t Log10(Double_t x)
#define dest(otri, vertexptr)