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;
}
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);
/* 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
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 {
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);
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;
}
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));
}
-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;