Receive and answer escalations¶
sup, err := supervise.New(backend, store, supervise.WithDeliver(
func(ctx context.Context, job dispatch.JobID, e dispatch.Escalation) error {
return pager.Send(ctx, fmt.Sprintf("dispatch job %s: %s (%s)", job, e.Detail, e.ID))
},
))
An escalation is dispatch asking a person to decide something it won't decide alone. After each
pass's steps, the supervisor calls your Deliver function for each escalation the record held,
undelivered, when the pass began, and records it as delivered when your function returns nil. An
escalation the pass itself committed is delivered after the next pass; when that pass settled the
job, the supervisor's last look, which finds the record settled, delivers it before Run returns.
Return an error and it's offered again after the next pass, except on that last look: once the job
has settled, Run returns after one attempt.
pager.Send stands for whatever reaches a person in your setup.
Read escalations without a supervisor¶
Escalations are in the record, not in Status. Fold the record to read them:
v, err := store.Read(ctx, job)
if err != nil {
return err
}
j, err := dispatch.Fold(v, time.Now())
if err != nil {
return err
}
for _, e := range j.Escalations {
fmt.Println(e.ID, e.At, e.Delivered.IsZero(), e.Detail)
}
Each escalation is committed once, keyed by its ID, so you can deduplicate on it.
Answer it by its id¶
The id's prefix says what happened. All the calls below are on the cluster's Operator, and each
needs an Actor naming who answered.
overdue:<instance>, a hold past its deadline¶
The hold stays in force; dispatch never releases or fails a job on its own. Decide, then:
- for a hold an actor placed,
Release(ctx, job, by)lets the job run again; - for a recovery hold, which a
holdrule placed after an execution ended,Releaseis refused. UseResubmit(ctx, job, by, reason)to run a new submission,Cancel, orGiveUp(ctx, job, by, reason)to fail the job with the cause that ended it.
Status.Hold.Kind says which kind it is. Releasing a hold someone else placed works, and the
record notes that you overrode it.
all-unknown:<N> or unmatched:<N>/<a>, a launch whose outcome nobody knows¶
A Start call's outcome stayed unknown for at least the job's unresolved age, 10 minutes unless
WithUnresolvedAge set it, and no object turned up for it.
Check the scheduler for an object named dj-<job id>. If there's none, close it:
target := dispatch.AbandonTarget{Submission: 2} // all-unknown:2
target = dispatch.AbandonTarget{Submission: 2, Attempt: 1} // unmatched:2/1
err := op.Abandon(ctx, job, target, human, "no such job in squeue")
Only a human actor may abandon. After an all-unknown submission is abandoned, the supervisor
launches the next one. Choose an unmatched policy explains when
unmatched escalations happen.
foreign:<object id>, an object with the job's name that isn't dispatch's¶
The scheduler has an object named for this job that isn't dispatch's. The escalation's detail gives the adapter's reason. The common ones:
- A rewritten object. Its submission and attempt can't be read from it: on Slurm its comment doesn't parse, and on Kubeflow its annotations don't, perhaps because a site plugin or a person rewrote them. Find who did, and whether the object should run.
- An object changed under dispatch. On Kubeflow, a runtime snapshot edited outside dispatch, a JobSet recreated under its TrainJob, so its restart count may have been reset, or pods of an earlier JobSet still running beside the live one. Find what changed it.
- An orphan cut loose from its owner. On Kubeflow, a JobSet or pod left behind when its TrainJob
was deleted with
Orphanpropagation (see background deletion). It is a leftover of this job, and usually it should be stopped.
Whatever the reason, it blocks the record from settling, and dispatch never adopts it. While the
job runs, supervising it leaves the object alone. A stop of the whole job is different: Cancel,
EmergencyStop, and a supervised job once it is cancelled stop every object named for the job,
foreign or not, so finish with an object you need before you cancel. On Kubeflow, renaming a
TrainJob or a pod is no shelter, since those are also found by the job's label. If the object
shouldn't run, stop it on the scheduler yourself, then dispose of it in the record:
err := op.Abandon(ctx, job, dispatch.AbandonTarget{Foreign: ref}, human, "orphaned JobSet, stopped by hand")
ref is the object's ObjectRef as recorded, from j.Object(...) or the job's Objects.
admin-held:<object id>, a gate an administrator holds¶
A launched object is held by someone other than dispatch: on Slurm a JobHeldAdmin hold, on
Kubeflow another gate left in the TrainJob's kueue.x-k8s.io/admission-gated-by annotation (see
the start gate). dispatch never opens it.
Ask whoever holds it, or cancel the job.
admin-held:<object id>:<restart> is the same for a job already past its gate: on Slurm, a prolog
that failed under PrologFlags=ForceRequeueOnFail requeues the job and holds it, and nothing ran.
dispatch never releases it, since a prolog that keeps failing would requeue it again. Fix the node
or the prolog, then release the job on the scheduler (scontrol release <id>), or cancel the job.
requeued:<object id>:<restart>, a requeue nobody in dispatch asked for¶
The scheduler requeued the object, and no requeue call of dispatch's accounts for it: an operator's
scontrol requeue, or Slurm requeuing the job on its own after a node failure or a preemption,
because someone set its requeue bit. The object is alive and will run again; nothing is needed for
that. The detail carries the adapter's account of who did it, as far as it can tell. Find out why
it happened, and whether the execution that was requeued may still be running somewhere.
If the job shares its checkpoint and the requeue rode on a bit dispatch didn't leave, the
supervisor also holds the requeued object, because the old execution may still be writing the
checkpoint. It asks the cessation signal every dispatch.CessationInterval, and releases the hold
itself once the answer says the old execution stopped. You can release it sooner with
op.Release, which is recorded as an override; past its deadline, 24 hours, the hold escalates
as overdue:.
requeue-bit:<object id>:<restart>, a requeue bit someone else set¶
The object's requeue bit is set, and dispatch didn't leave it: on Slurm someone ran scontrol update
Requeue=1 on the job, or requeued it by hand. dispatch never clears a bit it didn't set, because an
operator who sets one most likely wants the scheduler to requeue the job. While it stays set, Slurm
may requeue the job on its own after a node failure or a preemption, which then escalates as
requeued:. If nobody meant it, clear it on the scheduler (scontrol update JobId=<id> Requeue=0).
On a job that shares its checkpoint, the detail says so: a requeue on that bit can start a new
execution while the old one is still writing the checkpoint.
end-unread:<N>:<object id>, an end history can't give yet¶
The job's execution ended while no supervisor saw it, the scheduler has forgotten it, and its
history couldn't say how it ended: on Slurm, slurmdbd is down or still catching up. The detail is
the first error. Nothing needs doing. The supervisor reads history again on every pass, and the
first end it reads is the job's end. If history stays unreadable for the job's history wait (an hour
unless WithHistoryWait set it), the job fails as failed:unknown, with the wait named in the
detail. If you expect a longer outage, fix the accounting service; a job submitted with a longer
wait rides it out.
find-omitted:<N>:<object id>, history and the scheduler disagree¶
History says the object is alive, though the scheduler's own listing no longer shows it. That is a fault in the adapter or the scheduler, and dispatch won't guess which is right: the job waits for you, however long. Check the object on the scheduler by its id. If it runs, let it finish or stop it; either way, give the job up or cancel it, and the supervisor sends the object a best-effort stop before it closes the record. If history later says ended or not found, the job concludes on its own.
unplaced:<cause>:<object id>:<restart>, an end this build can't place¶
The execution ended with a cause kind a newer build of dispatch wrote, which this build doesn't
know. Nothing is committed but the escalation: the job stays recovering, its record open, and this
build's supervisor hands the job back. Run a supervisor built on the newer dispatch, and it decides
from the recorded end under the job's policy. Otherwise end the job yourself with GiveUp, which
records it failed with your reason, or Cancel. Resubmit is refused, because no recovery hold
was placed.
failed:<cause> or refused:<N>, the job failed¶
The outcome is already committed and final. The detail says why: no rule covers the cause, the
rule's budget is spent, or (for refused) the scheduler refused every attempt to launch. To run
the job again, create a new job from it:
The new job has the same spec, a new id, and names the old one in Status.Supersedes. Its
executions get a higher DISPATCH_EPOCH, so they outrank every checkpoint the old job published
and can still resume from them.
cleanup-deadline, a cancelled job still stopping¶
The job has an outcome, and its record still hasn't settled more than the job's clean-up deadline
after the cancel, or after the outcome if nobody cancelled. The deadline is 30 minutes unless
WithCleanupDeadline set it. The detail names the objects still alive. Either something of the job
is still alive on the scheduler, or something else holds the record open: a launch whose outcome is
unknown, or a foreign object, each of which has its own escalation above. For objects that won't
stop, stop them on the scheduler or with cluster.Stopper().EmergencyStop(ctx, job, by, reason).
This escalation is committed once per job.
give-up¶
Someone called GiveUp. It records the decision; there's nothing to answer.
Related¶
- Escalations, the full list of ids and when each is committed.
- Errors and sentinels, for what each
Operatorcall refuses.