Back to index

nordugrid-arc-nox  1.1.0~rc6
job_status.h
Go to the documentation of this file.
00001 #ifndef __ARC_JOB_STATUS_H__
00002 #define __ARC_JOB_STATUS_H__
00003 
00004 #include <map>
00005 #include <string>
00006 #include <arc/StringConv.h>
00007 
00008 namespace Paul
00009 {
00010 
00011 enum SchedStatusLevel {
00012     NEW, 
00013     STARTING, 
00014     RUNNING, 
00015     CANCELLED, 
00016     FAILED, 
00017     FINISHED, 
00018     KILLED, 
00019     KILLING,
00020     EXCEPTION,
00021     UNKNOWN 
00022 };
00023 
00024 enum ARexStatusLevel 
00025 {
00026     ACCEPTING, 
00027     ACCEPTED, 
00028     PREPARING, 
00029     PREPARED, 
00030     SUBMITTING, 
00031     EXECUTING, 
00032     AREX_KILLING, 
00033     EXECUTED, 
00034     FINISHING, 
00035     AREX_FAILED, 
00036     HELD,
00037     AREX_UNKNOWN
00038 };
00039 
00040 std::string sched_status_to_string(SchedStatusLevel l);
00041 SchedStatusLevel sched_status_from_string(const std::string &s);
00042 
00043 #if 0
00044 class SchedStatus
00045 {
00046     private:
00047         SchedStatusLevel level;
00048         std::string level_str;
00049     public:
00050         SchedStatus(void) { level = UNKNOWN; level_str = "UNKONWN"; };
00051         SchedStatus(SchedStatusLevel l, const std::string &str) { level = l; level_str = str; };
00052         operator std::string(void) const { return level_str; };
00053         bool operator==(SchedStatusLevel l) const { return (l == level); };
00054         bool operator==(const SchedStatus &s) const { return (s.level == level); };
00055         bool operator==(const std::string &s) const { return (Arc::upper(s) == level_str); };
00056         bool operator!=(SchedStatusLevel l) const { return (l != level); };
00057         bool operator!=(const SchedStatus &s) const { return (s.level != level); };
00058         bool operator!=(const std::string &s) const { return (Arc::upper(s) != level_str); };
00059         SchedStatusLevel get(void) { return level; };
00060 };
00061 
00062 class SchedStatusFactory
00063 {
00064     private:
00065         std::map<SchedStatusLevel, std::string> str_map;
00066     public:
00067         SchedStatusFactory(void);
00068         SchedStatus get(SchedStatusLevel l) { return SchedStatus(l, str_map[l]);};
00069         SchedStatus get(const std::string &str);
00070         SchedStatus getFromARexStatus(ARexStatusLevel l);
00071         SchedStatus getFromARexStatus(const std::string &str);
00072 }; // sched status factory
00073 #endif
00074 
00075 } // namespace Paul
00076 
00077 #endif