From 2b23eae6197baafe90eb672f7d7a4e75793b6486 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Milo=C5=A1=20Mula=C4=8D?= Date: Mon, 14 May 2007 11:23:20 +0000 Subject: [PATCH] - print histograms in CollectionState event correctly (merge with 3.1 branch) - decrement histograms first => correct values of histogram in CollectionState event - set DoneCode of collection w.r.t. children_done_hist histogram --- org.glite.lb.server/src/jobstat.c | 80 ++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 34 deletions(-) diff --git a/org.glite.lb.server/src/jobstat.c b/org.glite.lb.server/src/jobstat.c index 052bb62..2e74c9b 100644 --- a/org.glite.lb.server/src/jobstat.c +++ b/org.glite.lb.server/src/jobstat.c @@ -710,10 +710,10 @@ static char* hist_to_string(int * hist) assert(hist[0] == EDG_WLL_NUMBER_OF_STATCODES); - asprintf(&s, "%s=%d", edg_wll_StatToString(1), hist[1]); + asprintf(&s, "%s=%d", edg_wll_StatToString(1), hist[2]); - for (i=1; ipub.children_hist[old_state+1]--; + update_hist = 1; + break; + case EDG_WLL_JOB_DONE: + if (load_parent_intJobStat(ctx, cis, &pis)) goto err; + pis->pub.children_hist[old_state+1]--; + pis->children_done_hist[old_done_code]--; + update_hist = 1; + break; + case EDG_WLL_JOB_CLEARED: + if (load_parent_intJobStat(ctx, cis, &pis)) goto err; + pis->pub.children_hist[old_state+1]--; + update_hist = 1; + break; + default: + if (load_parent_intJobStat(ctx, cis, &pis)) goto err; + pis->pub.children_hist[EDG_WLL_JOB_UNKNOWN+1]--; + // update_hist = 1; - triggered by the previous case or not needed + break; + } + /* Increment histogram for interesting states and * cook artificial events to enable parent job state shift */ @@ -845,9 +871,22 @@ static edg_wll_ErrorCode update_parent_status(edg_wll_Context ctx, edg_wll_JobSt if (pis->pub.children_hist[cis->pub.state+1] == pis->pub.children_num) { /* not DONE yet? */ if (pis->pub.state < EDG_WLL_JOB_DONE) { - if (log_collectionState_event(ctx, cis->pub.state, - cis->pub.done_code, cis, pis, ce)) - goto err; + if (pis->children_done_hist[EDG_WLL_STAT_FAILED]) { + if (log_collectionState_event(ctx, cis->pub.state, + EDG_WLL_STAT_FAILED, cis, pis, ce)) + goto err; + } + /* XXX: is this meaningful semantics? + else if (pis->children_done_hist[EDG_WLL_STAT_CANCELLED]) { + if (log_collectionState_event(ctx, cis->pub.state, + EDG_WLL_STAT_CANCELLED, cis, pis, ce)) + goto err; + } + */ + else + if (log_collectionState_event(ctx, cis->pub.state, + EDG_WLL_STAT_OK, cis, pis, ce)) + goto err; } } } @@ -862,7 +901,7 @@ static edg_wll_ErrorCode update_parent_status(edg_wll_Context ctx, edg_wll_JobSt /* not CLEARED yet? */ if (pis->pub.state < EDG_WLL_JOB_CLEARED) { if (log_collectionState_event(ctx, cis->pub.state, - cis->pub.done_code, cis, pis, ce)) + 0, cis, pis, ce)) goto err; } } @@ -876,33 +915,6 @@ static edg_wll_ErrorCode update_parent_status(edg_wll_Context ctx, edg_wll_JobSt break; } - - /* Decrement histogram for interesting states - */ - switch (old_state) { - case EDG_WLL_JOB_RUNNING: - if (load_parent_intJobStat(ctx, cis, &pis)) goto err; - pis->pub.children_hist[old_state+1]--; - update_hist = 1; - break; - case EDG_WLL_JOB_DONE: - if (load_parent_intJobStat(ctx, cis, &pis)) goto err; - pis->pub.children_hist[old_state+1]--; - pis->children_done_hist[old_done_code]--; - update_hist = 1; - break; - case EDG_WLL_JOB_CLEARED: - if (load_parent_intJobStat(ctx, cis, &pis)) goto err; - pis->pub.children_hist[old_state+1]--; - update_hist = 1; - break; - default: - if (load_parent_intJobStat(ctx, cis, &pis)) goto err; - pis->pub.children_hist[EDG_WLL_JOB_UNKNOWN+1]--; - // update_hist = 1; - triggered by the previous case or not needed - break; - } - if (update_hist) edg_wll_StoreSubjobHistogram(ctx, cis->pub.parent_job, pis); -- 1.8.2.3