Attaches to a PROOF session, possibly at the indicated URL.
If no existing PROOF session is found and no URL is given, try to start a local PROOF session.
Arguments: 'url' URL of the master where to start/attach the PROOF session; this is also the place where to force creation of a new session, if needed (use option 'N', e.g. "proof://mymaster:myport/?N")
The following arguments apply to xrootd responding at 'refloc' only: 'nwrks' Number of workers to be started. [] 'dir' Directory to be used for the files and working areas []. When starting a new instance of the daemon this directory is cleaned with 'rm -fr'. If 'dir' is null, the default is used: /tmp/<user>/.getproof
'opt' Defines what to do if an existing xrootd uses the same ports; possible options are: "ask", ask the user; "force", kill the xrootd and start a new one; if any other string is specified the existing xrootd will be used ["ask"]. NB: for a change in 'nwrks' to be effective you need to specify opt = "force" 'dyn' This flag can be used to switch on dynamic, per-job worker setup scheduling [kFALSE]. 'tutords' This flag can be used to force a dataset dir under the tutorial dir [kFALSE]
It is possible to trigger the automatic valgrind setup by defining the env GETPROOF_VALGRIND. E.g. to run the master in valgrind do
(or $ export GETPROOF_VALGRIND="valgrind=master valgrind_opts:--leak-check=full"
to set some options) before running getProof. Note that 'getProof' is also called by 'stressProof', so this holds for 'stressProof' runs too.
#include "Getline.h"
typedef struct {
int first;
int second;
int third;
int fourth;
int fifth;
typedef struct {
int msglen;
int protover;
int msgval;
const char *
refloc =
"proof://localhost:40000";
{
#ifndef WIN32
while (s.Tokenize(t, from , " ")) {
else
}
if (
vopts.IsNull())
vopts =
"valgrind_opts:--leak-check=full --track-origins=yes";
Printf(
"getProof: valgrind run: '%s' (opts: '%s')",
vopt.Data(),
vopts.Data());
}
#endif
if (!
url[0])
uu.SetUrl(
"lite://");
}
Printf(
"getProof: trying to open a PROOF-Lite session with %s",
swrk.Data());
} else {
Printf(
"getProof: trying to open a session on the external cluster at '%s'",
url);
}
Printf(
"getProof: WARNING: started/attached a session on external cluster (%s):"
}
Printf(
"getProof: WARNING: started/attached a session on external cluster (%s):"
" 'dir=\"%s\"' ignored",
url, dir);
}
Printf(
"getProof: WARNING: started/attached a session on external cluster (%s):"
" 'opt=\"force\"' ignored",
url);
}
Printf(
"getProof: WARNING: started/attached a session on external cluster (%s):"
" 'dyn=kTRUE' ignored",
url);
}
} else {
Printf(
"getProof: could not get/start a valid session at %s",
url);
}
}
#ifdef WIN32
Printf(
"getProof: local PROOF not yet supported on Windows, sorry!");
#else
Printf(
"getProof: unable to create the working area at the requested path: '%s'"
" - cannot continue",
tutdir.Data());
} else {
Printf(
"getProof: working area at the requested path '%s'"
" created but it is not writable - cannot continue",
tutdir.Data());
}
}
} else {
Printf(
"getProof: working area at the requested path '%s'"
" exists but is not writable - cannot continue",
tutdir.Data());
}
}
} else {
Printf(
"getProof: working area not specified temp ");
Printf(
"getProof: could not get user info");
}
us.
Form(
"/%s",
ug->fUser.Data());
Printf(
"getProof: unable to get a writable working area (tried: %s)"
" - cannot continue",
tutdir.Data());
}
}
}
Printf(
"getProof: working area (tutorial dir): %s",
tutdir.Data());
Printf(
"getProof: unable to get a writable dataset directory (tried: %s)"
}
}
}
Printf(
"getProof: something else the a XProofd service is running on"
" port %d - cannot continue",
lportp);
Printf(
"getProof: daemon found listening on dedicated ports {%d,%d} (pid: %d)",
} else {
char *
answer = (
char *)
Getline(
"getProof: would you like to restart it (N,Y)? [N] ");
}
}
Printf(
"getProof: cleaning existing instance ...");
Printf(
"getProof: problems stopping xrootd process %d (%d)", pid,
rc);
Printf(
"getProof: wait 5 secs so that previous connections are cleaned ...");
}
}
Printf(
"getProof: xproofd not found: please check the environment!");
}
Printf(
"getProof: could not create config file for XPD (%s)",
xpdcf.Data());
}
fprintf(
fcf,
"### Use admin path at %s/admin to avoid interferences with other users\n",
tutdir.Data());
#if defined(R__MACOSX)
fprintf(
fcf,
"### Use dedicated socket path under /tmp to avoid length problems\n");
#endif
fprintf(
fcf,
"xrd.protocol xproofd libXrdProofd.so\n");
fprintf(
fcf,
"### Force number of local workers\n");
}
fprintf(
fcf,
"### Allow different users to connect\n");
fprintf(
fcf,
"### Limit the number of query results kept in the master sandbox\n");
fprintf(
fcf,
"xpd.putrc ProofServ.UserQuotas: maxquerykept=2\n");
fprintf(
fcf,
"### Limit the number of sessions kept in the sandbox\n");
fprintf(
fcf,
"xpd.putrc Proof.MaxOldSessions: 1\n");
fprintf(
fcf,
"### Use dataset directory under the tutorial dir\n");
}
fprintf(
fcf,
"### Use dynamic, per-job scheduling\n");
fprintf(
fcf,
"xpd.putrc Proof.DynamicStartup 1\n");
}
fprintf(
fcf,
"### For internal file serving use the xrootd protocol on the same port\n");
fprintf(
fcf,
"### Set the local data server for the temporary output files accordingly\n");
Printf(
"getProof: xproofd config file at %s",
xpdcf.Data());
cmd =
Form(
"%s -c %s -b -l %s -n xpdtut -p %d",
Printf(
"(NB: any error line from XrdClientSock::RecvRaw and XrdClientMessage::ReadRaw should be ignored)");
Printf(
"getProof: problems starting xproofd (%d)",
rc);
}
Printf(
"getProof: waiting for xproofd to start ...");
Printf(
"getProof: xproofd pid: %d", pid);
Printf(
"getProof: could not create pid file for XPD");
} else {
}
}
Printf(
"getProof: start / attach the PROOF session ...");
if (!
p || !(
p->IsValid())) {
Printf(
"getProof: starting local session failed");
}
#endif
}
{
#ifdef WIN32
Printf(
"getXrootdPid: Xrootd/Proof not supported on Windows, sorry!");
return -1;
#else
#if defined(__sun)
const char *
com =
"-eo pid,comm";
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
const char *
com =
"ax -w -w";
#else
const char *
com =
"-w -w -eo pid,command";
#endif
cmd.Form(
"ps %s | grep xrootd | grep \"\\-p %d\" | grep %s",
com, port,
subdir);
} else {
cmd.Form(
"ps %s | grep xrootd | grep \"\\-p %d\"",
com, port);
}
if (fp) {
char line[2048], rest[2048];
break;
}
}
return pid;
#endif
}
{
if (!(s.IsValid())) {
Printf(
"checkXrootdAt: could not open connection to %s:%d", host, port);
return -1;
}
Printf(
"checkXrootdAt: 1st: wrong number of bytes read: %d (expected: %d)",
return 1;
}
Printf(
"checkXrootdAt: 2nd: wrong number of bytes read: %d (expected: %d)",
return 1;
}
Printf(
"checkXrootdAt: server is ROOTD");
return 1;
} else {
Printf(
"checkXrootdAt: unknown server type: %d",
type);
return 1;
}
return 0;
}
{
if (!(s.IsValid())) {
Printf(
"checkXproofdAt: could not open connection to %s:%d", host, port);
return -1;
}
s.SendRaw(&
dum[0],
sizeof(
dum));
Printf(
"checkXproofdAt: 1st: wrong number of bytes read: %d (expected: %d)",
return 1;
}
Printf(
"checkXproofdAt: 2nd: wrong number of bytes read: %d (expected: %d)",
return 1;
}
Printf(
"checkXproofdAt: server is PROOFD");
return 1;
} else {
Printf(
"checkXproofdAt: unknown server type: %d",
type);
return 1;
}
return 0;
}
{
#ifdef WIN32
Printf(
"startXrootdAt: Xrootd not supported on Windows, sorry!");
return -1;
#else
Printf(
"startXrootdAt: some other service running on port %d - cannot proceed ", port);
return -1;
} else {
Printf(
"startXrootdAt: xrootd service already available on port %d: ", port);
char *
answer = (
char *)
Getline(
"startXrootdAt: would you like to restart it (N,Y)? [N] ");
}
}
Printf(
"startXrootdAt: cleaning existing instance ...");
Printf(
"startXrootdAt: problems stopping xrootd process %d (%d)", pid,
rc);
}
}
Printf(
"startXrootdAt: could not assert dir for log file");
return -1;
}
}
cmd.Form(
"xrootd -d -p %d -b -l /tmp/xrd-basic/xrootd.log", port);
while (
dirs.Tokenize(
d, from,
" ")) {
}
}
}
Printf(
"startXrootdAt: problems executing starting command (%d)",
rc);
return -1;
}
Printf(
"startXrootdAt: waiting for xrootd to start ...");
Printf(
"startXrootdAt: xrootd service not available at %d (rc = %d) - startup failed",
return -1;
}
Printf(
"startXrootdAt: basic xrootd started!");
}
return 0;
#endif
}
{
#ifdef WIN32
Printf(
"killXrootdAt: Xrootd not supported on Windows, sorry!");
return -1;
#else
Printf(
"killXrootdAt: problems stopping xrootd process %d (%d)", pid,
rc);
}
#endif
}
{
int from = 0;
while (
sws.Tokenize(
sw, from ,
"|")) {
if (
sw.BeginsWith(
"k"))
sw.Remove(0,1);
}
else if (
sw ==
"Packetizer") {
}
else if (
sw ==
"Loop") {
}
else if (
sw ==
"Selector") {
}
else if (
sw ==
"Output") {
}
else if (
sw ==
"Input") {
}
else if (
sw ==
"Global") {
}
else if (
sw ==
"Package") {
}
else if (
sw ==
"Feedback") {
}
else if (
sw ==
"Condor") {
}
else if (
sw ==
"Draw") {
}
else if (
sw ==
"Asyn") {
}
else if (
sw ==
"Cache") {
}
else if (
sw ==
"Collect") {
}
else if (
sw ==
"Dataset") {
}
else if (
sw ==
"Submerger") {
}
else if (
sw ==
"Monitoring") {
}
else if (
sw ==
"All") {
}
else if (!
sw.IsNull()) {
Printf(
"WARNING: requested debug enum name '%s' does not exist: assuming 'All'",
sw.Data());
}
}
}
UShort_t host2net(UShort_t x)
UShort_t net2host(UShort_t x)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
R__EXTERN TSystem * gSystem
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
Set the value of a resource or create a new resource.
This class controls a Parallel ROOT Facility, PROOF, cluster.
static TProof * Open(const char *url=0, const char *conffile=0, const char *confdir=0, Int_t loglevel=0)
Start a PROOF session on a specific cluster.
static void AddEnvVar(const char *name, const char *value)
Add an variable to the list of environment variables passed to proofserv on the master and slaves.
const char * Data() const
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 const char * Getenv(const char *env)
Get environment variable.
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
virtual FILE * OpenPipe(const char *command, const char *mode)
Open a pipe.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual int ClosePipe(FILE *pipe)
Close the pipe.
virtual const char * HostName()
Return the system's host name.
virtual Int_t GetUid(const char *user=nullptr)
Returns the user's id. If user = 0, returns current user's id.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
This class represents a WWW compatible URL.