Skip to content

Add pipeline stop; stop hiding jobs in job list - #61

Merged
abhi18av merged 2 commits into
mainfrom
fix/job-list-truncation
Sep 6, 2026
Merged

abhi18av merged 2 commits into
mainfrom
fix/job-list-truncation

Conversation

@abhi18av

@abhi18av abhi18av commented Sep 5, 2026

Copy link
Copy Markdown
Member

Addresses §3 and §4 of
brainstorms/abc-cluster-cli/2026-09-05-pipeline-run-lifecycle-and-config-precedence.md.

§3 — abc pipeline stop <run>

Stopping the head does not stop a run. The head has already submitted its
worker jobs to Nomad, which keeps running them and keeps starting queued ones
as capacity frees. The report describes draining that by hand in more than a
dozen rounds, seven at a time, with the next seven starting immediately.

The new command stops the head first — so it cannot submit more work during
the drain — then the workers. It takes the head id, any worker id, or the bare
run tag.

Definitions are kept by default, since the server disables GC deliberately so
run records stay queryable; --purge removes them, --dry-run shows the set.

Membership comes from job meta, not the name. nf-nomad stamps the
correlation onto every worker:

nf_head_job_id    abhinav-1788623348-nf-head-nf-core-demo
nf_head_alloc_id  29d5183f-93f7-5a33-cee8-38106d017d24
nf_session_name   abhinav-1788623348
abc_run_name      abhinav-1788623348-nf-head-nf-core-demo

Present on 25/25 sampled workers. The name prefix only narrows candidates
cheaply (the list stub carries no Meta, so confirming costs one GetJob per
candidate, bounded by one run's size). This rejects a neighbouring run sharing
an id prefix, and identifies the head by what it declares rather than by the
-nf-head- substring. Script jobs are rejected outright rather than
prefix-matched.

Verified on seedling-prod against a real orphan. Run abhinav-1788623348
had a dead head and seven workers still pending — exactly the report's
scenario. pipeline stop found all seven and cleared them; a second call
reports nothing running. They stayed stopped without --purge.

§4 — job list was hiding most jobs

It fetched every job, then truncated to --limit (default 20) in Nomad's own
ID-ascending order. Pipeline jobs are named abhinav-<runid>-…, which sorts
after abc-… and abhin-script-job-…, so they were never visible at the
default limit however recent.

That is what made show and list look inconsistent. On this cluster:

before after
default view 20 of 293, silently 20 of 293, and says so
ordering ID-ascending newest first
job list | grep -c SELECT_ 0 97

Now filtered, then sorted newest-first, then limited, with a line stating when
the view is partial.

Not in this PR

§1 (queueSize in the pipeline's config silently overridden by the generated
head config) and §2 (a blocked placement reported as a task failure and
retried) are untouched.

Worth noting on §2: the quoted symptom is
WARN: [NOMAD] Cannot determine exit status for task, which is the nf-nomad
defect fixed in nextflow-io/nf-nomad#148, and placement classification was
fixed in #145 (released as 0.5.0-edge4). Some of §2 may already be addressed
plugin-side once the cluster picks up a release carrying both.

Full suite green.

Two of the four defects in the pipeline-run-lifecycle report. Both are about
not being able to see or stop what a run left behind.

`abc pipeline stop <run>` stops a run and every worker job it submitted.

Stopping the head does not stop a run: the head has already submitted its
workers to Nomad, which keeps running them and keeps starting queued ones as
capacity frees. Draining that by hand took repeated rounds of grepping
`abc infra compute show` and stopping seven at a time while the next seven
started.

The head and every worker share a `<user>-<runid>` prefix, so the set is
addressable in one operation. The argument accepts the head id, any worker id,
or the bare tag. The head is stopped first so it cannot submit more work
during the drain. Script jobs are rejected rather than prefix-matched.

Definitions are kept by default — the server disables GC deliberately so run
records stay queryable — with `--purge` to remove them, plus `--dry-run`.

Verified on seedling-prod against a real orphan: run abhinav-1788623348 had a
dead head and seven workers still pending. `pipeline stop` found all seven and
cleared them; a second call reports nothing running.

`job list` was hiding most jobs.

It fetched every job, then truncated to --limit (default 20) in Nomad's own
ID-ascending order. Pipeline jobs are named `abhinav-<runid>-…`, which sorts
after `abc-…` and `abhin-script-job-…`, so they were never visible at the
default limit however recent — `abc job show` would find a running job that
`abc job list | grep` reported nothing for. On this cluster the default view
showed 20 of 293, and `abc job list | grep -c SELECT_` returned 0 while 97
such jobs existed.

Now filtered, then sorted newest-first, then limited, and it says when the view
is partial. The report read this as `list` and `show` disagreeing; it was
silent truncation.
nf-nomad stamps the correlation onto every worker job it submits:

    nf_head_job_id    abhinav-1788623348-nf-head-nf-core-demo
    nf_head_alloc_id  29d5183f-93f7-5a33-cee8-38106d017d24
    nf_session_name   abhinav-1788623348
    abc_run_name      abhinav-1788623348-nf-head-nf-core-demo

Present on 25/25 sampled workers on seedling-prod. That is authoritative;
the name prefix is a cheap way to narrow candidates, not a membership test.

Two things it fixes:

  - a neighbouring run whose id merely shares a prefix (1788623348 vs
    17886233480) is now rejected instead of swept up;
  - the head is identified by nf_head_job_id rather than by the "-nf-head-"
    substring, which was guesswork about a naming convention.

The job LIST stub carries no Meta, so this costs one GetJob per candidate,
bounded by the size of a single run. A job carrying no meta at all falls back
to the name match rather than being dropped.
@abhi18av
abhi18av merged commit c8fc0de into main Sep 6, 2026
@abhi18av
abhi18av deleted the fix/job-list-truncation branch September 6, 2026 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant