testing¶
A backend in memory for tests of the service, advanced by the test.
FakeBackend
¶
A backend whose workflows change only when the test says so.
A submitted workflow is Pending without nodes. start sets every node
running, finish every node succeeded, fail and set_node one node,
fail_attempt and oom_kill fail attempts of a pod; finish_after finishes a
workflow that many seconds after its submission. The attempts of a pod are
numbered from 0 in the order they fail. A coordinator which merges and succeeds
writes the marker of a merge into the output of its task in store, as the
harness does, unless merges is False (the harness of simrun 0.1.0).
The calls which change the cluster are recorded in calls.
Attributes:
| Name | Type | Description |
|---|---|---|
manifests |
dict[str, dict[str, Any]]
|
The submitted manifests by name. |
subscribed |
list[Callable[[], None]]
|
The callbacks registered with |
calls |
list[tuple[Any, ...]]
|
|
images |
The images of the registry. |
|
pod_logs |
dict[tuple[str, str], list[PodLog]]
|
The logs of the pods by workflow name and task id, see |
store |
Path | None
|
The store of the service, where a coordinator which merges writes the marker of its merge; None writes none. |
merges |
Whether a coordinator which merges writes the marker. |
Create the backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nodes
|
list[Node] | None
|
The nodes of the cluster, |
None
|
finish_after
|
float | None
|
Seconds after which a submitted workflow succeeds. |
None
|
images
|
Iterable[str]
|
The images the registry has. |
()
|
submit
¶
Accept the workflow of a run, pending without nodes; one which exists is kept.
Raises:
| Type | Description |
|---|---|
ValueError
|
The workflow cannot be built, e.g. a task has no image. |
fail_attempt
¶
Fail the next attempt of a pod of a worker, merge or unsplit task.
oom_kill
¶
Let the next attempts of a pod be killed by the out of memory killer.
add_log
¶
Add the log of a pod of a task, the pod named <workflow>-<node>.
logs
¶
The logs added with add_log, the last tail_lines lines of each.
place
¶
Place a pod, listed by placements until its workflow has ended.
A placement of a pod placed before replaces it, e.g. once the pod is bound.
unreserve
¶
Release a node reserved by the run; KeyError for an unknown node.
dag_nodes
¶
The names of the DAG nodes of a workflow manifest, as Argo names them.
A DAG task over a sequence is one node per item, <task>(<index>:<item>).