00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_XrdProofSched
00013 #define ROOT_XrdProofSched
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include <list>
00044
00045 #include "XrdProofdAux.h"
00046 #include "XrdOuc/XrdOucHash.hh"
00047 #include "XrdOuc/XrdOucString.hh"
00048 #ifdef OLDXRDOUC
00049 # include "XrdSysToOuc.h"
00050 #endif
00051
00052 #include "XrdProofdConfig.h"
00053
00054 #define kXPSMXNMLEN 17
00055
00056 class XrdProofdManager;
00057 class XrdProofGroupMgr;
00058 class XrdProofdProofServ;
00059 class XrdProofWorker;
00060 class XrdSysError;
00061 class XrdOucStream;
00062
00063 class XrdProofSched : public XrdProofdConfig {
00064
00065 public:
00066 XrdProofSched(const char *name,
00067 XrdProofdManager *mgr, XrdProofGroupMgr *grpmgr,
00068 const char *cfn, XrdSysError *e = 0);
00069 virtual ~XrdProofSched() { }
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 virtual int GetWorkers(XrdProofdProofServ *xps,
00080 std::list<XrdProofWorker *> *,
00081 const char *);
00082
00083
00084 virtual int Reschedule();
00085
00086
00087 virtual int UpdateSession(XrdProofdProofServ *, int = 0, void * = 0) { return 0; }
00088
00089
00090 virtual int MaxSessions() const { return fMaxSessions; }
00091
00092
00093 virtual int UpdateProperties() { return 0; }
00094
00095 virtual int ExportInfo(XrdOucString &);
00096
00097 virtual bool IsValid() { return fValid; }
00098
00099 const char *Name() const { return (const char *) &fName[0]; }
00100
00101 virtual int ProcessDirective(XrdProofdDirective *d,
00102 char *val, XrdOucStream *cfg, bool rcf);
00103 virtual int Enqueue(XrdProofdProofServ *xps, XrdProofQuery *query);
00104 virtual void DumpQueues(const char *prefix = 0);
00105
00106 virtual XrdProofdProofServ *FirstSession();
00107
00108 int CheckFrequency() const { return fCheckFrequency; }
00109 inline XrdProofdPipe *Pipe() { return &fPipe; }
00110
00111 virtual int Config(bool rcf = 0);
00112 virtual int DoDirective(XrdProofdDirective *d,
00113 char *val, XrdOucStream *cfg, bool rcf);
00114
00115 enum SchedProtocol { kReschedule = 0 };
00116
00117 protected:
00118 char fName[kXPSMXNMLEN];
00119 bool fValid;
00120 XrdProofdManager *fMgr;
00121 XrdProofGroupMgr *fGrpMgr;
00122
00123 int fMaxSessions;
00124 int fMaxRunning;
00125 int fWorkerMax;
00126 int fWorkerSel;
00127 int fNextWrk;
00128 int fOptWrksPerUnit;
00129 int fMinForQuery;
00130 double fNodesFraction;
00131
00132 bool fUseFIFO;
00133 std::list<XrdProofdProofServ *> fQueue;
00134
00135 XrdOucHash<XrdProofdDirective> fConfigDirectives;
00136
00137 int fCheckFrequency;
00138 XrdProofdPipe fPipe;
00139
00140 XrdSysError *fEDest;
00141
00142
00143 virtual void RegisterDirectives();
00144 virtual int DoDirectiveSchedParam(char *, XrdOucStream *, bool);
00145 virtual int DoDirectiveResource(char *, XrdOucStream *, bool);
00146
00147 virtual int GetNumWorkers(XrdProofdProofServ *xps);
00148 virtual void ResetParameters();
00149 };
00150
00151
00152
00153 typedef XrdProofSched *(*XrdProofSchedLoader_t)(const char *, XrdProofdManager *,
00154 XrdProofGroupMgr *, const char *,
00155 XrdSysError *);
00156
00157 #endif