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 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
33 #include <sys/types.h>
34 
35 #include "Xrd/XrdJob.hh"
36 #include "XrdOuc/XrdOucTList.hh"
37 #include "XrdSys/XrdSysPthread.hh"
38 #include "XrdOuc/XrdOucTable.hh"
39 
40 class XrdOucProg;
41 class XrdLink;
42 class XrdScheduler;
43 class XrdXrootdJob2Do;
44 class XrdXrootdResponse;
45 
46 // Definition of options that can be passed to Schedule()
47 //
48 #define JOB_Sync 0x0001
49 #define JOB_Unique 0x0002
50 
51 class XrdXrootdJob : public XrdJob
52 {
53 friend class XrdXrootdJob2Do;
54 public:
55 
56 int Cancel(const char *jkey=0, XrdXrootdResponse *resp=0);
57 
58 void DoIt();
59 
60 // List() returns a list of all jobs in xml format
61 //
62 XrdOucTList *List(void);
63 
64 // args[0] if not null if prefixes the response
65 // args[1-n] are passed to the prgram
66 // The return value is whatever resp->Send() returns
67 //
68 int Schedule(const char *jkey, // Job Identifier
69  const char **args, // Zero terminated arglist
70  XrdXrootdResponse *resp, // Response object
71  int Opts=0);// Options (see above)
72 
73  XrdXrootdJob(XrdScheduler *schp, // -> Scheduler
74  XrdOucProg *pgm, // -> Program Object
75  const char *jname, // -> Job name
76  int maxjobs=4); // Maximum simultaneous jobs
77  ~XrdXrootdJob();
78 
79 private:
80 void CleanUp(XrdXrootdJob2Do *jp);
82  const char *rpfx,
83  XrdXrootdJob2Do *job);
84 
85 static const int reScan = 15*60;
86 
91 char *JobName;
92 int maxJobs;
93 int numJobs;
94 };
95 #endif
friend class XrdXrootdJob2Do
Definition: XrdXrootdJob.hh:53
XrdXrootdJob(XrdScheduler *schp, XrdOucProg *pgm, const char *jname, int maxjobs=4)
XrdScheduler * Sched
Definition: XrdXrootdJob.hh:88
XrdOucProg * theProg
Definition: XrdXrootdJob.hh:90
int maxJobs
Definition: XrdXrootdJob.hh:92
int sendResult(XrdXrootdResponse *resp, const char *rpfx, XrdXrootdJob2Do *job)
Definition: XrdScheduler.hh:44
XrdOucTable< XrdXrootdJob2Do > JobTable
Definition: XrdXrootdJob.hh:89
Definition: XrdSysPthread.hh:165
Definition: XrdOucProg.hh:37
XrdSysMutex myMutex
Definition: XrdXrootdJob.hh:87
Definition: XrdOucTList.hh:41
XrdOucTList * List(void)
static const int reScan
Definition: XrdXrootdJob.hh:85
void CleanUp(XrdXrootdJob2Do *jp)
Definition: XrdXrootdResponse.hh:48
int numJobs
Definition: XrdXrootdJob.hh:93
char * JobName
Definition: XrdXrootdJob.hh:91
Definition: XrdXrootdJob.hh:51
int Cancel(const char *jkey=0, XrdXrootdResponse *resp=0)
int Schedule(const char *jkey, const char **args, XrdXrootdResponse *resp, int Opts=0)
Definition: XrdJob.hh:42