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");
147 return d->GetProof();
149 Warning(
"AttachSession",
"session not available - do nothing");
162 Warning(
"DetachSession",
"invalid TProofMgr - do nothing");
171 d->GetProof()->Detach(opt);
178 }
else if (
id == 0) {
187 d->GetProof()->Detach(opt);
206 Warning(
"DetachSession",
"invalid TProofMgr - do nothing");
216 d->GetProof()->Detach(opt);
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");
354 if (p ==
d->GetProof())
373 if (p ==
d->GetProof()) {
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)
508 if (
proto.IsNull()) {
513 if (
proto ==
"lite" || host ==
"__lite__" ) {
520 ::Info(
"TProofMgr::Create",
"'lite' not yet supported on Windows");
535 const char *url = u.
GetUrl();
543 if (
m->MatchUrl(url))
return m;
566 trystd = (
m && !(
m->IsValid()) &&
m->IsProofd()) ?
kTRUE :
kFALSE;
579 if (
m->IsValid() && !(
m->IsProofd())) {
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"));
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!");
823 while (dst.Tokenize(dt, from,
"/")) {
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")) {
862 "object of class name '%s' does not cast to %s - ignore",
869 "object of unsupported class '%s' found in list - ignore", o->
ClassName());
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);
1022 line.ReadToDelim(
f);
1025 if (
line.BeginsWith(
"#"))
continue;
1031 ::Error(
"TProofMgr::UploadFiles",
"unable to open file '%s'", srcfiles);
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"};
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
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
Delete a TObjLink object.
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 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 second
static constexpr double nm
static constexpr double s
static constexpr double pi
static constexpr double cm
static constexpr double ns
Double_t Log10(Double_t x)
#define dest(otri, vertexptr)