Skip to content

Commit

Permalink
Merge pull request flux-framework#4738 from chu11/issue4711_job_list_…
Browse files Browse the repository at this point in the history
…purge_inactive

job-list: ensure purged jobs are inactive
  • Loading branch information
mergify[bot] authored Oct 29, 2022
2 parents 2d2c66d + 5d4e802 commit d86056c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/modules/job-list/job-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ static void purge_cb (flux_t *h,
struct job *job;

if ((job = zhashx_lookup (ctx->jsctx->index, &id))) {
if (job->state != FLUX_JOB_STATE_INACTIVE)
continue;
job_stats_purge (&ctx->jsctx->stats, job);
if (job->list_handle)
zlistx_delete (ctx->jsctx->inactive, job->list_handle);
Expand Down
1 change: 1 addition & 0 deletions t/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ dist_check_SCRIPTS = \
issues/t4482-flush-list-corruption.sh \
issues/t4583-free-range-test.sh \
issues/t4612-eventlog-overwrite-crash.sh \
issues/t4711-job-list-purge-inactive.sh \
python/__init__.py \
python/subflux.py \
python/tap \
Expand Down
26 changes: 26 additions & 0 deletions t/issues/t4711-job-list-purge-inactive.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash -e

# test-prereqs: HAVE_JQ

prejob=$(flux job stats | jq .job_states.run)

jobid=$(flux mini submit --wait-event=start sleep 100 | flux job id)

postjob=$(flux job stats | jq .job_states.run)

if [ ${postjob} -ne $((prejob + 1)) ]
then
echo "stat counts invalid: ${postjob}, ${prejob}"
exit 1
fi

flux event pub job-purge-inactive "{\"jobs\":[${jobid}]}"

# if job-list module asserted this won't work

# this is technically a bit racy, as we won't know for sure if the
# event has been received / processed by the job-list module yet. In
# the rare event the racy bit is hit and our fix regresses, subsequent
# flux actions should catch a failure.

flux job stats

0 comments on commit d86056c

Please sign in to comment.