half way to pbs seq.codes
authorMiloš Mulač <mulac@civ.zcu.cz>
Fri, 16 Feb 2007 16:05:58 +0000 (16:05 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Fri, 16 Feb 2007 16:05:58 +0000 (16:05 +0000)
org.glite.lb.server/src/process_event_pbs.c

index c612f02..6effac6 100644 (file)
@@ -20,6 +20,8 @@
 #define UNUSED_VAR
 #endif
 
+// XXX: maybe not needed any more
+// if not, remove also last_pbs_event_timestamp from intJobStat
 static int compare_timestamps(struct timeval a, struct timeval b)
 {
        if ( (a.tv_sec > b.tv_sec) || 
@@ -29,6 +31,11 @@ static int compare_timestamps(struct timeval a, struct timeval b)
        return 0;
 }
 
+static int compare_pbs_seqcodes(char *a, char *b) 
+{
+       return (strcmp(a,b));   // simple minded, but should work
+}
+
 // XXX move this defines into some common place to be reusable
 #define USABLE(res) ((res) == RET_OK)
 #define USABLE_DATA(res) (1)
@@ -43,8 +50,11 @@ int processEvent_PBS(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, c
 
        fputs("processEvent_PBS()",stderr);
 
-       if (compare_timestamps(js->last_pbs_event_timestamp, e->any.timestamp) > 0)
+       //if (compare_timestamps(js->last_pbs_event_timestamp, e->any.timestamp) > 0)
+       if ((js->last_seqcode != NULL) &&
+                       (compare_pbs_seqcodes(js->last_seqcode, e->any.seqcode) > 0) ) {
                res = RET_LATE; 
+       }
 
        switch (e->any.type) {
                case EDG_WLL_EVENT_REGJOB:
@@ -154,6 +164,8 @@ int processEvent_PBS(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, c
        }
 
        if (USABLE(res)) {
+               rep(js->last_seqcode, e->any.seqcode);
+
                js->pub.lastUpdateTime = e->any.timestamp;
                if (old_state != js->pub.state) {
                        js->pub.stateEnterTime = js->pub.lastUpdateTime;