library: libProof #include "TProofServ.h"

# TProofServ

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

## class TProofServ : public TApplication

| Inheritance Chart:

`TObject`

`TQObject`

<-

`TApplication`

<-

`TProofServ`

        private:

          Int_t CatMotd()
          Int_t LockCache()
          Int_t LockDir(const TString& lock)
          Int_t LockPackage()
           void RedirectOutput()
           void Setup()
          Int_t UnlockCache()
          Int_t UnlockDir(const TString& lock)
          Int_t UnlockPackage()

        public:

                             TProofServ(int* argc, char** argv)
                             TProofServ(const TProofServ&)
                     virtual ~TProofServ()
              static TClass* Class()
                    TObject* Get(const char* namecycle)
                 const char* GetConfDir() const
                 const char* GetConfFile() const
                     Float_t GetCpuTime() const
                       Int_t GetGroupId() const
                       Int_t GetGroupSize() const
                       Int_t GetLogLevel() const
               TDSetElement* GetNextPacket()
                virtual void GetOptions(int* argc, char** argv)
                       Int_t GetOrdinal() const
                     TProof* GetProof() const
                       Int_t GetProtocol() const
                     Float_t GetRealTime() const
                 const char* GetService() const
                 const char* GetSessionDir() const
                    TSocket* GetSocket() const
                 const char* GetUser() const
                        void HandleSigPipe()
                        void HandleSocketInput()
                        void HandleUrgentData()
                        void Interrupt()
             virtual TClass* IsA() const
               static Bool_t IsActive()
                      Bool_t IsMaster() const
                      Bool_t IsParallel() const
                 TProofServ& operator=(const TProofServ&)
                virtual void Print(Option_t* option) const
                       Int_t ReceiveFile(const char* file, Bool_t bin, Long_t size)
                        void Reset(const char* dir)
                virtual void Run(Bool_t retrn = kFALSE)
                        void SendLogFile(Int_t status = 0)
                        void SendStatus()
                virtual void ShowMembers(TMemberInspector& insp, char* parent)
                virtual void Streamer(TBuffer& b)
                        void StreamerNVirtual(TBuffer& b)
                virtual void Terminate(Int_t status)
          static TProofServ* This()

### Data Members

        private:

             TString fService          service we are running, either "proofserv" or "proofslave"
             TString fUser             user as which we run
             TString fPasswd           encoded passwd info for slaves
             TString fConfDir          directory containing cluster config information
             TString fConfFile         file containing config information
             TString fSessionDir       directory containing session dependent files
             TString fPackageDir       directory containing packages and user libs
             TString fCacheDir         directory containing cache of user files
             TString fPackageLock      package dir lock file
             TString fCacheLock        cache dir lock file
            TSocket* fSocket           socket connection to client
             TProof* fProof            PROOF talking to slave servers
               FILE* fLogFile          log file
              TList* fEnabledPackages  list of enabled packages
               Int_t fPackageLockId    file id of package dir lock
               Int_t fCacheLockId      file id of cache dir lock
               Int_t fProtocol         protocol version number
               Int_t fOrdinal          slave ordinal number, -1 for master
               Int_t fGroupId          slave unique id in the active slave group
               Int_t fGroupSize        size of the active slave group
               Int_t fLogLevel         debug logging level
               Int_t fNcmd             command history number
              Bool_t fPwHash           true if fPasswd is a passwd hash
              Bool_t fSRPPwd           true if fPasswd is a SRP passwd
              Bool_t fMasterServ       true if we are a master server
              Bool_t fInterrupt        if true macro execution will be stopped
             Float_t fRealTime         real time spent executing commands
             Float_t fCpuTime          CPU time spent executing commands
          TStopwatch fLatency          measures latency of packet requests
          TStopwatch fCompute          measures time spend processing a packet

## Class Description

     TProofServ

     TProofServ is the PROOF server. It can act either as the master
     server or as a slave server, depending on its startup arguments. It
     receives and handles message coming from the client or from the
     master server.

TProofServ(int *argc, char **argv) : TApplication("proofserv", argc, argv, 0, -1)

     Create an application environment. The TProofServ environment provides
     an eventloop via inheritance of TApplication.

~TProofServ()

     Cleanup. Not really necessary since after this dtor there is no
     live anyway.

Int_t CatMotd()

     Print message of the day (in fConfDir/proof/etc/motd). The motd
     is not shown more than once a dat. If the file fConfDir/proof/etc/noproof
     exists, show its contents and close the connection.

TObject* Get(const char *namecycle)

     Get object with name "name;cycle" (e.g. "aap;2") from master or client.
     This method is called by TDirectory::Get() in case the object can not
     be found locally.

TDSetElement* GetNextPacket()

     Get next range of entries to be processed on this server.

void GetOptions(int *argc, char **argv)

     Get and handle command line options. Fixed format:
     "proofserv"|"proofslave" <confdir>

void HandleSocketInput()

     Handle input coming from the client or from the master server.

void HandleUrgentData()

     Handle Out-Of-Band data sent by the master or client.

void HandleSigPipe()

     Called when the client is not alive anymore (i.e. when kKeepAlive
     has failed).

Bool_t IsParallel() const

     True if in parallel mode.

Int_t LockDir(const TString &lock)

     Lock a directory. Waits if lock is hold by an other process.
     Returns 0 on success, -1 in case of error.

Int_t UnlockDir(const TString &lock)

     Unlock a directory. Returns 0 in case of success,
     -1 in case of error.

void Print(Option_t *option) const

     Print status of slave server.

void RedirectOutput()

     Redirect stdout to a log file. This log file will be flushed to the
     client or master after each command.

void Reset(const char *dir)

     Reset PROOF environment to be ready for execution of next command.

Int_t ReceiveFile(const char *file, Bool_t bin, Long_t size)

     Receive a file, either sent by a client or a master server.
     If bin is true it is a binary file, other wise it is an ASCII
     file and we need to check for Windows \r tokens. Returns -1 in
     case of error, 0 otherwise.

void Run(Bool_t retrn)

     Main server eventloop.

void SendLogFile(Int_t status)

     Send log file to master.

void SendStatus()

     Send status of slave server to master or client.

void Setup()

     Print the ProofServ logo on standard output.

void Terminate(Int_t status)

     Terminate the proof server.

Bool_t IsActive()

     Static function that returns kTRUE in case we are a PROOF server.

TProofServ* This()

     Static function returning pointer to global object gProofServ.
     Mainly for use via CINT, where the gProofServ symbol might be
     deleted from the symbol table.

### Inline Functions

                  Int_t LockCache()
                  Int_t UnlockCache()
                  Int_t LockPackage()
                  Int_t UnlockPackage()
                TProof* GetProof() const
            const char* GetService() const
            const char* GetConfDir() const
            const char* GetConfFile() const
            const char* GetUser() const
            const char* GetSessionDir() const
                  Int_t GetProtocol() const
                  Int_t GetOrdinal() const
                  Int_t GetGroupId() const
                  Int_t GetGroupSize() const
                  Int_t GetLogLevel() const
               TSocket* GetSocket() const
                Float_t GetRealTime() const
                Float_t GetCpuTime() const
                   void Interrupt()
                 Bool_t IsMaster() const
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
             TProofServ TProofServ(const TProofServ&)
            TProofServ& operator=(const TProofServ&)

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