63 :
TNamed(
"",
""), fRemoteProtocol(-1), fServType(kXProofd),
64 fSessions(0), fIntHandler(0)
69 fUrl = (!url || strlen(url) <= 0) ?
TUrl(
"proof://localhost") :
TUrl(url);
83 Info(
"TProofMgr",
"service 'proofd' not found by GetServiceByName" 84 ": using default IANA assigned tcp port 1093");
88 Info(
"TProofMgr",
"port from GetServiceByName: %d", port);
115 gROOT->GetListOfProofs()->Remove(
this);
129 Info(
"AttachSession",
"invalid proofserv id (%d)",
id);
141 Warning(
"AttachSession",
"invalid description object - do nothing");
149 Warning(
"AttachSession",
"session not available - do nothing");
162 Warning(
"DetachSession",
"invalid TProofMgr - do nothing");
178 }
else if (
id == 0) {
206 Warning(
"DetachSession",
"invalid TProofMgr - do nothing");
230 if (opt && !strncasecmp(opt,
"L",1))
241 if (
gROOT->GetListOfProofs()) {
247 while ((o = nxp())) {
271 if (!(
gROOT->GetListOfProofs()->FindObject(d->
GetProof()))) {
275 if (opt && !strncasecmp(opt,
"S",1))
296 Warning(
"SendMsgToUsers",
"functionality not supported");
308 Warning(
"Reset",
"functionality not supported");
387 const char *cfgdir,
Int_t loglevel)
418 if (
gDebug > 0)
Error(
"CreateSession",
"PROOF session creation failed");
462 if (
gROOT->GetListOfProofs()) {
465 while ((o = nxp())) {
476 while ((o = nxp())) {
477 if (!(
gROOT->GetListOfProofs()->FindObject(o))) {
487 Printf(
"No managers found");
499 const char *alias,
Bool_t xpd)
513 if (proto ==
"lite" || host ==
"__lite__" ) {
520 ::Info(
"TProofMgr::Create",
"'lite' not yet supported on Windows");
535 const char *url = u.
GetUrl();
564 m = (
TProofMgr *) (*cm)(url, loglevel, alias);
581 gROOT->GetListOfProofs()->Add(m);
582 gROOT->GetListOfSockets()->Add(m);
599 TString prooflib =
"libProofx";
604 ::
Error(
"TProofMgr::GetXProofMgrCtor",
605 "can't load %s", prooflib.
Data());
607 ::Error(
"TProofMgr::GetXProofMgrCtor",
608 "can't locate %s", prooflib.
Data());
632 if (!url || (url && strlen(url) <= 0)) {
633 ::Error(
"TProofMgr::Ping",
"empty url - fail");
651 if (!(
s.IsValid())) {
660 memset(&initHS, 0,
sizeof(initHS));
661 int len =
sizeof(initHS);
663 initHS.fourth = (int)
host2net((
int)4);
664 initHS.fifth = (int)
host2net((
int)2012);
665 if ((writeCount =
s.SendRaw(&initHS, len)) != len) {
667 ::Info(
"TProofMgr::Ping",
"1st: wrong number of bytes sent: %d (expected: %d)",
673 initHS.third = (int)
host2net((
int)1);
674 if ((writeCount =
s.SendRaw(&initHS, len)) != len) {
676 ::Info(
"TProofMgr::Ping",
"1st: wrong number of bytes sent: %d (expected: %d)",
685 if ((writeCount =
s.SendRaw(&dum[0],
sizeof(dum))) !=
sizeof(dum)) {
687 ::Info(
"TProofMgr::Ping",
"2nd: wrong number of bytes sent: %d (expected: %d)",
688 writeCount, (
int)
sizeof(dum));
696 int readCount =
s.RecvRaw(&type, len);
697 if (readCount != len) {
699 ::Info(
"TProofMgr::Ping",
"1st: wrong number of bytes read: %d (expected: %d)",
710 readCount =
s.RecvRaw(&xbody, len);
711 if (readCount != len) {
713 ::Info(
"TProofMgr::Ping",
"2nd: wrong number of bytes read: %d (expected: %d)",
718 xbody.protover =
net2host(xbody.protover);
719 xbody.msgval =
net2host(xbody.msglen);
720 xbody.msglen =
net2host(xbody.msgval);
722 }
else if (type == 8) {
724 if (
gDebug > 0)
::Info(
"TProofMgr::Ping",
"server is old %s", (checkxrd ?
"ROOTD" :
"PROOFD"));
729 if (
gDebug > 0)
::Info(
"TProofMgr::Ping",
"unknown server type: %d", type);
746 if (!fn || (fn && strlen(fn) <= 0))
return;
747 if (dirph.
GetSize() <= 0)
return;
753 while (dd.Tokenize(d, from,
"/")) {
756 if (dirs.
GetSize() <= 0)
return;
767 "requested directory level '%s' is not available in the file path",
802 const char *mss,
const char *
dest)
807 if (!src || (src && src->
GetSize() <= 0)) {
808 ::Warning(
"TProofMgr::UploadFiles",
"list is empty!");
811 if (!mss || (mss && strlen(mss) <= 0)) {
812 ::Warning(
"TProofMgr::UploadFiles",
"MSS is undefined!");
819 if (dest && strlen(dest) > 0) {
823 while (dst.Tokenize(dt, from,
"/")) {
826 dt.ReplaceAll(
"<d",
"");
827 dt.ReplaceAll(
">",
"");
849 while ((o = nxf())) {
851 if (!strcmp(o->
ClassName(),
"TFileInfo")) {
852 if (!(fi = dynamic_cast<TFileInfo *>(o))) {
854 "object of class name '%s' does not cast to %s - ignore",
859 }
else if (!strcmp(o->
ClassName(),
"TObjString")) {
860 if (!(os = dynamic_cast<TObjString *>(o))) {
862 "object of class name '%s' does not cast to %s - ignore",
869 "object of unsupported class '%s' found in list - ignore", o->
ClassName());
878 if (dest && strlen(dest) > 0) {
898 if (idx !=
kNPOS)
ex.Remove(0, idx+1);
947 ::Info(
"TProofMgr::UploadFiles",
"uploading '%s' to '%s'", furl->
GetUrl(), fdst.
Data());
952 ::Error(
"TProofMgr::UploadFiles",
"file %s was not copied", furl->
GetUrl());
987 const char *mss,
const char *
dest)
992 if (!srcfiles || (srcfiles && strlen(srcfiles) <= 0)) {
993 ::Error(
"TProofMgr::UploadFiles",
"input text file or directory undefined!");
996 if (!mss || (mss && strlen(mss) <= 0)) {
997 ::Error(
"TProofMgr::UploadFiles",
"MSS is undefined!");
1005 ::Error(
"TProofMgr::UploadFiles",
1006 "could not get information about the input path '%s':" 1007 " make sure that it exists and is readable", srcfiles);
1019 f.open(inpath.Data(), std::ifstream::out);
1031 ::Error(
"TProofMgr::UploadFiles",
"unable to open file '%s'", srcfiles);
1033 }
else if (
R_ISDIR(fst.fMode)) {
1037 const char *ent = 0;
1039 if (!strcmp(ent,
".") || !strcmp(ent,
".."))
continue;
1040 line.
Form(
"%s/%s", inpath.Data(), ent);
1046 ::Error(
"TProofMgr::UploadFiles",
"unable to open directory '%s'", inpath.Data());
1049 ::Error(
"TProofMgr::UploadFiles",
1050 "input path '%s' is neither a regular file nor a directory!", inpath.Data());
1054 ::Warning(
"TProofMgr::UploadFiles",
"no files found in file or directory '%s'", inpath.Data());
1070 Error(
"Rm",
"invalid TProofMgr - do nothing");
1074 if (!what || (what && strlen(what) <= 0)) {
1075 Error(
"Rm",
"path undefined!");
1086 return (rc == 0) ? 0 : -1;
1100 const char *st[] = {
"unknown",
"idle",
"processing",
"shutting down"};
1102 Printf(
"// # %d", fLocalId);
1105 Printf(
"// status: %s, attached: %s (remote ID: %d)",st[fStatus+1], (fProof ?
"YES" :
"NO"), fRemoteId);
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual const char * GetName() const
Returns name of object.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
static TProofMgr_t fgTXProofMgrHook
Bool_t MatchId(Int_t id) const
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.
static constexpr double pi
R__EXTERN Int_t gErrorIgnoreLevel
void SetProtocol(const char *proto, Bool_t setDefaultPort=kFALSE)
Set protocol and, optionally, change the port accordingly.
Collectable string class.
This class represents a WWW compatible URL.
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.
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...
const char * GetProtocol() const
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
TProof * GetProof() const
The PROOF manager interacts with the PROOF server coordinator to create or destroy a PROOF session...
void SetUrl(const char *url, Bool_t defaultIsFile=kFALSE)
Parse url character string and split in its different subcomponents.
virtual ~TProofMgr()
Destroy a TProofMgr instance.
virtual Int_t GetEntries() const
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Regular expression class.
const char * GetName() const
Returns name of object.
static constexpr double cm
void SetVal(const AParamType &val)
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
R__EXTERN TVirtualMutex * gROOTMutex
virtual Bool_t MatchUrl(const char *url)
Checks if 'url' refers to the same 'user:port' entity as the URL in memory.
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
Bool_t R_ISREG(Int_t mode)
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
Int_t GetSessionID() const
virtual void DiscardSession(TProof *p)
Discard TProofDesc of session 'p' from the internal list.
virtual void DetachSession(Int_t, Option_t *="")
Detach session with 'id' from its proofserv.
virtual Bool_t Cp(const char *dst, Bool_t progressbar=kTRUE, UInt_t buffersize=1000000)
Allows to copy this file to the dst URL.
const char * GetFile() const
const char * GetHost() const
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual int Unlink(const char *name)
Unlink, i.e. remove, a file.
UShort_t net2host(UShort_t x)
virtual const char * ClassName() const
Returns name of class to which the object belongs.
static TList * GetListOfManagers()
Extract pointers to PROOF managers from TROOT::fProofs.
virtual Bool_t IsProofd() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Basic TProofMgr functionality implementation in the case of Lite session.
The TNamed class is the base class for all named ROOT classes.
TUrl * GetFirstUrl() const
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 .
const char * GetGroup() const
Double_t Log10(Double_t x)
static TProofMgr_t GetXProofMgrHook()
Get the constructor hook fro TXProofMgr.
const char * GetSessionTag() const
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
virtual TProofDesc * GetProofDesc(Int_t id)
Get TProofDesc instance corresponding to 'id'.
void Error(const char *location, const char *msgfmt,...)
static constexpr double second
virtual TProof * AttachSession(Int_t, Bool_t=kFALSE)
Dummy version provided for completeness.
const char * GetUser() const
const char * GetName() const
Returns name of object.
Named parameter, streamable and storable.
virtual void SetAlias(const char *alias="")
TSignalHandler * fIntHandler
TProofMgr *(* TProofMgr_t)(const char *, Int_t, const char *)
R__EXTERN TSystem * gSystem
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'.
virtual TProof * CreateSession(const char *=0, const char *=0, Int_t=-1)
Create a new remote session (master and associated workers).
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
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.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
virtual const char * GetUrl()
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 TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
static constexpr double nm
virtual void FreeDirectory(void *dirp)
Free a directory.
void Print(Option_t *opt="") const
Dump the content to the screen.
virtual Int_t SendMsgToUsers(const char *, const char *=0)
Send a message to connected users.
virtual void ShowWorkers()
Show available workers.
void SetHost(const char *host)
TString & Remove(Ssiz_t pos)
R__EXTERN TProof * gProof
Ssiz_t Last(char c) const
Find last occurrence of a character c.
char * DynamicPathName(const char *lib, Bool_t quiet=kFALSE)
Find a dynamic library called lib using the system search paths.
static TList fgListOfManagers
This class controls a Parallel ROOT Facility, PROOF, cluster.
virtual Bool_t IsValid() const
void Detach(Option_t *opt="")
Detach this instance to its proofserv.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
static constexpr double s
#define R__LOCKGUARD(mutex)
static void SetTXProofMgrHook(TProofMgr_t pmh)
Set hook to TXProofMgr ctor.
Mother of all ROOT objects.
std::istream & ReadToDelim(std::istream &str, char delim='\n')
Read up to an EOF, or a delimiting character, whichever comes first.
static void ReplaceSubdirs(const char *fn, TString &fdst, TList &dirph)
Parse file name extracting the directory subcomponents in dirs, stored as TObjStrings.
Bool_t R_ISDIR(Int_t mode)
virtual int GetServiceByName(const char *service)
Get port # of internet service.
virtual void Add(TObject *obj)
virtual TList * QuerySessions(Option_t *opt="S")
Get list of sessions accessible to this manager.
Class that contains a list of TFileInfo's and accumulated meta data information about its entries...
#define dest(otri, vertexptr)
void SetOptions(const char *opt)
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
const AParamType & GetVal() const
Class describing a generic file including meta information.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
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 Int_t GetSize() const
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
UShort_t host2net(UShort_t x)
void AbstractMethod(const char *method) const
Use this method to implement an "abstract" method that you don't want to leave purely abstract...
static constexpr double ns
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual const char * GetTitle() const
Returns title of object.
const char * Data() const