32 #include "RConfigure.h"
41 #include <netinet/in.h>
43 #include <sys/types.h>
65 #include "compiledata.h"
88 fServ->HandleUrgentData();
111 fServ->HandleSigPipe();
131 Printf(
"TProofServLiteTerminationHandler::Notify: wake up!");
133 fServ->HandleTermination();
154 Printf(
"**** Segmentation violation: terminating ****");
156 fServ->HandleTermination();
163 class TProofServLiteInputHandler :
public TFileHandler {
177 fServ->HandleSocketInput();
209 Info(
"CreateServer",
"starting server creation");
215 Error(
"CreateServer",
"resolving the log file description number");
223 Error(
"CreateServer",
"Socket setup by xpd undefined");
233 Error(
"CreateServer",
"Failed to open connection to the client");
257 Info(
"CreateServer",
"Service: %s, ConfDir: %s, IsMaster: %d",
346 snprintf(str, 512,
"**** Welcome to the PROOF server @ %s ****",
gSystem->
HostName());
348 snprintf(str, 512,
"**** PROOF worker server @ %s started ****",
gSystem->
HostName());
352 Error(
"Setup",
"failed to send proof server startup message");
358 Error(
"Setup",
"remote proof protocol missing");
379 if (fTopSessionTag.IsNull()) fTopSessionTag =
fSessionTag;
388 Error(
"Setup",
"Session dir missing");
410 Error(
"Setup",
"common setup failed");
441 Info(
"Terminate",
"starting session termination operations ...");
466 Printf(
"Terminate: termination operations ended: quitting!");
475 Error(
"HandleFork",
"empty message!");
483 Info(
"HandleFork",
"cloning to %s", clones.Data());
487 while (clones.Tokenize(clone, from,
" ")) {
491 if ((rc =
Fork()) < 0) {
492 Error(
"HandleFork",
"failed to fork %s", clone.Data());
514 Info(
"SetupOnFork",
"finalizing setup of %s", ord);
548 Info(
"SetupOnFork",
"unlinking: %s", ent.
Data());
571 Error(
"CreateServer",
"Socket setup by xpd undefined");
581 Error(
"CreateServer",
"Failed to open connection to the client");
605 Info(
"SetupOnFork",
"Service: %s, ConfDir: %s, IsMaster: %d",
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual Long_t ProcessLine(const char *line, Bool_t sync=kFALSE, Int_t *error=0)
Process a single command line, either a C++ statement or an interpreter command starting with a "...
virtual int GetPid()
Get process id.
Version of the PROOF worker server for local running.
void HandleSigPipe()
Called when the client is not alive anymore; terminate the session.
Int_t SetupCommon()
Common part (between TProofServ and TXProofServ) of the setup phase.
virtual Bool_t IsValid() const
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
virtual Int_t SetOption(ESockOptions opt, Int_t val)
Set socket options.
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.
Int_t Setup()
Print the ProofServ logo on standard output.
Bool_t UnlinkDataDir(const char *path)
Scan recursively the datadir and unlink it if empty Return kTRUE if it can be unlinked, kFALSE otherwise.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
const char *const kPROOF_WorkDir
virtual int MakeDirectory(const char *name)
Make a directory.
virtual void AddSignalHandler(TSignalHandler *sh)
Add a signal handler to list of system signal handlers.
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
TString & Insert(Ssiz_t pos, const char *s)
virtual Int_t GetDescriptor() const
static const char * GetMacroPath()
Get macro search path. Static utility function.
const char * Data() 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.
Int_t CreateServer()
Finalize the server setup.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
static volatile Int_t gProofServDebug
virtual const char * Getenv(const char *env)
Get environment variable.
virtual void ExitLoop()
Exit from event loop.
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
void FlushLogFile()
Reposition the read pointer in the log file to the very end.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Int_t SetupOnFork(const char *ord)
Finalize the server setup afetr forking.
virtual Int_t Fork()
Fork a child.
const char Int_t const char TProof Int_t const char * workdir
TProofServLite(Int_t *argc, char **argv, FILE *flog=0)
Main constructor.
virtual void Setenv(const char *name, const char *value)
Set environment variable.
R__EXTERN TSystem * gSystem
Class providing the PROOF server.
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
TProofServLiteInterruptHandler * fInterruptHandler
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
void HandleFork(TMessage *mess)
Cloning itself via fork.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
virtual void FreeDirectory(void *dirp)
Free a directory.
TString & Remove(Ssiz_t pos)
virtual TSignalHandler * RemoveSignalHandler(TSignalHandler *sh)
Remove a signal handler from list of signal handlers.
virtual ~TProofServLite()
Cleanup.
virtual void SendLogFile(Int_t status=0, Int_t start=-1, Int_t end=-1)
Send log file to master.
virtual const char * HostName()
Return the system's host name.
virtual int Symlink(const char *from, const char *to)
Create a symbolic link from file1 to file2.
ClassImp(TProofServLite) extern"C"
void Terminate(Int_t status)
Terminate the proof server.
The TTimeStamp encapsulates seconds and ns since EPOCH.
void HandleTermination()
Called when the client is not alive anymore; terminate the session.
void Throw(int code)
If an exception context has been set (using the TRY and RETRY macros) jump back to where it was set...
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
R__EXTERN Int_t gProofDebugLevel
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
void RedirectOutput(const char *dir=0, const char *mode="w")
Redirect stdout to a log file.
virtual void AddFileHandler(TFileHandler *fh)
Add a file handler to the list of system file handlers.
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual Long_t ProcessFile(const char *file, Int_t *error=0, Bool_t keep=kFALSE)
Process a file containing a C++ macro.