From 79cf9ffef974c8b6da0ab03376fa743c60498382 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Milo=C5=A1=20Mula=C4=8D?= Date: Thu, 22 Feb 2007 16:29:46 +0000 Subject: [PATCH] event code added to PBS seq code - enables semi-smart sorting --- org.glite.lb.common/interface/context-int.h | 6 ++++-- org.glite.lb.server/src/jobstat_supp.c | 16 ++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/org.glite.lb.common/interface/context-int.h b/org.glite.lb.common/interface/context-int.h index aa284a9..69ac0d6 100644 --- a/org.glite.lb.common/interface/context-int.h +++ b/org.glite.lb.common/interface/context-int.h @@ -14,8 +14,9 @@ extern "C" { #endif #define EDG_WLL_SEQ_NULL "UI=000000:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000" +#define EDG_WLL_SEQ_PBS_NULL "TIMESTAMP=00000000000000:POS=0000000000:EV.CODE=000:SRC=?" #define EDG_WLL_SEQ_SIZE 103 /* strlen(EDG_WLL_SEQ_NULL)+1 */ -#define EDG_WLL_SEQ_PBS_SIZE 45 /* strlen(EDG_WLL_SEQ_PBS_NULL)+1 */ +#define EDG_WLL_SEQ_PBS_SIZE 57 /* strlen(EDG_WLL_SEQ_PBS_NULL)+1 */ typedef struct _edg_wll_SeqCode { unsigned int type; /* seq code type */ @@ -23,7 +24,8 @@ typedef struct _edg_wll_SeqCode { char pbs[EDG_WLL_SEQ_PBS_SIZE]; /* PBS seq. code */ /* 0-24 TIMESTAMP=YYYYMMDDHHMMSS: */ /* 25-39 POS=%010u: */ - /* 40-44 SRC=%c */ + /* 40-51 EV.CODE=%03d: */ + /* 53-56 SRC=%c */ } edg_wll_SeqCode; diff --git a/org.glite.lb.server/src/jobstat_supp.c b/org.glite.lb.server/src/jobstat_supp.c index ff55d29..f55a204 100644 --- a/org.glite.lb.server/src/jobstat_supp.c +++ b/org.glite.lb.server/src/jobstat_supp.c @@ -824,26 +824,30 @@ int same_branch(const char *a, const char *b) int edg_wll_compare_pbs_seq(const char *a,const char *b) { - char timestamp_a[14], pos_a[10], src_a; - char timestamp_b[14], pos_b[10], src_b; + char timestamp_a[14], pos_a[10], ev_code_a, src_a; + char timestamp_b[14], pos_b[10], ev_code_b, src_b; int res; - res = sscanf(a,"TIMESTAMP=%14s:POS=%10s:SRC=%c", ×tamp_a, &pos_a, &src_a); + res = sscanf(a,"TIMESTAMP=%14s:POS=%10s:EV.CODE=%3d:SRC=%c", ×tamp_a, &pos_a, &ev_code_a, &src_a); - if (res != 3) { + if (res != 4) { syslog(LOG_ERR, "unparsable sequence code %s\n", a); fprintf(stderr, "unparsable sequence code %s\n", a); return -1; } - res = sscanf(b,"TIMESTAMP=%14s:POS=%10s:SRC=%c", ×tamp_b, &pos_b, &src_b); + res = sscanf(b,"TIMESTAMP=%14s:POS=%10s:EV.CODE=%3d:SRC=%c", ×tamp_b, &pos_b, &ev_code_b, &src_b); - if (res != 3) { + if (res != 4) { syslog(LOG_ERR, "unparsable sequence code %s\n", b); fprintf(stderr, "unparsable sequence code %s\n", b); return -1; } + /* wild card for PBSJobReg - this event should always come as firt one */ + /* bacause it hold job.type, which is necessary for further event processing */ + if (ev_code_a == EDG_WLL_EVENT_REGJOB) return -1; + if (ev_code_b == EDG_WLL_EVENT_REGJOB) return 1; /* sort event w.t.r. to timestamps */ if ((res = strcmp(timestamp_a,timestamp_b)) != 0) { -- 1.8.2.3