library: libProof #include "TProof.h"

# TProof

class description - source file - inheritance tree (.ps)

## class TProof : public TVirtualProof

| Inheritance Chart:

`TObject`

`TQObject`

<-

`TVirtualProof`

<-

`TProof`

        private:

                        TProof()
                        TProof(const TProof&)
                   void ActivateAsyncInput()
                   void AskStatus()
                  Int_t Broadcast(const TMessage& mess, TList* slaves)
                  Int_t Broadcast(const TMessage& mess, TProof::ESlaves list = kActive)
                  Int_t Broadcast(const char* mess, Int_t kind, TList* slaves)
                  Int_t Broadcast(const char* mess, Int_t kind = kMESS_STRING, TProof::ESlaves list = kActive)
                  Int_t Broadcast(Int_t kind, TList* slaves)
                  Int_t Broadcast(Int_t kind, TProof::ESlaves list = kActive)
                  Int_t BroadcastObject(const TObject* obj, Int_t kind, TList* slaves)
                  Int_t BroadcastObject(const TObject* obj, Int_t kind = kMESS_OBJECT, TProof::ESlaves list = kActive)
                  Int_t BroadcastRaw(const void* buffer, Int_t length, TList* slaves)
                  Int_t BroadcastRaw(const void* buffer, Int_t length, TProof::ESlaves list = kActive)
                  Int_t BuildPackage(const char* package)
                 Long_t CheckFile(const char* file, TSlave* sl)
                  Int_t Collect(TList* slaves)
                  Int_t Collect(TProof::ESlaves list = kActive)
                  Int_t Collect(const TSlave* sl)
                  Int_t Collect(TMonitor* mon)
                   void DeActivateAsyncInput()
                  Int_t Exec(const char* cmd, TProof::ESlaves list)
                TSlave* FindSlave(TSocket* s) const
                   void FindUniqueSlaves()
                 TList* GetListOfActiveSlaves() const
                 TList* GetListOfBadSlaves() const
                 TList* GetListOfSlaves() const
                 TList* GetListOfUniqueSlaves() const
                  Int_t GetNumberOfActiveSlaves() const
                  Int_t GetNumberOfBadSlaves() const
                  Int_t GetNumberOfSlaves() const
                  Int_t GetNumberOfUniqueSlaves() const
          TProofPlayer* GetPlayer() const
                  Int_t GoParallel(Int_t nodes)
                   void HandleAsyncInput(TSocket* s)
                  Int_t Init(const char* masterurl, const char* conffile, const char* confdir, Int_t loglevel)
                   void Interrupt(TProof::EUrgent type, TProof::ESlaves list = kActive)
                  Int_t LoadPackage(const char* package)
                   void MarkBad(TSlave* sl)
                   void MarkBad(TSocket* s)
                   void operator=(const TProof&)
                  Int_t Ping(TProof::ESlaves list)
                   void RecvLogFile(TSocket* s, Int_t size)
                  Int_t SendCommand(const char* cmd, TProof::ESlaves list = kActive)
                  Int_t SendCurrentState(TProof::ESlaves list = kActive)
                  Int_t SendFile(const char* file, Bool_t bin = kTRUE)
                  Int_t SendGroupView()
                  Int_t SendInitialState()
                  Int_t SendObject(const TObject* obj, TProof::ESlaves list = kActive)
                  Int_t SendPrint(Option_t* option)
                   void SetPlayer(TProofPlayer* player)

        public:

                              TProof(const char* masterurl, const char* conffile = "kPROOF_ConfFile", const char* confdir = "kPROOF_ConfDir", Int_t loglevel = 0)
                      virtual ~TProof()
                 virtual void AddInput(TObject* obj)
               static TClass* Class()
                 virtual void ClearCache()
                 virtual void ClearInput()
                 virtual void ClearPackage(const char* package)
                 virtual void ClearPackages()
                 virtual void Close(Option_t* option)
                virtual Int_t DrawSelect(TDSet* set, const char* varexp, const char* selection, Option_t* option, Long64_t nentries = -1, Long64_t firstentry = 0)
                virtual Int_t EnablePackage(const char* package)
                virtual Int_t Exec(const char* cmd)
                 virtual void Feedback(TList* objs)
             virtual Double_t GetBytesRead() const
                virtual Int_t GetClientProtocol() const
          virtual const char* GetConfDir() const
          virtual const char* GetConfFile() const
              virtual Float_t GetCpuTime() const
          virtual const char* GetImage() const
                virtual Int_t GetLogLevel() const
          virtual const char* GetMaster() const
             virtual TObject* GetOutput(const char* name)
               virtual TList* GetOutputList()
                virtual Int_t GetParallel() const
                virtual Int_t GetPort() const
              virtual Float_t GetRealTime() const
                virtual Int_t GetRemoteProtocol() const
                        Int_t GetSecurity() const
               virtual TList* GetSlaveInfo()
                virtual Int_t GetStatus() const
                  const char* GetUrlProtocol() const
          virtual const char* GetUser() const
          virtual const char* GetWorkDir() const
              virtual TClass* IsA() const
               virtual Bool_t IsMaster() const
               virtual Bool_t IsParallel() const
               virtual Bool_t IsValid() const
                virtual Int_t Ping()
                 virtual void Print(Option_t* option) const
                virtual Int_t Process(TDSet* set, const char* selector, Option_t* option, Long64_t nentries = -1, Long64_t firstentry = 0, TEventList* evl = 0)
                 virtual void Progress(Long64_t total, Long64_t processed)
                 virtual void SetActive(Bool_t active = kTRUE)
                 virtual void SetLogLevel(Int_t level, UInt_t mask = TProofDebug::kAll)
                virtual Int_t SetParallel(Int_t nodes = 9999)
                 virtual void ShowCache(Bool_t all = kFALSE)
                 virtual void ShowEnabledPackages(Bool_t all = kFALSE)
                 virtual void ShowMembers(TMemberInspector& insp, char* parent)
                 virtual void ShowPackages(Bool_t all = kFALSE)
                 virtual void StopProcess(Bool_t abort)
                 virtual void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)
                virtual Int_t UploadPackage(const char* par, Int_t parallel = 1)

### Data Members

        private:

                                                                                                 Bool_t fValid           is this a valid proof object
                                                                                                TString fMaster          name of master server (use "" if this is a master)
                                                                                                TString fConfDir         directory containing cluster config information
                                                                                                TString fConfFile        file containing config information
                                                                                                TString fWorkDir         current work directory on remote servers
                                                                                                TString fUser            user under which to run
                                                                                                TString fImage           master's image name
                                                                                                TString fUrlProtocol     net protocol name
                                                                                                  Int_t fPort            port we are connected to (proofd = 1093)
                                                                                           TSecContext* fSecContext      SecContext of the related authentication
                                                                                                  Int_t fProtocol        remote PROOF server protocol version number
                                                                                                  Int_t fLogLevel        server debug logging level
                                                                                                  Int_t fStatus          remote return status (part of kPROOF_LOGDONE)
                                                                                                  Int_t fParallel        number of active slaves (only set on client, on server use fActiveSlaves)
                                                                                                 TList* fSlaveInfo       !list returned by kPROOF_GETSLAVEINFO
                                                                                                 Bool_t fMasterServ      true if we are a master server
                                                                                                 Bool_t fSendGroupView   if true send new group view
                                                                                                 TList* fSlaves          list of all slave servers as in config file
                                                                                                 TList* fActiveSlaves    list of active slaves (subset of all slaves)
                                                                                                 TList* fUniqueSlaves    list of all active slaves with unique file systems
                                                                                                 TList* fBadSlaves       dead slaves (subset of all slaves)
                                                                                              TMonitor* fAllMonitor      monitor activity on all valid slave sockets
                                                                                              TMonitor* fActiveMonitor   monitor activity on all active slave sockets
                                                                                              TMonitor* fUniqueMonitor   monitor activity on all unique slave sockets
                                                                                               Double_t fBytesRead       bytes read by all slaves during the session
                                                                                                Float_t fRealTime        realtime spent by all slaves during the session
                                                                                                Float_t fCpuTime         CPU time spent by all slaves during the session
                                                                                        TSignalHandler* fIntHandler      interrupt signal handler (ctrl-c)
                                                                                        TPluginHandler* fProgressDialog  progress dialog plugin
                                                                                          TProofPlayer* fPlayer          current player
                                                                                               TCondor* fCondor          proxy for our Condor pool
          map<TString,TProof::MD5Mod_t,less<TString>,allocator<pair<const TString,TProof::MD5Mod_t> > > fFileMap         map keeping track of a file's md5 and mod time

        public:

          static const TProof::ESlaves kAll
          static const TProof::ESlaves kActive
          static const TProof::ESlaves kUnique
          static const TProof::EUrgent kHardInterrupt
          static const TProof::EUrgent kSoftInterrupt
          static const TProof::EUrgent kShutdownInterrupt

## Class Description

     TProof

     This class controls a Parallel ROOT Facility, PROOF, cluster.
     It fires the slave servers, it keeps track of how many slaves are
     running, it keeps track of the slaves running status, it broadcasts
     messages to all slaves, it collects results, etc.

TProof(const char *masterurl, const char *conffile, const char *confdir, Int_t loglevel)

     Create a PROOF environment. Starting PROOF involves either connecting
     to a master server, which in turn will start a set of slave servers, or
     directly starting as master server (if master = ""). Masterurl is of
     the form: proof://host[:port] or proofs://host[:port]. Conffile is
     the name of the config file describing the remote PROOF cluster
     (this argument alows you to describe different cluster configurations).
     The default is proof.conf. Confdir is the directory where the config
     file and other PROOF related files are (like motd and noproof files).
     Loglevel is the log level (default = 1).

~TProof()

     Clean up PROOF environment.

Int_t Init(const char *masterurl, const char *conffile, const char *confdir, Int_t loglevel)

     Start the PROOF environment. Starting PROOF involves either connecting
     to a master server, which in turn will start a set of slave servers, or
     directly starting as master server (if master = ""). For a description
     of the arguments see the TProof ctor. Returns the number of started
     master or slave servers, returns 0 in case of error, in which case
     fValid remains false.

void Close(Option_t *)

     Close all open slave servers.

TSlave* FindSlave(TSocket *s) const

     Find slave that has TSocket s. Returns 0 in case slave is not found.

void FindUniqueSlaves()

     Add to the fUniqueSlave list the active slaves that have a unique
     (user) file system image. This information is used to transfer files
     only once to nodes that share a file system (an image).

Int_t GetNumberOfSlaves() const

     Return number of slaves as described in the config file.

Int_t GetNumberOfActiveSlaves() const

     Return number of active slaves, i.e. slaves that are valid and in
     the current computing group.

Int_t GetNumberOfUniqueSlaves() const

     Return number of unique slaves, i.e. active slaves that have each a
     unique different user files system.

Int_t GetNumberOfBadSlaves() const

     Return number of bad slaves. This are slaves that we in the config
     file, but refused to startup or that died during the PROOF session.

void AskStatus()

     Ask the status of the slaves.

void Interrupt(EUrgent type, ESlaves list)

     Send interrupt OOB byte to master or slave servers.

Int_t GetParallel() const

     Returns number of slaves active in parallel mode. Returns 0 in case
     there are no active slaves. Returns -1 in case of error.

TList* GetSlaveInfo()

     Returns number of slaves active in parallel mode. Returns 0 in case
     there are no active slaves. Returns -1 in case of error.

Int_t Broadcast(const TMessage &mess, TList *slaves)

     Broadcast a message to all slaves in the specified list. Returns
     the number of slaves the message was successfully sent to.
     Returns -1 in case of error.

Int_t Broadcast(const TMessage &mess, ESlaves list)

     Broadcast a message to all slaves in the specified list (either
     all slaves or only the active slaves). Returns the number of slaves
     the message was successfully sent to. Returns -1 in case of error.

Int_t Broadcast(const char *str, Int_t kind, TList *slaves)

     Broadcast a character string buffer to all slaves in the specified
     list. Use kind to set the TMessage what field. Returns the number of
     slaves the message was sent to. Returns -1 in case of error.

Int_t Broadcast(const char *str, Int_t kind, ESlaves list)

     Broadcast a character string buffer to all slaves in the specified
     list (either all slaves or only the active slaves). Use kind to
     set the TMessage what field. Returns the number of slaves the message
     was sent to. Returns -1 in case of error.

Int_t BroadcastObject(const TObject *obj, Int_t kind, TList *slaves)

     Broadcast an object to all slaves in the specified list. Use kind to
     set the TMEssage what field. Returns the number of slaves the message
     was sent to. Returns -1 in case of error.

Int_t BroadcastObject(const TObject *obj, Int_t kind, ESlaves list)

     Broadcast an object to all slaves in the specified list. Use kind to
     set the TMEssage what field. Returns the number of slaves the message
     was sent to. Returns -1 in case of error.

Int_t BroadcastRaw(const void *buffer, Int_t length, TList *slaves)

     Broadcast a raw buffer of specified length to all slaves in the
     specified list. Returns the number of slaves the buffer was sent to.
     Returns -1 in case of error.

Int_t BroadcastRaw(const void *buffer, Int_t length, ESlaves list)

     Broadcast a raw buffer of specified length to all slaves in the
     specified list. Returns the number of slaves the buffer was sent to.
     Returns -1 in case of error.

Int_t Collect(const TSlave *sl)

     Collect responses from slave sl. Returns the number of slaves that
     responded (=1).

Int_t Collect(TList *slaves)

     Collect responses from the slave servers. Returns the number of slaves
     that responded.

Int_t Collect(ESlaves list)

     Collect responses from the slave servers. Returns the number of slaves
     that responded.

Int_t Collect(TMonitor *mon)

     Collect responses from the slave servers. Returns the number of messages
     received. Can be 0 if there are no active slaves.

void ActivateAsyncInput()

     Activate the a-sync input handler.

void DeActivateAsyncInput()

     De-actiate a-sync input handler.

void HandleAsyncInput(TSocket *sl)

     Handle input coming from the master server (when this is a client)
     or from a slave server (when this is a master server). This is mainly
     for a-synchronous communication. Normally when PROOF issues a command
     the (slave) server messages are directly handle by Collect().

void MarkBad(TSlave *sl)

     Add a bad slave server to the bad slave list and remove it from
     the active list and from the two monitor objects.

void MarkBad(TSocket *s)

     Add slave with socket s to the bad slave list and remove if from
     the active list and from the two monitor objects.

Int_t Ping()

     Ping PROOF. Returns 1 if master server responded.

Int_t Ping(ESlaves list)

     Ping PROOF slaves. Returns the number of slaves that responded.

void Print(Option_t *option) const

     Print status of PROOF cluster.

Int_t Process(TDSet *set, const char *selector, Option_t *option, Long64_t nentries, Long64_t first, TEventList *evl)

     Process a data set (TDSet) using the specified selector (.C) file.
     Returns -1 in case of error, 0 otherwise.

Int_t DrawSelect(TDSet *set, const char *varexp, const char *selection, Option_t *option, Long64_t nentries, Long64_t first)

     Process a data set (TDSet) using the specified selector (.C) file.
     Returns -1 in case of error, 0 otherwise.

void StopProcess(Bool_t abort)

void AddInput(TObject *obj)

     Add objects that might be needed during the processing of
     the selector (see Process()).

void ClearInput()

     Clear input object list.

TObject* GetOutput(const char *name)

     Get specified object that has been produced during the processing
     (see Process()).

TList* GetOutputList()

     Get list with all object created during processing (see Process()).

void RecvLogFile(TSocket *s, Int_t size)

     Receive the log file of the slave with socket s.

Int_t SendGroupView()

     Send to all active slaves servers the current slave group size
     and their unique id. Returns number of active slaves.
     Returns -1 in case of error.

Int_t Exec(const char *cmd)

     Send command to be executed on the PROOF master and/or slaves.
     Command can be any legal command line command. Commands like
     ".x file.C" or ".L file.C" will cause the file file.C to be send
     to the PROOF cluster. Returns -1 in case of error, >=0 in case of
     succes.

Int_t Exec(const char *cmd, ESlaves list)

     Send command to be executed on the PROOF master and/or slaves.
     Command can be any legal command line command. Commands like
     ".x file.C" or ".L file.C" will cause the file file.C to be send
     to the PROOF cluster. Returns -1 in case of error, >=0 in case of
     succes.

Int_t SendCommand(const char *cmd, ESlaves list)

     Send command to be executed on the PROOF master and/or slaves.
     Command can be any legal command line command, however commands
     like ".x file.C" or ".L file.C" will not cause the file.C to be
     transfered to the PROOF cluster. In that case use TProof::Exec().
     Returns the status send by the remote server as part of the
     kPROOF_LOGDONE message. Typically this is the return code of the
     command on the remote side. Returns -1 in case of error.

Int_t SendCurrentState(ESlaves list)

     Transfer the current state of the master to the active slave servers.
     The current state includes: the current working directory, etc.
     Returns the number of active slaves. Returns -1 in case of error.

Int_t SendInitialState()

     Transfer the initial (i.e. current) state of the master to all
     slave servers. Currently the initial state includes: log level.
     Returns the number of active slaves. Returns -1 in case of error.

Long_t CheckFile(const char *file, TSlave *slave)

     Check if a file needs to be send to the slave. Use the following
     algorithm:
       - check if file appears in file map
         - if yes, get file's modtime and check against time in map,
           if modtime not same get md5 and compare against md5 in map,
           if not same return size
         - if no, get file's md5 and modtime and store in file map, ask
           slave if file exists with specific md5, if yes return 0,
           if no return file's size
     Returns size of file in case file needs to be send, returns 0 in case
     file is already on remote and -1 in case of error.

Int_t SendFile(const char *file, Bool_t bin)

     Send a file to master or slave servers. Returns number of slaves
     the file was sent to, maybe 0 in case master and slaves have the same
     file system image, -1 in case of error. If bin is true binary
     file transfer is used, otherwise ASCII mode.

Int_t SendObject(const TObject *obj, ESlaves list)

     Send object to master or slave servers. Returns number of slaves object
     was sent to, -1 in case of error.

Int_t SendPrint(Option_t *option)

     Send print command to master server. Returns number of slaves message
     was sent to. Returns -1 in case of error.

void SetLogLevel(Int_t level, UInt_t mask)

     Set server logging level.

Int_t SetParallel(Int_t nodes)

     Tell RPOOF how many slaves to use in parallel. Returns the number of
     parallel slaves. Returns -1 in case of error.

Int_t GoParallel(Int_t nodes)

     Go in parallel mode with at most "nodes" slaves. Since the fSlaves
     list is sorted by slave performace the active list will contain first
     the most performant nodes. Returns the number of active slaves.
     Returns -1 in case of error.

void ShowCache(Bool_t all)

     List contents of file cache. If all is true show all caches also on
     slaves. If everything is ok all caches are to be the same.

void ClearCache()

     Remove files from all file caches.

void ShowPackages(Bool_t all)

     List contents of package directory. If all is true show all package
     directries also on slaves. If everything is ok all package directories
     should be the same.

void ShowEnabledPackages(Bool_t all)

     List which packages are enabled. If all is true show enabled packages
     for all active slaves. If everything is ok all active slaves should
     have the same packages enabled.

void ClearPackages()

     Remove all packages.

void ClearPackage(const char *package)

     Remove a specific package.

Int_t BuildPackage(const char *package)

     Build specified package. Executes the PROOF-INF/BUILD.sh
     script if it exists on all unique nodes.
     Returns 0 in case of success and -1 in case of error.

Int_t LoadPackage(const char *package)

     Load specified package. Executes the PROOF-INF/SETUP.C script
     on all active nodes.
     Returns 0 in case of success and -1 in case of error.

Int_t EnablePackage(const char *package)

     Enable specified package. Executes the PROOF-INF/BUILD.sh
     script if it exists followed by the PROOF-INF/SETUP.C script.
     Returns 0 in case of success and -1 in case of error.

Int_t UploadPackage(const char *tpar, Int_t parallel)

     Upload a PROOF archive (PAR file). A PAR file is a compressed
     tar file with one special additional directory, PROOF-INF
     (blatantly copied from Java's jar format). It must have the extension
     .par. A PAR file can be directly a binary or a source with a build
     procedure. In the PROOF-INF directory there can be a build script:
     BUILD.sh to be called to build the package, in case of a binary PAR
     file don't specify a build script or make it a no-op. Then there is
     SETUP.C which sets the right environment variables to use the package,
     like LD_LIBRARY_PATH, etc. Parallel is the number of parallel streams
     that can be used to upload the package to the master server.
     Returns 0 in case of success and -1 in case of error.

void Progress(Long64_t total, Long64_t processed)

     Get query progress information. Connect a slot to this signal
     to track progress.

void SetActive(Bool_t active)

     Suspend or resume PROOF via Condor.

void Feedback(TList *objs)

     Get list of feedback objects. Connect a slot to this signal
     to monitor the feedback object.

### Inline Functions

                   TProof TProof(const TProof&)
                     void operator=(const TProof&)
                    Int_t Broadcast(Int_t kind, TList* slaves)
                    Int_t Broadcast(Int_t kind, TProof::ESlaves list = kActive)
                   TList* GetListOfSlaves() const
                   TList* GetListOfActiveSlaves() const
                   TList* GetListOfUniqueSlaves() const
                   TList* GetListOfBadSlaves() const
                     void SetPlayer(TProofPlayer* player)
            TProofPlayer* GetPlayer() const
                   TProof TProof(const char* masterurl, const char* conffile = "kPROOF_ConfFile", const char* confdir = "kPROOF_ConfDir", Int_t loglevel = 0)
              const char* GetMaster() const
              const char* GetConfDir() const
              const char* GetConfFile() const
              const char* GetUser() const
              const char* GetWorkDir() const
              const char* GetImage() const
              const char* GetUrlProtocol() const
                    Int_t GetPort() const
                    Int_t GetSecurity() const
                    Int_t GetRemoteProtocol() const
                    Int_t GetClientProtocol() const
                    Int_t GetStatus() const
                    Int_t GetLogLevel() const
                 Double_t GetBytesRead() const
                  Float_t GetRealTime() const
                  Float_t GetCpuTime() const
                   Bool_t IsMaster() const
                   Bool_t IsValid() const
                   Bool_t IsParallel() const
                  TClass* Class()
                  TClass* IsA() const
                     void ShowMembers(TMemberInspector& insp, char* parent)
                     void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)

Author: Fons Rademakers 13/02/97
Last update: root/proof:$Name: $:$Id: TProof.cxx,v 1.69 2004/06/25 17:27:09 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *