Skip to content

feat: report the CANCELING and PREEMPTED states #144

Closed

Description

@uniqueg

Description

TES 1.1 adds two states and narrows one:

  • CANCELED: cancelled, and downstream resources have been deleted;
  • CANCELING: cancelled, resources still awaiting deletion;
  • PREEMPTED: stopped by the system to reclaim compute capacity.

TESK API reports CANCELED as soon as the taskmaster's job has the cancel
label (TaskStateResolver.java:52-54), while the taskmaster still stops the
running executor, and a task cancelled before its taskmaster ran can keep its
executor running. Cancelling such a task again patches it again
(Constants.java:105-110, TesServiceImpl.java:321-350). Executors that
Kubernetes preempts or evicts make the task EXECUTOR_ERROR
(TaskStateResolver.java:64-66, docs/index.md:130-133). TesState has
neither new value (TesState.java:10-28).

Proposal: CANCELING while the task is labelled cancelled and any of its
jobs (taskmaster, executors, outputs filer) has an active or pending pod;
CANCELED once none has. PREEMPTED for a failed executor job whose pod has
the condition DisruptionTarget=True (Kubernetes 1.26+) with the reason
PreemptionByScheduler.

Open question: should node shutdown (TerminationByKubelet), taints
(DeletionByTaintManager) and drains (EvictionByEvictionAPI) also count
as PREEMPTED? The specification ties it to the system reclaiming capacity;
recommendation: yes for all four, since the executor's command didn't fail,
and keep EXECUTOR_ERROR for pods without that condition.

Doesn't depend on #133/#134.

Expected result

  • TesState has CANCELING and PREEMPTED
  • A cancelled task is CANCELING until none of its jobs has an active or pending pod, then CANCELED
  • Cancelling a CANCELING task answers 200 OK and patches nothing
  • A task whose executor pod failed with DisruptionTarget (reasons as decided) is PREEMPTED, not EXECUTOR_ERROR
  • TaskStateResolverTest's decision table covers the new rules
  • docs/index.md (state rules, "Cancelling a task", the eviction paragraph) updated

Activity

  1. self-assigned this
    on Nov 12, 2026
  2. added
    type: feature
    priority: high
    status: in progress
    type flag: required by specs
    workload: hours
    on Nov 12, 2026
  3. removed
    status: in progress
    on Nov 12, 2026
  4. added this to the v2.0.0 milestone on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: hightype flag: required by specstype: featureworkload: hours

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions