xrootd
XrdXrootdJob.hh
Go to the documentation of this file.
1 #ifndef __XRDXROOTDJOB_HH_
2 #define __XRDXROOTDJOB_HH_
3 /******************************************************************************/
4 /* */
5 /* X r d X r o o t d J o b . h h */
6 /* */
7 /* (c) 2006 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /******************************************************************************/
12 
13 // $Id$
14 
15 #include <sys/types.h>
16 
17 #include "Xrd/XrdJob.hh"
18 #include "XrdOuc/XrdOucTList.hh"
19 #include "XrdSys/XrdSysPthread.hh"
20 #include "XrdOuc/XrdOucTable.hh"
21 
22 class XrdOucProg;
23 class XrdLink;
24 class XrdScheduler;
25 class XrdXrootdJob2Do;
26 class XrdXrootdResponse;
27 
28 // Definition of options that can be passed to Schedule()
29 //
30 #define JOB_Sync 0x0001
31 #define JOB_Unique 0x0002
32 
33 class XrdXrootdJob : public XrdJob
34 {
35 friend class XrdXrootdJob2Do;
36 public:
37 
38 int Cancel(const char *jkey=0, XrdXrootdResponse *resp=0);
39 
40 void DoIt();
41 
42 // List() returns a list of all jobs in xml format
43 //
44 XrdOucTList *List(void);
45 
46 // args[0] if not null if prefixes the response
47 // args[1-n] are passed to the prgram
48 // The return value is whatever resp->Send() returns
49 //
50 int Schedule(const char *jkey, // Job Identifier
51  const char **args, // Zero terminated arglist
52  XrdXrootdResponse *resp, // Response object
53  int Opts=0);// Options (see above)
54 
55  XrdXrootdJob(XrdScheduler *schp, // -> Scheduler
56  XrdOucProg *pgm, // -> Program Object
57  const char *jname, // -> Job name
58  int maxjobs=4); // Maximum simultaneous jobs
59  ~XrdXrootdJob();
60 
61 private:
62 void CleanUp(XrdXrootdJob2Do *jp);
64  const char *rpfx,
65  XrdXrootdJob2Do *job);
66 
67 static const int reScan = 15*60;
68 
73 char *JobName;
74 int maxJobs;
75 int numJobs;
76 };
77 #endif