service.backend¶
The backend the service runs workflows on: Argo Workflows, or a fake in tests.
FailedAttempt
¶
Bases: BaseModel
An attempt of a pod which failed.
Attributes:
| Name | Type | Description |
|---|---|---|
attempt |
int
|
The number of the attempt, from 0, as the pod has it in
|
exit_code |
int | None
|
The exit code of its main container, None without one (e.g. a pod deleted by an eviction of Kueue). |
oom_killed |
bool
|
Whether the main container was killed by the out of memory
killer (the reason |
PodLog
¶
Bases: BaseModel
The log of the main container of one pod (one attempt) of a task.
Attributes:
| Name | Type | Description |
|---|---|---|
node |
str
|
The node of the pod in the workflow, e.g. |
pod |
str
|
The name of the pod. |
text |
str
|
The log. |
done |
bool
|
Whether the pod has terminated, so its log is complete. |
Placement
¶
Bases: BaseModel
A pod of a run which has not terminated, with its node and requests.
Attributes:
| Name | Type | Description |
|---|---|---|
workflow |
str
|
The backend name of the run. |
dag_task |
str
|
The DAG task of the pod: |
pod |
str
|
Name of the pod. |
node |
str | None
|
The node the pod is bound to, |
phase |
str
|
The phase of the pod. |
cores |
float
|
The cores the pod requests. |
memory_gb |
float
|
The GiB of memory the pod requests. |
worker |
str | None
|
The worker id of the pod ( |
attempt |
int | None
|
The attempt of the pod ( |
BackendStatus
¶
Bases: BaseModel
The state of a workflow in the backend.
The service, not the backend, decides the state of a run from it (see
simrun.service.controller).
Attributes:
| Name | Type | Description |
|---|---|---|
phase |
str
|
Phase of the workflow, e.g. |
tasks |
dict[str, str]
|
Phase of every node of the DAG by its name: |
failed |
dict[str, list[FailedAttempt]]
|
The attempts of pods which failed, in the order of their number: per
worker id ( |
Backend
¶
Bases: Protocol
What the service needs of a cluster.
runs_images
instance-attribute
¶
Whether the runs of the backend are containers: the service resolves the environment of a run and builds its image. False: it keeps the image of the record.
extra_workers
instance-attribute
¶
Whether a split task may run as several pods, its coordinator and extra workers. False: the service plans one pod per split task, e.g. on one machine.
submit
¶
Submit a run and return the name of its workflow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
RunRecord
|
The run, with its image set when the backend |
required |
plans
|
dict[str, TaskPlan]
|
The plan of every task by id. |
required |
types
|
dict[str, TaskType]
|
The task types by name. |
required |
cluster
|
ClusterConfig
|
The configuration of the cluster. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The name of the workflow of the run ( |
Raises:
| Type | Description |
|---|---|
ValueError
|
The run cannot be submitted (e.g. a task has no image); the message is the one of the failed run. |
subscribe
¶
Register a callback the backend calls when the status of a run changed.
The service registers the wake of its controller, so a backend which knows of a change makes it reconcile at once.
status
¶
The status of a workflow.
Raises:
| Type | Description |
|---|---|
KeyError
|
The workflow does not exist (any more). |
logs
¶
The logs of the pods of a task of a workflow, oldest first.
Every attempt whose pod still exists; tail_lines limits each log to its
last lines.
reserve
¶
Reserve a node for a run.
The node gets the taint simrun/reserved=<run id>:NoExecute and the label
simrun/reserved=<run id>.
unreserve
¶
Remove the taint and the label of the reservation of a run.
A node reserved by another run (or by none) is left as it is, so a late release never removes the reservation of a later run.
Raises:
| Type | Description |
|---|---|
KeyError
|
The node does not exist. |