outcomes¶
Outcomes, failures, joins, task results.
Generated by make records from the decisions whose topic (or also) is this one; edit the decisions, not this page.
Current¶
Routing¶
An unchosen branch edge counts as skipped (D55): A branch returns downstream task handles; each unchosen selection edge counts as skipped. The target’s trigger rule considers its other edges, and an empty selection is allowed.
A task starts after all its upstream tasks end (D345): A task starts after its upstream tasks have ended. To act on the first of several, use a
first_ofnode.
Mapped tasks¶
Mapped task state follows its instances (D75): An exhausted instance failure or lane-upstream failure immediately ends the mapped task and cancels its other instances. Running instances are stopped; late results are ignored and their outputs are not stored. The task is failed, or upstream_failed when only lanes failed; otherwise its run_if evaluates all finished instances. NONE_FAILED skips only when all instances skipped; ALL_SUCCEEDED skips when any skipped; zero instances succeed with [].
Mapped outputs are stored per instance (D77): A mapped task’s output is stored per instance. A downstream list is assembled on read in map-index order, with
Nonefor skipped instances.Mapped output outcome selection stays per element across a whole edge (D119): An .on(…) selection on a mapped output checks each element even when another use makes the edge whole. After the whole upstream finishes, instances with other outcomes or skips are skipped.
An outcome-filtered order edge from a mapped task counts each instance (D120): An .on(…) order edge from a mapped task contributes one edge per instance, taken when that instance ends with a selected outcome. Downstream run_if combines these with its other edges: NONE_FAILED permits any matching instance, ALL_SUCCEEDED requires every instance to match. An empty mapping takes the edge.
Retries¶
A command’s retry doesn’t depend on its exit code (D389): A declared exit code is a success and isn’t retried; any other code fails the attempt, retried as usual. There are no per-code retry rules.
Notifications¶
No notification for a task running too long (D390): Notifications have no long-running or SLA event; a task’s
timeoutstops one that runs too long.Notifications go by email and a generic webhook (D391): Notification channels are email and a generic JSON webhook; there are no dedicated Slack or Teams channels.
Notifications have eight events, built together (D408):
Notify.RUN_FAILED(the default set, a server setting),TASK_FAILED(after its last retry),TASK_RETRY,RUN_CANCELLED(a pure cancel; one with a failure isRUN_FAILED),RUN_SUCCEEDED,RUN_RECOVERED(a success after the DAG’s previous run failed),TRIGGER_FAILING([triggers] failing_aftererrors in a row, or its generator returned) andLATE_CLEANUP_FAILED(decision 309).WAITING_FOR_ANSWERcomes with M6. Not found in the code yet: WAITING_FOR_ANSWER.The notification events’ enum is
Notify(D409):Notify.RUN_FAILED, used asDag(notify={team_a: [Notify.RUN_FAILED, Notify.TASK_RETRY]});Eventstays what a trigger yields.Notifications go through an outbox, delivered at least once (D410): Each notification is a row written in the transaction that records its event (a run’s end, a task’s failure); the master’s sender delivers it, retrying with backoff until
[notifications] give_up_after(24 h by default). A delivered row is deleted with the write that records it; one given up on is logged as an error, counted (notifications_failed) and deleted. Restarts and failover lose none; a receiver may get one twice.Email goes by SMTP through lettre (D411):
[notifications.smtp](named by D426):host,port,tls(starttls,tlsornone),username,from; the password only fromSCHEDR_CONFIG__NOTIFICATIONS__SMTP__PASSWORD. A new dependency,lettre, on the rustls and tokio already used. The user’s own email service is a webhook (D427).Notifications link to the UI through
[notifications] ui_url(D413):[notifications] ui_url(e.g.https://schedr.example.com) is the base of the links to the run and its logs; without it, messages carry no links.Notifications aren’t throttled (D415): Each event sends its message; operators choose the events per channel. Throttling may come later if floods are seen.
A job’s
notifystays refused (D416): Aschedr.tomljob’s failure is its task’s, and the DAG’snotify=covers it:notifyin a job stays an import error (decision 298), its message pointing toDag(notify=...).A webhook’s body: schedr’s fixed JSON, or a template (D417): Without
body, a webhook posts D412’s fixed JSON withtext. With one, the body is any JSON whose strings may be templates: in a DAG, t-strings overschedr.notifyplaceholders (t"{dag} {event}"; plain values baked in when the file loads; conversions, format specs and calls on a placeholder refused); in the server config,"{name}"strings ({{a literal brace), parsed at startup. Both are stored as text parts and references; the master fills them value by value (a bare placeholder keeps its JSON type), so nothing runs and nothing needs escaping by hand. Placeholders: event, dag, run, planned_for, state, text, link, failed_tasks, task, attempt, time, zone, data. Email over HTTP (M4.13b) uses the same bodies.A DAG uses a server webhook as configured (D419): A string names a server channel, with the server’s body; a DAG wanting its own format defines its own
WebhookChannel.[notifications] timeout, 10 s (D420): The limit for one POST, a public key; past it the delivery counts as failed and is retried.Tasks send notifications to their channels (D421):
channel.send(text=..., data=...),schedr.api.notify("x", text=..., data=...), andschedr task-ctx notify x --text ... --data JSON|@file.jsonfor commands: through the agent, as the task (POST /api/v1/notifications, opened to tasks). The name is looked up in the task’s own DAG, then among the server channels; dag, run and task come from the task, event isMESSAGE. It returns once queued in the outbox, not once delivered. In M4.13a.[notifications] max_per_attempt, 100 (D422): A task attempt may send at most this many notifications; past itsendraises (the CLI exits non-zero).Templates reach into
databy paths (D423):data['rows']in a template records a path. A call whosedatalacks a field the template uses is refused (it raises, naming the field). In event notificationsdatais null, and a path into it gives an empty string.Server channels are
[notifications.channels.<name>]with atype(D424): Every channel of the master’s configuration is[notifications.channels.<name>],type = "webhook"(url,headers_env,body) ortype = "email"(to); there are several of each, and every DAG of the deployment names them by name. Settings common to all stay in[notifications].A DAG’s own webhooks are gated by
[notifications] dag_urlsalone (D425): AWebhookChannel’s URL must start with one of[notifications] dag_urls; empty (the default), DAGs define none. The master posts it, from where it sits (its database, its API, the cloud metadata address), so a DAG file must not steer it elsewhere (SSRF). It carries no secrets (its URL is in the DAG file); redirects aren’t followed, for any webhook. Nodag_channelsswitch: the list is it. Checked when the DAG loads, again when a notification is queued and when it is sent: a channel no longer allowed is logged as an error, counted (notifications_failed) and dropped; an unknown server channel is kept untilgive_up_after. Not found in the code yet: dag_channels.Email channels are in the configuration only (D426):
type = "email"channels withto = [...], sent through[notifications.smtp](host, port, tls, username, from; the password fromSCHEDR_CONFIG__NOTIFICATIONS__SMTP__PASSWORDonly). NoEmailChannelin DAG files: code names email channels by name (notify={"oncall": [...]},api.notify("team-a", ...),schedr task-ctx notify). One email per notification, every recipient in To; plain text: the summary as the subject, the failed tasks, times and link in the body, a task’sdatawhen it sent some.The user’s email service is reached as a webhook (D427): No email-over-HTTP transport: a service taking a POST (plain or with its stored templates) is a webhook, a server channel with a
"{name}"body or a DAG’sWebhookChannelwithindag_urls, its body the service’s request (recipients, template ID, variables).A webhook’s 4xx drops the notification at once (D428): 400-499 (but 408 and 429) won’t fix itself: logged as an error, counted (
notifications_failed) and dropped; 408, 429, 5xx, timeouts and connection errors are retried untilgive_up_after.[notifications] ca_file: extra CAs for notifications (D429): A PEM file of CAs trusted for notifications besides the system’s (OpenShift’s service CA, mounted), for internal services with a private certificate.
From other topics¶
Cleanup runs in a fresh process after the task (D16,
cleanup; built M4.8a)Build M4 feature views as UI shells in M3 (D25,
ui-cli; built M3.2b)Mapped output lanes advance per instance (D70,
python-api; built M4.3b)A task instance records why it failed without an attempt (D78,
state; built M4.3b)A group ending in a branch connects to following tasks by order edges (D94,
python-api; built M4.3c)Reject NUL in stored output strings and dictionary keys (D106,
serialization; built M4.3e)Build structures containing references as the parameter’s type (D112,
serialization; built M4.3e)Mask task logs and outputs when shown (D131,
secrets; built M4.4b)Secret values are masked in outputs before storage (D167,
secrets; built M4.6b)An attempt whose process never started has no cleanup (D216,
cleanup; built M4.8a)Task and cleanup results are reported separately (D229,
cleanup; built M4.8b2)Per-task cleanup has no flag to skip waiting (D230,
cleanup; built M4.8a)A task stopped on disconnection is
lost(D257,cleanup; built M4.8b3)A resource cleanup exhausting retries fails the run (D263,
cleanup; built M4.8c2)A group’s successors wait for its blocking resource cleanups (D266,
cleanup; built M4.8c1)A rejected approval has the Rejected outcome (D285,
human-in-the-loop; planned (M6))A wait step’s plain >> runs on its value (D324,
wait-steps; built M4.11a1)A timed-out wait step is grey and leaves its run successful (D344,
wait-steps; built M4.11a4)first_ofandat_leastselect completed outcomes (D347,wait-steps; built M4.11c)A failed target gives a routable
Failedoutcome (D359,chained-runs; built M4.12a)
Replaced¶
D418 (superseded by D425): A DAG may define webhook channels inside
dag_urlsD414 (superseded by D426): A DAG may define email channels of its own
D412 (superseded by D417): A webhook posts schedr’s fixed JSON with a
text
Where in code¶
crates/schedr-agent/src/agent.rs(D167)crates/schedr-agent/src/agent.rs::NotNeeded(D216)crates/schedr-agent/src/agent.rs::kept_cleanup(D229)crates/schedr-agent/src/mask.rs::MaskSet(D167)crates/schedr-agent/src/mask.rs::mask_json(D167)crates/schedr-api/src/logs.rs::masked_lines(D131)crates/schedr-api/src/routes.rs::shown(D131)crates/schedr-api/src/views.rs(D131)crates/schedr-config/src/masked.rs::mask_data(D131)crates/schedr-db/migrations/postgres/0001_initial.sql::reason(D78)crates/schedr-db/migrations/sqlite/0001_initial.sql::reason(D78)crates/schedr-db/src/attempts.rs(D70, D77, D229)crates/schedr-db/src/instances.rs(D75)crates/schedr-db/src/instances.rs::reason(D78)crates/schedr-master/src/core.rs(D229)crates/schedr-master/src/dispatch/chained.rs::run_ended(D359)crates/schedr-master/src/execution.rs(D75)crates/schedr-master/src/mapping.rs(D75)crates/schedr-master/src/mapping.rs::Sources(D77)crates/schedr-master/src/mapping.rs::lane_sources(D70)crates/schedr-master/src/mapping.rs::narrows_per_element(D119)crates/schedr-master/src/progress.rs::edge_state(D55)crates/schedr-master/src/progress.rs::edge_states(D120)crates/schedr-master/src/progress.rs::instance_taken(D119)crates/schedr-master/src/progress.rs::lane_state(D70)crates/schedr-master/src/progress.rs::readiness(D345)crates/schedr-master/src/progress.rs::settle_mapped(D75)crates/schedr-master/src/validate.rs(D94)crates/schedr-master/src/validate.rs::first_of_problems(D347)crates/schedr-model/src/dag.rs::ResourceState(D263)crates/schedr-model/src/dag.rs::blocking(D266)crates/schedr-model/src/states.rs(D216)crates/schedr-model/src/task.rs(D347)crates/schedr-ui/src/runs.rs::TIMED_OUT(D344)python/schedr/_build.py(D324)python/schedr/_build.py::make_group_dependencies(D94)python/schedr/_build.py::wait_for_cleanups(D266)python/schedr/_model/dag.py(D266)python/schedr/_serialization/codec.py::_text(D106)python/schedr/first_of.py::first_of(D347)python/schedr/outcomes.py::Waited(D324)python/schedr/runner/task.py(D324)python/schedr/runner/task.py::build(D112)
Open¶
None.
Details and edge cases, with the reasons; read them before changing this:
JOURNAL.md: D389, D390, D391, D408, D409, D410, D411, D412, D413, D414, D415, D416, D417, D424
archive/PROJECT.md: Native API, Sensors and triggers