- added new CREAM statuses and remove name conflict with other enums
authorJiří Filipovič <fila@ics.muni.cz>
Tue, 19 Feb 2013 11:53:41 +0000 (11:53 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 26 Feb 2013 14:18:13 +0000 (15:18 +0100)
org.glite.lb.common/src/status.c.T
org.glite.lb.state-machine/src/process_event.c
org.glite.lb.state-machine/src/process_event_cream.c
org.glite.lb.types/status.T

index 7b874af..12bc49e 100644 (file)
@@ -281,14 +281,14 @@ enum edg_wll_StatCream_state edg_wll_StringToCreamStat(const char *name)
         unsigned int     i;
 
         for (i=0; i<sizeof(cream_statNames)/sizeof(cream_statNames[0]); i++)
-                if (strcasecmp(cream_statNames[i],name) == 0) return (enum edg_wll_StatCream_state) i;
+                if (strcasecmp(cream_statNames[i]+strlen("CREAM_"),name) == 0) return (enum edg_wll_StatCream_state) i;
         return (enum edg_wll_StatCream_state) -1; 
 }
 
 char *edg_wll_CreamStatToString(enum edg_wll_StatCream_state statCode)
 {
         if ((int)statCode < 0 || statCode >= sizeof(cream_statNames)/sizeof(cream_statNames[0])) return (char *) NULL; 
-        return strdup(cream_statNames[statCode]);
+        return strdup(cream_statNames[statCode]+strlen("CREAM_"));
 }
 
 static const char * const vm_statNames[] = {
index 485e15e..acf6219 100644 (file)
@@ -1035,7 +1035,7 @@ static int processEvent_glite(intJobStat *js, edg_wll_Event *e, int ev_seq, int
                                        case EDG_WLL_CREAMSTORE_CMDSTART:
                                                if (e->CREAMStore.result == EDG_WLL_CREAMSTORE_OK) {
                                                        js->pub.state = EDG_WLL_JOB_WAITING;
-                                                       js->pub.cream_state = EDG_WLL_STAT_PENDING;
+                                                       js->pub.cream_state = EDG_WLL_STAT_CREAM_PENDING;
                                                }
                                                break;
                                         case EDG_WLL_CREAMSTORE_CMDSUSPEND:
@@ -1064,7 +1064,7 @@ static int processEvent_glite(intJobStat *js, edg_wll_Event *e, int ev_seq, int
                                if (USABLE(res, strict)) {
                                         // BLAH -> LRMS
                                        js->pub.state = EDG_WLL_JOB_SCHEDULED;
-                                       js->pub.cream_state = EDG_WLL_STAT_IDLE;
+                                       js->pub.cream_state = EDG_WLL_STAT_CREAM_IDLE;
                                        rep_cond(js->pub.cream_reason, e->CREAMCall.reason);
                                        rep_cond(js->pub.reason, e->CREAMCall.reason);
                                }
@@ -1084,7 +1084,7 @@ static int processEvent_glite(intJobStat *js, edg_wll_Event *e, int ev_seq, int
                        if (USABLE(res, strict)) {
                                 if (e->CREAMCancel.status_code == EDG_WLL_CANCEL_DONE) {
                                         js->pub.state = EDG_WLL_JOB_CANCELLED;
-                                        js->pub.cream_state = EDG_WLL_STAT_ABORTED;
+                                        js->pub.cream_state = EDG_WLL_STAT_CREAM_ABORTED;
                                 }
                                rep(js->pub.cream_reason, e->CREAMCancel.reason);
                                 rep(js->pub.reason, e->CREAMCancel.reason);
@@ -1093,7 +1093,7 @@ static int processEvent_glite(intJobStat *js, edg_wll_Event *e, int ev_seq, int
                case EDG_WLL_EVENT_CREAMABORT:
                         if (USABLE(res, strict)) {
                                 js->pub.state = EDG_WLL_JOB_ABORTED;
-                                js->pub.cream_state = EDG_WLL_STAT_ABORTED;
+                                js->pub.cream_state = EDG_WLL_STAT_CREAM_ABORTED;
                                rep(js->pub.cream_reason, e->CREAMAbort.reason);
                                 rep(js->pub.reason, e->CREAMAbort.reason);
                         }
@@ -1103,32 +1103,34 @@ static int processEvent_glite(intJobStat *js, edg_wll_Event *e, int ev_seq, int
                         {
                                 switch (js->pub.cream_state = edg_wll_StringToCreamStat(e->CREAMStatus.new_state))
                                 {
-                                        case EDG_WLL_STAT_REGISTERED:
+                                        case EDG_WLL_STAT_CREAM_REGISTERED:
                                         case EDG_WLL_NUMBER_OF_CREAM_STATES:
                                                 break;
 
-                                        case EDG_WLL_STAT_PENDING: js->pub.state = EDG_WLL_JOB_WAITING; break;
-                                        case EDG_WLL_STAT_IDLE: js->pub.state = EDG_WLL_JOB_SCHEDULED; break;
-                                        case EDG_WLL_STAT_RUNNING:
+                                        case EDG_WLL_STAT_CREAM_PENDING: js->pub.state = EDG_WLL_JOB_WAITING; break;
+                                        case EDG_WLL_STAT_CREAM_IDLE: js->pub.state = EDG_WLL_JOB_SCHEDULED; break;
+                                        case EDG_WLL_STAT_CREAM_RUNNING:
                                                 js->pub.state = EDG_WLL_JOB_RUNNING;
                                                 js->pub.jw_status = EDG_WLL_STAT_WRAPPER_RUNNING;
                                                 break;
-                                        case EDG_WLL_STAT_REALLY_RUNNING:
+                                        case EDG_WLL_STAT_CREAM_REALLY_RUNNING:
                                                 js->pub.state = EDG_WLL_JOB_RUNNING;
                                                 js->pub.jw_status = EDG_WLL_STAT_PAYLOAD_RUNNING;
                                                 break;
-                                        case EDG_WLL_STAT_HELD: /* TODO */ break;
-                                        case EDG_WLL_STAT_DONE_OK:
+                                        case EDG_WLL_STAT_CREAM_HELD: /* TODO */ break;
+                                        case EDG_WLL_STAT_CREAM_DONE_OK:
                                                 js->pub.state = EDG_WLL_JOB_DONE;
                                                 js->pub.done_code = EDG_WLL_STAT_OK;
                                                 js->pub.cream_done_code = EDG_WLL_STAT_OK;
                                                 break;
-                                        case EDG_WLL_STAT_DONE_FAILED:
+                                        case EDG_WLL_STAT_CREAM_DONE_FAILED:
                                                 js->pub.state = EDG_WLL_JOB_DONE;
                                                 js->pub.done_code = EDG_WLL_STAT_FAILED;
                                                 js->pub.cream_done_code = EDG_WLL_STAT_FAILED;
                                                 break;
-                                        case EDG_WLL_STAT_ABORTED: js->pub.state = EDG_WLL_JOB_ABORTED; break;
+                                        case EDG_WLL_STAT_CREAM_ABORTED: js->pub.state = EDG_WLL_JOB_ABORTED; break;
+                                       case EDG_WLL_STAT_CREAM_CANCELLED: js->pub.state = EDG_WLL_JOB_CANCELLED; break;
+                                       case EDG_WLL_STAT_CREAM_PURGED: js->pub.state = EDG_WLL_JOB_CLEARED; break;
                                 }
                         }
                         break;
index 1502fea..20c77a7 100644 (file)
@@ -152,7 +152,7 @@ int processEvent_Cream(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict,
                case EDG_WLL_EVENT_REGJOB:
                        if (USABLE(res)) {
                                js->pub.state = EDG_WLL_JOB_SUBMITTED;
-                               js->pub.cream_state = EDG_WLL_STAT_REGISTERED;
+                               js->pub.cream_state = EDG_WLL_STAT_CREAM_REGISTERED;
                        }
                        break;
                case EDG_WLL_EVENT_CREAMSTART:
@@ -169,7 +169,7 @@ int processEvent_Cream(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict,
                                        case EDG_WLL_CREAMSTORE_CMDSTART:
                                                if (e->CREAMStore.result == EDG_WLL_CREAMSTORE_OK) {
                                                        js->pub.state = EDG_WLL_JOB_WAITING;
-                                                       js->pub.cream_state = EDG_WLL_STAT_PENDING;
+                                                       js->pub.cream_state = EDG_WLL_STAT_CREAM_PENDING;
                                                }
                                                break;
                                        case EDG_WLL_CREAMSTORE_CMDSUSPEND:
@@ -200,7 +200,7 @@ int processEvent_Cream(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict,
                                if (USABLE(res)) {
                                        // BLAH -> LRMS
                                                js->pub.state = EDG_WLL_JOB_SCHEDULED;
-                                               js->pub.cream_state = EDG_WLL_STAT_IDLE;
+                                               js->pub.cream_state = EDG_WLL_STAT_CREAM_IDLE;
                                                rep_cond(js->pub.cream_reason, e->CREAMCall.reason);
                                                rep_cond(js->pub.reason, e->CREAMCall.reason);
                                        }
@@ -220,12 +220,22 @@ int processEvent_Cream(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict,
                                rep_cond(js->pub.cream_reason, e->CREAMCall.reason);
                                rep_cond(js->pub.reason, e->CREAMCall.reason);
                        }
+                       if (e->CREAMCall.command == EDG_WLL_CREAMCALL_CMDPURGE &&
+                               e->CREAMCall.result == EDG_WLL_CREAMCALL_OK)
+                       {
+                               if (USABLE(res)){
+                                       js->pub.state = EDG_WLL_JOB_CLEARED;
+                                       js->pub.cream_state = EDG_WLL_STAT_CREAM_PURGED;
+                               }
+                               rep_cond(js->pub.cream_reason, e->CREAMCall.reason);
+                                rep_cond(js->pub.reason, e->CREAMCall.reason);
+                       }
                        break;
                case EDG_WLL_EVENT_CREAMCANCEL:
                        if (USABLE(res)) {
                                if (e->CREAMCancel.status_code == EDG_WLL_CANCEL_DONE) {
                                        js->pub.state = EDG_WLL_JOB_CANCELLED;
-                                       js->pub.cream_state = EDG_WLL_STAT_ABORTED;
+                                       js->pub.cream_state = EDG_WLL_STAT_CREAM_ABORTED;
                                }
                        }
                        if (USABLE_DATA(res)) {
@@ -236,7 +246,7 @@ int processEvent_Cream(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict,
                case EDG_WLL_EVENT_CREAMABORT:
                        if (USABLE(res)) {
                                js->pub.state = EDG_WLL_JOB_ABORTED;
-                               js->pub.cream_state = EDG_WLL_STAT_ABORTED;
+                               js->pub.cream_state = EDG_WLL_STAT_CREAM_ABORTED;
                        }
                        if (USABLE_DATA(res)) {
                                rep(js->pub.cream_reason, e->CREAMAbort.reason);
@@ -250,32 +260,34 @@ int processEvent_Cream(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict,
                                switch (js->pub.cream_state = edg_wll_StringToCreamStat(e->CREAMStatus.new_state))
                                {
                                        /* XXX: should not arrive */
-                                       case EDG_WLL_STAT_REGISTERED:
+                                       case EDG_WLL_STAT_CREAM_REGISTERED:
                                        case EDG_WLL_NUMBER_OF_CREAM_STATES:
                                                break;
 
-                                       case EDG_WLL_STAT_PENDING: js->pub.state = EDG_WLL_JOB_WAITING; break;
-                                       case EDG_WLL_STAT_IDLE: js->pub.state = EDG_WLL_JOB_SCHEDULED; break;
-                                       case EDG_WLL_STAT_RUNNING:
+                                       case EDG_WLL_STAT_CREAM_PENDING: js->pub.state = EDG_WLL_JOB_WAITING; break;
+                                       case EDG_WLL_STAT_CREAM_IDLE: js->pub.state = EDG_WLL_JOB_SCHEDULED; break;
+                                       case EDG_WLL_STAT_CREAM_RUNNING:
                                                js->pub.state = EDG_WLL_JOB_RUNNING;
                                                js->pub.jw_status = EDG_WLL_STAT_WRAPPER_RUNNING;
                                                break;
-                                       case EDG_WLL_STAT_REALLY_RUNNING:
+                                       case EDG_WLL_STAT_CREAM_REALLY_RUNNING:
                                                js->pub.state = EDG_WLL_JOB_RUNNING;
                                                js->pub.jw_status = EDG_WLL_STAT_PAYLOAD_RUNNING;
                                                break;
-                                       case EDG_WLL_STAT_HELD: /* TODO */ break;
-                                       case EDG_WLL_STAT_DONE_OK:
+                                       case EDG_WLL_STAT_CREAM_HELD: /* TODO */ break;
+                                       case EDG_WLL_STAT_CREAM_DONE_OK:
                                                js->pub.state = EDG_WLL_JOB_DONE;
                                                js->pub.done_code = EDG_WLL_STAT_OK;
                                                js->pub.cream_done_code = EDG_WLL_STAT_OK;
                                                break;
-                                       case EDG_WLL_STAT_DONE_FAILED:
+                                       case EDG_WLL_STAT_CREAM_DONE_FAILED:
                                                js->pub.state = EDG_WLL_JOB_DONE;
                                                js->pub.done_code = EDG_WLL_STAT_FAILED;
                                                js->pub.cream_done_code = EDG_WLL_STAT_FAILED;
                                                break;
-                                       case EDG_WLL_STAT_ABORTED: js->pub.state = EDG_WLL_JOB_ABORTED; break;
+                                       case EDG_WLL_STAT_CREAM_CANCELLED: js->pub.state = EDG_WLL_JOB_CANCELLED; break;
+                                       case EDG_WLL_STAT_CREAM_ABORTED: js->pub.state = EDG_WLL_JOB_ABORTED; break;
+                                       case EDG_WLL_STAT_CREAM_PURGED: js->pub.state = EDG_WLL_JOB_CLEARED; break;
                                }
                        }
                        break;
index 211eb0c..daa9d76 100644 (file)
@@ -144,15 +144,17 @@ _pad_     25
 
 int    cream_state     CREAM job state
        _null_  -1
-       _code_  REGISTERED      registered
-       _code_  PENDING         pending
-       _code_  IDLE            idle
-       _code_  RUNNING         running
-       _code_  REALLY-RUNNING  really-running
-       _code_  HELD            held
-       _code_  DONE-OK         done-ok
-       _code_  DONE-FAILED     done-failed
-       _code_  ABORTED         aborted
+       _code_  CREAM_REGISTERED        registered
+       _code_  CREAM_PENDING           pending
+       _code_  CREAM_IDLE              idle
+       _code_  CREAM_RUNNING           running
+       _code_  CREAM_REALLY-RUNNING    really-running
+       _code_  CREAM_HELD              held
+       _code_  CREAM_DONE-OK           done-ok
+       _code_  CREAM_DONE-FAILED       done-failed
+       _code_  CREAM_ABORTED           aborted
+       _code_  CREAM_CANCELLED         cancelled
+       _code_  CREAM_PURGED            purged
 
 string  cream_id               CREAM local job id
 string cream_owner             Job owner