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 //
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
78 
79 private:
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
XrdXrootdJob
Definition: XrdXrootdJob.hh:52
XrdXrootdJob::myMutex
XrdSysMutex myMutex
Definition: XrdXrootdJob.hh:87
XrdOucProg
Definition: XrdOucProg.hh:38
XrdSysMutex
Definition: XrdSysPthread.hh:166
XrdXrootdJob::sendResult
int sendResult(XrdXrootdResponse *resp, const char *rpfx, XrdXrootdJob2Do *job)
XrdSysPthread.hh
XrdXrootdJob::CleanUp
void CleanUp(XrdXrootdJob2Do *jp)
XrdXrootdJob::DoIt
void DoIt()
XrdXrootdJob::reScan
static const int reScan
Definition: XrdXrootdJob.hh:85
XrdXrootdResponse
Definition: XrdXrootdResponse.hh:49
XrdXrootdJob::JobName
char * JobName
Definition: XrdXrootdJob.hh:91
XrdXrootdJob::numJobs
int numJobs
Definition: XrdXrootdJob.hh:93
XrdOucTable< XrdXrootdJob2Do >
XrdXrootdJob::Schedule
int Schedule(const char *jkey, const char **args, XrdXrootdResponse *resp, int Opts=0)
XrdXrootdJob::Sched
XrdScheduler * Sched
Definition: XrdXrootdJob.hh:88
XrdXrootdJob::Cancel
int Cancel(const char *jkey=0, XrdXrootdResponse *resp=0)
XrdXrootdJob::List
XrdOucTList * List(void)
XrdScheduler
Definition: XrdScheduler.hh:45
XrdXrootdJob::JobTable
XrdOucTable< XrdXrootdJob2Do > JobTable
Definition: XrdXrootdJob.hh:89
XrdJob
Definition: XrdJob.hh:43
XrdXrootdJob::XrdXrootdJob
XrdXrootdJob(XrdScheduler *schp, XrdOucProg *pgm, const char *jname, int maxjobs=4)
XrdXrootdJob::XrdXrootdJob2Do
friend class XrdXrootdJob2Do
Definition: XrdXrootdJob.hh:53
XrdOucTable.hh
XrdXrootdJob::theProg
XrdOucProg * theProg
Definition: XrdXrootdJob.hh:90
XrdXrootdJob::~XrdXrootdJob
~XrdXrootdJob()
XrdXrootdJob::maxJobs
int maxJobs
Definition: XrdXrootdJob.hh:92
XrdJob.hh
XrdOucTList.hh
XrdOucTList
Definition: XrdOucTList.hh:42