in job state, show only the value of user tag of unique name that was logged with...
authorMiloš Mulač <mulac@civ.zcu.cz>
Fri, 17 Oct 2008 13:05:57 +0000 (13:05 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Fri, 17 Oct 2008 13:05:57 +0000 (13:05 +0000)
org.glite.lb.server/src/jobstat_supp.c
org.glite.lb.state-machine/interface/intjobstat.h
org.glite.lb.state-machine/interface/seqcode_aux.h
org.glite.lb.state-machine/src/process_event.c
org.glite.lb.state-machine/src/seqcode_aux.c

index ae5842c..2619550 100644 (file)
@@ -640,6 +640,7 @@ char *enc_intJobStat(char *old, intJobStat* stat)
        if (ret) ret = enc_branch_states(ret, stat->branch_states);
        if (ret) ret = enc_timeval(ret, stat->last_pbs_event_timestamp);
        if (ret) ret = enc_int(ret, stat->pbs_reruning);
+       if (ret) ret = enc_strlist(ret, stat->tag_seq_codes);
        return ret;
 }
 
@@ -682,6 +683,9 @@ intJobStat* dec_intJobStat(char *in, char **rest)
                if (tmp_in != NULL) {
                        stat->pbs_reruning = dec_int(tmp_in, &tmp_in);
                }
+               if (tmp_in != NULL) {
+                       stat->tag_seq_codes = dec_strlist(tmp_in, &tmp_in);
+               }
        } else if (tmp_in != NULL) {
                edg_wll_FreeStatus(pubstat);
                free(pubstat);
index eb43b49..50d2f3e 100644 (file)
@@ -14,7 +14,7 @@
 /* where Z.XX is version from indent + 1 (version after commit), Y = Z+1 */
 /* and DESCRIPTION is short hit why version changed            */
 
-#define INTSTAT_VERSION "revision 2.5 - proxy merge"
+#define INTSTAT_VERSION "revision 2.6 - user tag sequences"
 
 
 // Internal error codes 
@@ -58,8 +58,10 @@ typedef struct _intJobStat {
 
                struct timeval  last_pbs_event_timestamp;
                int             pbs_reruning;           // true if rerun event arrived
+               char            **tag_seq_codes;
 
-               /*!! if adding new field, modify also destroy_intJobStat_extension() */
+               /*!! if adding new field, modify also destroy_intJobStat_extension()    *
+                *!! update dec/enc_intJobStat and increase INTSTAT_VERSION             */
        } intJobStat;
 
 typedef enum _edg_wll_PBSEventSource {
index 4c0ec24..d4b5979 100644 (file)
@@ -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);
+int add_taglist(const char *new_item, const char *new_item2, const char *seq_code, intJobStat *js);
index 70b39c3..9a95633 100644 (file)
@@ -904,8 +904,7 @@ static int processEvent_glite(intJobStat *js, edg_wll_Event *e, int ev_seq, int
                case EDG_WLL_EVENT_USERTAG:
                        if (USABLE_DATA(res, strict)) {
                                if (e->userTag.name != NULL && e->userTag.value != NULL) {
-                                       add_taglist(&js->pub.user_tags, 
-                                                   e->userTag.name, e->userTag.value);
+                                       add_taglist(e->userTag.name, e->userTag.value, e->any.seqcode, js);
                                } else {
                                        goto bad_event;
                                }
@@ -1034,6 +1033,12 @@ void destroy_intJobStat_extension(intJobStat *p)
        if (p->last_branch_seqcode) free(p->last_branch_seqcode);
        if (p->deep_resubmit_seqcode) free(p->deep_resubmit_seqcode);
        free_branch_state(&p->branch_states);
+       if (p->tag_seq_codes) {
+               int     i;
+               
+               for (i=0; p->tag_seq_codes[i]; i++) free(p->tag_seq_codes[i]);
+               free(p->tag_seq_codes);
+       }
 
        memset(p,0,sizeof(*p));
 }
index 8bd3248..c20c627 100644 (file)
@@ -281,32 +281,50 @@ 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)
+int add_taglist(const char *new_item, const char *new_item2, const char *seq_code, intJobStat *js)
 {
        edg_wll_TagValue        *itptr;
        int                     i;
 
-       if (*lptr == NULL) {
+       if (js->pub.user_tags == 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;
+               js->pub.user_tags = itptr;
+       
+               js->tag_seq_codes = (char **) calloc(2,sizeof(char *));
+               js->tag_seq_codes[0] = strdup(seq_code);
+
                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;
+               for (i = 0, itptr = js->pub.user_tags; itptr[i].tag != NULL; i++) {
+                       if ( !strcasecmp(itptr[i].tag, new_item)) {
+                               if (edg_wll_compare_seq(seq_code,js->tag_seq_codes[i]) == 1) {
+                                       free(itptr[i].value);
+                                       itptr[i].value = strdup(new_item2);
+
+                                       free(js->tag_seq_codes[i]);
+                                       js->tag_seq_codes[i] = strdup(seq_code);
+
+                                       return 1;
+                               }
+                               else return 1;
                        }
-               itptr = (edg_wll_TagValue *) realloc(*lptr, (i+2)*sizeof(edg_wll_TagValue));
-               if (itptr != NULL) {
+               }
+
+               itptr = (edg_wll_TagValue *) realloc(js->pub.user_tags, (i+2)*sizeof(edg_wll_TagValue));
+               js->tag_seq_codes = (char **) realloc(js->tag_seq_codes, (i+2) * sizeof(char *));
+
+               if (itptr != NULL && js->tag_seq_codes != 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;
+                       js->pub.user_tags = itptr;
+                       
+                       js->tag_seq_codes[i] = strdup(seq_code);
+                       js->tag_seq_codes[i+1] = NULL;
+
                        return 1;
                } else {
                        return 0;