00001 #ifndef __EDG_WORKLOAD_LOGGING_CLIENT_JOBSTATUS_HPP__
00002 #define __EDG_WORKLOAD_LOGGING_CLIENT_JOBSTATUS_HPP__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include <sys/time.h>
00014 #include <string>
00015 #include <utility>
00016 #include <vector>
00017
00018 #include "glite/wmsutils/jobid/JobId.h"
00019
00020 #include "glite/lb/jobstat.h"
00021 #include "glite/lb/CountRef.h"
00022
00023 EWL_BEGIN_NAMESPACE;
00024
00037 class JobStatus {
00038 friend class Job;
00039 friend class CountRef<JobStatus>;
00040 public:
00041
00043 enum Code {
00044 UNDEF = 0,
00045 SUBMITTED,
00046 WAITING,
00047 READY,
00048 SCHEDULED,
00049 RUNNING,
00050 DONE,
00051 CLEARED,
00052 ABORTED,
00053 CANCELLED,
00054 UNKNOWN,
00055 PURGED,
00056 CODE_MAX
00057 };
00058
00064 enum Attr {
00066 ACL,
00068 CANCEL_REASON,
00070 CANCELLING,
00072 CE_NODE,
00074 CHILDREN,
00076 CHILDREN_HIST,
00078 CHILDREN_NUM,
00080 CHILDREN_STATES,
00082 CONDOR_ID,
00084 CONDOR_DEST_HOST,
00086 CONDOR_ERROR_DESC,
00088 CONDOR_JDL,
00090 CONDOR_JOB_EXIT_STATUS,
00092 CONDOR_JOB_PID,
00094 CONDOR_OWNER,
00096 CONDOR_REASON,
00098 CONDOR_SHADOW_EXIT_STATUS,
00100 CONDOR_SHADOW_PID,
00102 CONDOR_STARTER_EXIT_STATUS,
00104 CONDOR_STARTER_PID,
00106 CONDOR_STATUS,
00108 CONDOR_UNIVERSE,
00110 CPU_TIME,
00112 DESTINATION,
00114 DONE_CODE,
00116 EXIT_CODE,
00118 EXPECT_FROM,
00120 EXPECT_UPDATE,
00122 GLOBUS_ID,
00124 JDL,
00126 JOB_ID,
00128 JOBTYPE,
00130 LAST_UPDATE_TIME,
00132 LOCAL_ID,
00134 LOCATION,
00136 MATCHED_JDL,
00138 NETWORK_SERVER,
00140 OWNER,
00142 PARENT_JOB,
00144 PAYLOAD_RUNNING,
00146 PBS_DEST_HOST,
00148 PBS_ERROR_DESC,
00150 PBS_EXIT_STATUS,
00152 PBS_NAME,
00154 PBS_OWNER,
00156 PBS_PID,
00158 PBS_QUEUE,
00160 PBS_REASON,
00162 PBS_RESOURCE_USAGE,
00164 PBS_SCHEDULER,
00166 PBS_STATE,
00168 POSSIBLE_CE_NODES,
00170 POSSIBLE_DESTINATIONS,
00172 REASON,
00174 RESUBMITTED,
00176 RSL,
00178 SEED,
00180 STATE_ENTER_TIME,
00182 STATE_ENTER_TIMES,
00184 SUBJOB_FAILED,
00186 SUSPEND_REASON,
00188 SUSPENDED,
00190 USER_TAGS,
00191 ATTR_MAX
00192 };
00193
00194 enum {
00195 DONE_CODE_OK,
00196 DONE_CODE_FAILED,
00197 DONE_CODE_CANCELLED,
00198 };
00199 enum {
00200 JOBTYPE_SIMPLE,
00201 JOBTYPE_DAG,
00202 JOBTYPE_COLLECTION,
00203 JOBTYPE_PBS,
00204 JOBTYPE_CONDOR,
00205 };
00211 enum AttrType { INT_T,
00212 STRING_T,
00213 TIMEVAL_T,
00214 BOOL_T,
00215 JOBID_T,
00216 INTLIST_T,
00217 STRLIST_T,
00218 TAGLIST_T,
00219 STSLIST_T
00220 };
00221
00227 Code status;
00228
00233 const std::string & name(void) const;
00234
00242 int getValInt(Attr name) const;
00243
00251 std::string getValString(Attr name) const;
00252
00260 struct timeval getValTime(Attr name) const;
00261
00269 const glite::wmsutils::jobid::JobId getValJobId(Attr name) const;
00270
00278 bool getValBool(Attr name) const;
00279
00287 const std::vector<int> getValIntList(Attr name) const;
00288
00296 const std::vector<std::string> getValStringList(Attr name) const;
00297
00305 const std::vector<std::pair<std::string,std::string> > getValTagList(Attr name) const;
00306
00314 const std::vector<JobStatus> getValJobStatusList(Attr name) const;
00315
00323 static const std::string& getAttrName(Attr name);
00324
00332 const std::vector<std::pair<Attr,AttrType> >& getAttrs(void) const;
00333
00342 static const std::string &getStateName(Code state);
00343
00348 JobStatus(void);
00349
00357 JobStatus(const JobStatus &orig);
00358
00366 JobStatus & operator=(const JobStatus &orig);
00367
00373 JobStatus(const edg_wll_JobStat &src);
00374
00380 JobStatus & operator=(const edg_wll_JobStat& src);
00381
00386 virtual ~JobStatus();
00387
00388 protected:
00389 edg_wll_JobStat *c_ptr(void);
00390
00391 private:
00392 static void destroyFlesh(void *);
00393 CountRef<JobStatus> *flesh;
00394 };
00395
00396 EWL_END_NAMESPACE;
00397
00398 #endif
00399