Back to index

nordugrid-arc-nox  1.1.0~rc6
job.h
Go to the documentation of this file.
00001 #ifndef SCHED_JOB
00002 #define SCHED_JOB
00003 
00004 #include <string>
00005 #include "job_request.h"
00006 #include "job_sched_meta.h"
00007 #include "job_status.h"
00008 
00009 namespace Paul {
00010 
00011 
00012 class Job {
00013 
00014     private:
00015         JobRequest request;
00016         JobSchedMetaData sched_meta;
00017         std::string failure;
00018         std::string id;
00019         std::string db;
00020         SchedStatusLevel status;
00021         int timeout;
00022         int check;
00023         bool finished_reported;
00024     public:
00025         Job(void);
00026         Job(const Job &j);
00027         Job(JobRequest &r);
00028         Job(JobRequest &r, JobSchedMetaData &m, int t, const std::string &db_path);
00029         Job(const std::string& job, const std::string &db_path);
00030         Job(std::istream &job, const std::string &db_path);
00031         virtual ~Job(void);
00032         void setJobRequest(JobRequest &r) { request = r; };
00033         JobRequest &getJobRequest(void) { return request; };
00034         void setJobSchedMetaData(JobSchedMetaData &sched_meta);
00035         JobSchedMetaData &getSchedMetaData(void) { return sched_meta; };
00036         const std::string getFailure(void);
00037         void setID(const std::string& id_) { id = id_; };
00038         const std::string &getID(void) { return id; };
00039         void setStatus(SchedStatusLevel s) { status = s; };
00040         SchedStatusLevel getStatus(void) { return status; };
00041         operator bool(void) { return (id.empty() ? false : true ); };
00042         bool operator!(void) { return (id.empty() ? true : false ); };
00043         Arc::XMLNode &getJSDL(void) { return request.getJSDL(); };
00044         void setResourceJobID(const std::string &id) { sched_meta.setResourceJobID(id); };
00045         const std::string &getResourceJobID(void) { return sched_meta.getResourceJobID(); };
00046         void setResourceID(const std::string &id) { sched_meta.setResourceID(id); };
00047         const std::string &getResourceID(void) { return sched_meta.getResourceID(); };
00048         bool CheckTimeout(void);
00049         bool Cancel(void);
00050         bool save(void);
00051         bool load(void);
00052         bool remove(void);
00053         void finishedReported(void) { finished_reported = true; };
00054         bool isFinishedReported(void) { return finished_reported; };
00055         void clean(const std::string &jobroot);
00056 };
00057 
00058 } // namespace Arc
00059 
00060 #endif // SCHED_JOB