schedr._model.notify

Notifications in DAG JSON: the channels a DAG notifies, and of which events.

Mirrors schedr-model (notify.rs). A body arrives here already as its JSON ({"object": ...}, {"template": [...]}, …), built by schedr.notify.

class schedr._model.notify.ServerChannel(name)

Bases: object

A channel of the server’s configuration, named by a string.

Parameters:

name (str)

name

Its name in [notifications.channels].

Type:

str

to_json()

The channel as DAG JSON.

Returns:

{"kind": "server", "name": ...}.

Return type:

dict[str, object]

class schedr._model.notify.WebhookDef(name, url, body=None)

Bases: object

A webhook a DAG defines.

Parameters:
  • name (str)

  • url (str)

  • body (Mapping[str, object] | None)

name

Its name, unique among the DAG’s channels.

Type:

str

url

Where it posts.

Type:

str

body

Its body as DAG JSON; None: schedr’s fixed JSON.

Type:

collections.abc.Mapping[str, object] | None

to_json()

The channel as DAG JSON.

Returns:

{"kind": "webhook", "name": ..., "url": ...}, with "body" when set.

Return type:

dict[str, object]

class schedr._model.notify.NotifyEntry(channel, events=None)

Bases: object

One channel a DAG notifies.

Parameters:
channel

The channel.

Type:

schedr._model.notify.ServerChannel | schedr._model.notify.WebhookDef

events

The events’ names (RUN_FAILED); None: the server’s default events.

Type:

collections.abc.Sequence[str] | None

to_json()

The entry as DAG JSON.

Returns:

{"channel": ...}, with "events" when chosen.

Return type:

dict[str, object]