From 3d3ff6b4649842f46a458d610601943082a58d19 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Milo=C5=A1=20Mula=C4=8D?= Date: Wed, 1 Nov 2006 15:23:33 +0000 Subject: [PATCH] Collection state Done partially working (do not distinguish OK/Fail) --- org.glite.lb.server/src/jobstat.c | 32 ++++++++++++++++++++------------ org.glite.lb.server/src/jobstat.h | 2 +- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/org.glite.lb.server/src/jobstat.c b/org.glite.lb.server/src/jobstat.c index 2549bc6..17050f8 100644 --- a/org.glite.lb.server/src/jobstat.c +++ b/org.glite.lb.server/src/jobstat.c @@ -710,7 +710,10 @@ err: } -static int log_collectionState_event(edg_wll_Context ctx, edg_wll_JobStatCode state, intJobStat *cis, intJobStat *pis, edg_wll_Event *ce) { +static int log_collectionState_event(edg_wll_Context ctx, edg_wll_JobStatCode state, intJobStat *cis, intJobStat *pis, edg_wll_Event *ce) +{ + int ret = 0; + edg_wll_Event *event = edg_wll_InitEvent(EDG_WLL_EVENT_COLLECTIONSTATE); @@ -729,10 +732,12 @@ static int log_collectionState_event(edg_wll_Context ctx, edg_wll_JobStatCode st edg_wlc_JobIdDup(cis->pub.jobId, &(event->collectionState.child)); event->collectionState.child_event = edg_wll_EventToString(ce->any.type); - trans_db_store(ctx, NULL, event, pis); + ret = trans_db_store(ctx, NULL, event, pis); edg_wll_FreeEvent(event); - free(event); + free(event); + + return ret; } @@ -753,7 +758,7 @@ static edg_wll_ErrorCode update_parent_status(edg_wll_Context ctx, edg_wll_JobSt pis->pub.children_hist[old_state+1]--; if (old_state == EDG_WLL_JOB_DONE) pis->children_done_hist[old_done_code]--; - edg_wll_SetSubjobHistogram(ctx, cis->pub.parent_job, pis); + edg_wll_StoreSubjobHistogram(ctx, cis->pub.parent_job, pis); */ /* Increment histogram for interesting states and @@ -767,19 +772,24 @@ static edg_wll_ErrorCode update_parent_status(edg_wll_Context ctx, edg_wll_JobSt if (pis->pub.jobtype == EDG_WLL_STAT_COLLECTION) { /* not RUNNING yet? */ if (pis->pub.state < EDG_WLL_JOB_RUNNING) { - log_collectionState_event(ctx, cis->pub.state, cis, pis, ce); + if (log_collectionState_event(ctx, cis->pub.state, cis, pis, ce)) + goto err; } } break; case EDG_WLL_JOB_DONE: if (load_parent_intJobStat(ctx, cis, &pis)) goto err; - pis->pub.children_hist[cis->pub.state+1]++; - pis->children_done_hist[cis->pub.done_code]++; - if (pis->pub.children_hist[cis->pub.state+1] == pis->pub.children_num) { - // XXX cook artificial event for parent job - // and call db_store + + if (pis->pub.jobtype == EDG_WLL_STAT_COLLECTION) { + 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, pis, ce)) + goto err; + } + } } break; // XXX: more cases to bo added... @@ -832,11 +842,9 @@ edg_wll_ErrorCode edg_wll_StepIntStateParent(edg_wll_Context ctx, intJobStat *ijsp, edg_wll_JobStat *stat_out) { - int flags = 0; int res; int be_strict = 0; char *errstring = NULL; - intJobStat jobstat; edg_wll_JobStat oldstat; char *oldstat_rgmaline = NULL; diff --git a/org.glite.lb.server/src/jobstat.h b/org.glite.lb.server/src/jobstat.h index 1a380a6..93f2f1d 100644 --- a/org.glite.lb.server/src/jobstat.h +++ b/org.glite.lb.server/src/jobstat.h @@ -86,6 +86,6 @@ int edg_wll_compare_seq(const char *, const char *); void init_intJobStat(intJobStat *p); edg_wll_ErrorCode edg_wll_GetSubjobHistogram(edg_wll_Context, edg_wlc_JobId parent_jobid, intJobStat **ijs); -edg_wll_ErrorCode edg_wll_SetSubjobHistogram(edg_wll_Context, edg_wlc_JobId parent_jobid, intJobStat *ijs); +edg_wll_ErrorCode edg_wll_StoreSubjobHistogram(edg_wll_Context, edg_wlc_JobId parent_jobid, intJobStat *ijs); #endif -- 1.8.2.3