Skip to content

Commit a767a83

Browse files
committed
perilog: raise non-fatal job exception on epilog failure
Problem: Job epilog failures do not raise job exceptions. This made sense when the epilog was used for administrative purposes, but now that most of that has moved to housekeeping, the epilog is meant to include cleanup necessary for job completion, and therefore an epilog failure should be reflected in the job eventlog and the user notified. Raise a non-fatal job exception on epilog failure. A non-fatal exception is used so that it does influence the job status while still allowing the exception to be logged. Fixes #6249
1 parent fce96cd commit a767a83

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/modules/job-manager/plugins/perilog.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,13 +438,28 @@ static void emit_finish_event (struct perilog_proc *proc,
438438
status);
439439
}
440440
else {
441+
/*
442+
* Raise a non-fatal job exception on failure so that the job
443+
* status reflects the status of the user job and not the status
444+
* of the epilog.
445+
*/
446+
if ((status != 0 && !proc->canceled) || proc->cancel_timeout) {
447+
char *errmsg = exception_errmsg (proc, status);
448+
if (flux_jobtap_raise_exception (proc->p,
449+
proc->id,
450+
"epilog",
451+
2,
452+
"%s",
453+
errmsg ?
454+
errmsg :
455+
"job epilog failed") < 0)
456+
flux_log_error (flux_jobtap_get_flux (proc->p),
457+
"epilog-finish: jobtap_raise_exception");
458+
free (errmsg);
459+
}
441460
/*
442461
* Epilog complete: unsubscribe this plugin from the
443462
* finished job and post an epilog-finish event.
444-
*
445-
* No job exception is raised since the job is already exiting,
446-
* and it is expected that the actual epilog script will
447-
* drain nodes or take other action on failure if necessary.
448463
*/
449464
flux_jobtap_job_unsubscribe (proc->p, proc->id);
450465
if (flux_jobtap_epilog_finish (proc->p,

0 commit comments

Comments
 (0)