From: Miloš Mulač Date: Thu, 22 May 2008 12:09:42 +0000 (+0000) Subject: PBS state automaton understands USER_TAG events now X-Git-Tag: glite-yaim-lb_R_4_0_2_1~26 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=3f42a2ff07027bbb7c1489e8067c517fcadc9216;p=jra1mw.git PBS state automaton understands USER_TAG events now --- diff --git a/org.glite.lb.state-machine/interface/seqcode_aux.h b/org.glite.lb.state-machine/interface/seqcode_aux.h index 5fd1b3a..4c0ec24 100644 --- a/org.glite.lb.state-machine/interface/seqcode_aux.h +++ b/org.glite.lb.state-machine/interface/seqcode_aux.h @@ -19,4 +19,4 @@ int edg_wll_compare_seq(const char *a, const char *b); int compare_events_by_seq(const void *a, const void *b); - +int add_taglist(edg_wll_TagValue **lptr, const char *new_item, const char *new_item2); diff --git a/org.glite.lb.state-machine/src/process_event.c b/org.glite.lb.state-machine/src/process_event.c index 0c1e739..7479ea8 100644 --- a/org.glite.lb.state-machine/src/process_event.c +++ b/org.glite.lb.state-machine/src/process_event.c @@ -86,38 +86,6 @@ static void free_stringlist(char ***lptr) } } -static int add_taglist(edg_wll_TagValue **lptr, const char *new_item, const char *new_item2) -{ - edg_wll_TagValue *itptr; - int i; - - if (*lptr == NULL) { - itptr = (edg_wll_TagValue *) calloc(2,sizeof(edg_wll_TagValue)); - itptr[0].tag = strdup(new_item); - itptr[0].value = strdup(new_item2); - *lptr = itptr; - return 1; - } else { - for (i = 0, itptr = *lptr; itptr[i].tag != NULL; i++) - if ( !strcasecmp(itptr[i].tag, new_item) ) - { - free(itptr[i].value); - itptr[i].value = strdup(new_item2); - return 1; - } - itptr = (edg_wll_TagValue *) realloc(*lptr, (i+2)*sizeof(edg_wll_TagValue)); - if (itptr != NULL) { - itptr[i].tag = strdup(new_item); - itptr[i].value = strdup(new_item2); - itptr[i+1].tag = NULL; - itptr[i+1].value = NULL; - *lptr = itptr; - return 1; - } else { - return 0; - } - } -} static void update_branch_state(char *b, char *d, char *c, char *j, branch_state **bs) diff --git a/org.glite.lb.state-machine/src/process_event_pbs.c b/org.glite.lb.state-machine/src/process_event_pbs.c index 842c5d4..9389c2f 100644 --- a/org.glite.lb.state-machine/src/process_event_pbs.c +++ b/org.glite.lb.state-machine/src/process_event_pbs.c @@ -195,6 +195,14 @@ int processEvent_PBS(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, c js->pub.pbs_error_desc = new_error_desc; } break; + case EDG_WLL_EVENT_USERTAG: + if (USABLE_DATA(res)) { + if (e->userTag.name != NULL && e->userTag.value != NULL) { + add_taglist(&js->pub.user_tags, + e->userTag.name, e->userTag.value); + } + } + break; default: break; diff --git a/org.glite.lb.state-machine/src/seqcode_aux.c b/org.glite.lb.state-machine/src/seqcode_aux.c index f1d9b90..8bd3248 100644 --- a/org.glite.lb.state-machine/src/seqcode_aux.c +++ b/org.glite.lb.state-machine/src/seqcode_aux.c @@ -279,3 +279,38 @@ int compare_events_by_seq(const void *a, const void *b) return 0; } + + +int add_taglist(edg_wll_TagValue **lptr, const char *new_item, const char *new_item2) +{ + edg_wll_TagValue *itptr; + int i; + + if (*lptr == NULL) { + itptr = (edg_wll_TagValue *) calloc(2,sizeof(edg_wll_TagValue)); + itptr[0].tag = strdup(new_item); + itptr[0].value = strdup(new_item2); + *lptr = itptr; + return 1; + } else { + for (i = 0, itptr = *lptr; itptr[i].tag != NULL; i++) + if ( !strcasecmp(itptr[i].tag, new_item) ) + { + free(itptr[i].value); + itptr[i].value = strdup(new_item2); + return 1; + } + itptr = (edg_wll_TagValue *) realloc(*lptr, (i+2)*sizeof(edg_wll_TagValue)); + if (itptr != NULL) { + itptr[i].tag = strdup(new_item); + itptr[i].value = strdup(new_item2); + itptr[i+1].tag = NULL; + itptr[i+1].value = NULL; + *lptr = itptr; + return 1; + } else { + return 0; + } + } +} +