Support for PBSRerun event
authorMiloš Mulač <mulac@civ.zcu.cz>
Fri, 16 Mar 2007 15:17:43 +0000 (15:17 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Fri, 16 Mar 2007 15:17:43 +0000 (15:17 +0000)
- needs testing

org.glite.lb.server/src/jobstat.h
org.glite.lb.server/src/jobstat_supp.c
org.glite.lb.server/src/process_event_pbs.c
org.glite.lb/project/events.T

index f21bbdd..84f3e32 100644 (file)
@@ -55,6 +55,7 @@ typedef struct _intJobStat {
 /*             int             expect_mask; */
                int             children_done_hist[EDG_WLL_NUMBER_OF_DONE_CODES];
                struct timeval  last_pbs_event_timestamp;
+               int             pbs_reruning;           // true if rerun event arrived
        } intJobStat;
 
 typedef enum _edg_wll_PBSEventSource {
index f55a204..f88a8ab 100644 (file)
@@ -590,6 +590,7 @@ char *enc_intJobStat(char *old, intJobStat* stat)
        if (ret) ret = enc_branch_states(ret, stat->branch_states);
        if (ret) ret = enc_int_array(ret, stat->children_done_hist, EDG_WLL_NUMBER_OF_DONE_CODES-1);
        if (ret) ret = enc_timeval(ret, stat->last_pbs_event_timestamp);
+       if (ret) ret = enc_string(ret, stat->pbs_reruning);
        return ret;
 }
 
@@ -632,6 +633,9 @@ intJobStat* dec_intJobStat(char *in, char **rest)
                if (tmp_in != NULL) {
                        stat->last_pbs_event_timestamp = dec_timeval(tmp_in, &tmp_in);
                }
+               if (tmp_in != NULL) {
+                       stat->pbs_reruning = dec_string(tmp_in, &tmp_in);
+               }
        } else if (tmp_in != NULL) {
                edg_wll_FreeStatus(pubstat);
                free(pubstat);
index f3c6ae7..903ca43 100644 (file)
@@ -84,6 +84,7 @@ int processEvent_PBS(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, c
                        if (USABLE(res)) {
                                js->pub.state = EDG_WLL_JOB_WAITING;
                                rep(js->pub.pbs_state, "Q");
+                               js->pbs_reruning = 0;           // reset possible reruning flag
                        }
                        if (USABLE_DATA(res)) {
                                rep_cond(js->pub.pbs_reason,e->PBSPending.reason);
@@ -111,11 +112,45 @@ int processEvent_PBS(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, c
                                js->pub.pbs_pid = e->PBSRun.pid;
                        }
                        break;
+               case EDG_WLL_EVENT_PBSRERUN:
+                       if (USABLE(res)) {
+                               switch (get_pbs_event_source(e->any.seqcode)) {
+                                       case EDG_WLL_PBS_EVENT_SOURCE_SERVER:
+                                               js->pub.state = EDG_WLL_JOB_WAITING;
+                                               rep(js->pub.pbs_state, "Q");
+                                               break;
+                                       case EDG_WLL_PBS_EVENT_SOURCE_MOM:
+                                               js->pub.state = EDG_WLL_JOB_WAITING;
+                                               rep(js->pub.pbs_state, "E");
+                                               js->pbs_reruning = 1;
+                                               break;
+                                       default:
+                                               assert(0); // running event from strande source
+                                               break;
+                               }
+                       }
+                       if (USABLE_DATA(res)) {
+                       }
+                       break;
                case EDG_WLL_EVENT_PBSDONE:
                        if (USABLE(res)) {
-                               js->pub.state = EDG_WLL_JOB_DONE;
-                               js->pub.done_code = EDG_WLL_STAT_OK;
-                               rep(js->pub.pbs_state, "C");
+                               switch (get_pbs_event_source(e->any.seqcode)) {
+                                       case EDG_WLL_PBS_EVENT_SOURCE_SERVER:
+                                               js->pub.state = EDG_WLL_JOB_DONE;
+                                               js->pub.done_code = EDG_WLL_STAT_OK;
+                                               rep(js->pub.pbs_state, "C");
+                                               break;
+                                       case EDG_WLL_PBS_EVENT_SOURCE_MOM:
+                                               if (!js->pbs_reruning) {
+                                                       js->pub.state = EDG_WLL_JOB_DONE;
+                                                       js->pub.done_code = EDG_WLL_STAT_OK;
+                                                       rep(js->pub.pbs_state, "C");
+                                               }
+                                               break;
+                                       default:
+                                               assert(0); //done event from strange source
+                                               break;
+                               }
                        }
                        if (USABLE_DATA(res)) {
                                js->pub.pbs_exit_status =  e->PBSDone.exit_status;      
index 879b58d..f81a989 100644 (file)
        int     pid             Actual process ID
        _optional_
 
+@type PBSRerun            Job rerun requested
+
 @type PBSDone          Job terminated
        int     exit_status     Exit status
        _optional_              Bypass need of 'null value'