Skip to main content

Module attempt

Module attempt 

Source
Expand description

One attempt on the worker, from AssignTask to Finished: what to run and how it ended.

Pure: AttemptSpec::from_assign reads the assignment, plan decides how to run it (a Python task through the runner, a command rendered here) or why not (a rejection, or a failure such as a reference that can’t be rendered), and finished turns how the process ended into the Finished message (see archive/PROJECT.md, Task assignment). Starting processes is crate::launch’s job.

Structs§

AttemptSpec
An assignment, read.
CleanupGate
The agent’s Gate for one attempt, and when the master’s word runs out: the last word plus the worker lease (None before the master told its lease).
InvalidAssignment
Why an assignment can’t be read.
Ran
How a started attempt ended.
StartTimes
How long a Python task’s process took to start, by phase.
WorkerSetup
What the worker knows to run tasks.
WorkerTimeouts
How long what a worker starts may take ([worker]).

Enums§

Gate
Whether a task’s cleanup may start here, with cleanup_anywhere: while the worker is cut off, the cleanup may be on another worker already.
NotRun
Why an attempt isn’t run as planned.
Pass
What a cleanup passing its CleanupGate runs on.
Plan
How to run an attempt.

Constants§

PROCESS_STATUS_UNKNOWN
The error kind of a forked task whose end isn’t known: its shim ended before reporting it.
RENDER_FAILED
The error kind of a command whose templates can’t be rendered (a missing or truncated input, a value with no text form).
RESOURCE_NOT_REPORTED
The error kind of a CommandResource setup that exited 0 without reporting its value.
RUNNER_FAILED
The error kind of a Python task whose runner ended without reporting a result.

Functions§

failed_before_start
The Finished message for an attempt that failed before starting.
finished
The Finished message for an attempt of task that ran. A command succeeds with an exit code of one of its outcomes (SUCCESS for 0 unless it declares others), which becomes its outcome; any other code is a failure.
plan
Plans an attempt on this worker.
plan_at
As plan, with the task’s root at root_dir: the agent’s copy of the code whose hash it reported (decision 102), so the code that runs is the code hashed whatever happens to the configured root meanwhile (git-sync moving its link and deleting the old checkout, an edit in place).
use_cleanup_script
Makes a script task run its cleanup script instead (with the task’s environment and working directory); any other task is left as it is. A setup’s own cleanup reports no value.
with_resource_value
A CommandResource setup’s result: on success its output is the value it reported, not its ProcessResult; with nothing reported (and a value declared) it fails.