schedr._model.values¶
References, templates and task arguments in DAG JSON (schedr-model, value.rs).
- class schedr._model.values.DagCtxField(*values)¶
Bases:
StrEnumA field of the run’s context:
dag_ctx.run.*anddag_ctx.dag_id.
- class schedr._model.values.OutputRef(task, path=(), on=())¶
Bases:
objectAn upstream task’s output, or a part of it.
- Parameters:
task (str)
path (Sequence[str | int])
on (Sequence[str])
- task¶
The upstream task’s ID.
- Type:
str
- path¶
Field names and list / tuple indexes into the output; empty for all of it.
- Type:
collections.abc.Sequence[str | int]
- on¶
The outcomes it was narrowed to (
.on(...)); empty for any. On another outcome, or a skipped upstream task, it stands forNone.- Type:
collections.abc.Sequence[str]
- to_json()¶
The reference as DAG JSON.
- Returns:
{"kind": "output", "task": ..., "path": [...], "on": [...]}(pathandononly if not empty).- Return type:
dict[str, Any]
- class schedr._model.values.OutcomeRef(task)¶
Bases:
objectAn upstream task’s outcome itself (
.outcome), as its name.- Parameters:
task (str)
- task¶
The upstream task’s ID.
- Type:
str
- to_json()¶
The reference as DAG JSON.
- Returns:
{"kind": "outcome", "task": ...}.- Return type:
dict[str, Any]
- class schedr._model.values.DagCtxRef(field)¶
Bases:
objectA field of the run’s context.
- Parameters:
field (DagCtxField)
- field¶
Which field.
- to_json()¶
The reference as DAG JSON.
- Returns:
{"kind": "dag_ctx", "field": ...}.- Return type:
dict[str, Any]
- class schedr._model.values.ParamRef(path=())¶
Bases:
objectThe run’s parameters, or a part of them (
dag_ctx.params.region, decision 138).- Parameters:
path (Sequence[str | int])
- path¶
Field names and list / tuple indexes into the parameters; empty for all of them.
- Type:
collections.abc.Sequence[str | int]
- to_json()¶
The reference as DAG JSON.
- Returns:
{"kind": "param", "path": [...]}(pathonly if not empty).- Return type:
dict[str, Any]
- schedr._model.values.check_storage_name(name)¶
Why
namecan’t be a secret storage’s name (its[secret_storage.<name>]key).- Parameters:
name (str) – The name.
- Returns:
The reason, or
Nonefor a good name.- Return type:
str | None
- schedr._model.values.storage_label(storage)¶
A storage as written in Python.
secrets,secrets.other, orsecrets.storage('vault-2')for a name that can’t be an attribute: not a Python name, a keyword,_first, orstorageorvalue(the methods).- Parameters:
storage (str | None) – Its name;
Nonefor the default one.- Returns:
The label.
- Return type:
str
- schedr._model.values.check_secret_path(path, what)¶
Why
pathcan’t be a secret’s path (or a prefix without its last/).- Parameters:
path (str) – The path.
what (str) –
pathorprefix, for the message.
- Returns:
The reason, or
Nonefor a good path.- Return type:
str | None
- class schedr._model.values.SecretRef(path, key=None, storage=None, default=None)¶
Bases:
objectA secret in a secret storage:
path#key, orpathfor the whole secret.- Parameters:
path (str)
key (str | None)
storage (str | None)
default (str | None)
- path¶
The secret’s path in the storage (
etl/db).- Type:
str
- key¶
The key in it (
password);Nonefor the whole secret.- Type:
str | None
- storage¶
The storage;
Nonefor the default one.- Type:
str | None
- default¶
What a reference reads when the secret or its key is missing (
.get(key, default)); a key’s only.- Type:
str | None
- spec()¶
path#key, orpathfor the whole secret.- Returns:
The spec.
- Return type:
str
- label()¶
As written in Python (decision 176).
secrets['etl/db']['password'],secrets.other['etl/db'],secrets['etl/db'].get('password', '').- Returns:
The label.
- Return type:
str
- to_json()¶
The reference as DAG JSON.
- Returns:
{"kind": "secret", "path": ..., "key": ..., "storage": ..., "default": ...}(key,storageanddefaultonly if set).- Return type:
dict[str, Any]
- class schedr._model.values.SecretPrefixDecl(prefix, storage=None)¶
Bases:
objectEvery secret under a prefix, declared in
secrets=(SecretPrefix(...)).- Parameters:
prefix (str)
storage (str | None)
- prefix¶
The prefix, ending in
/.- Type:
str
- storage¶
The storage;
Nonefor the default one.- Type:
str | None
- label()¶
As written in Python.
- Returns:
SecretPrefix('connections/'), withstorage=when it names one.- Return type:
str
- to_json()¶
The declaration as DAG JSON.
- Returns:
{"kind": "prefix", "prefix": ..., "storage": ...}(storageonly if set).- Return type:
dict[str, Any]
- schedr._model.values.covers(declared, ref)¶
Whether a declaration in
secrets=lets a task readref(as the agent decides).- Parameters:
declared (SecretDecl) – The declaration.
ref (SecretRef) – The secret read.
- Returns:
Truefor the same secret (or a key of a whole one declared), or one under a declared prefix, in the same storage.- Return type:
bool
- type schedr._model.values.SecretDecl = SecretRef | SecretPrefixDecl¶
A secret a task declares in
secrets=: one (or a whole one), or a prefix.
- type schedr._model.values.Reference = OutputRef | OutcomeRef | DagCtxRef | ParamRef | SecretRef¶
Any reference.
- class schedr._model.values.TemplateRef(reference, format=None, encode=None)¶
Bases:
objectA reference inside a template, with its optional format spec.
- Parameters:
reference (Reference)
format (str | None)
encode (Literal['url'] | None)
- reference¶
What is filled in.
- format¶
The t-string format spec (
raw,%Y-%m-%d, …), if any.- Type:
str | None
- encode¶
How its text is written in:
"url", percent-encoded (a typed connection’s URL, decision 188);Noneas it is.- Type:
Literal[‘url’] | None
- to_json()¶
The template part as DAG JSON.
- Returns:
{"ref": {...reference, "format": ..., "encode": ...}}(each only if set).- Return type:
dict[str, Any]
- type schedr._model.values.TemplatePart = str | TemplateRef¶
Literal text or a reference.
- class schedr._model.values.Template(parts=<factory>)¶
Bases:
objectA t-string as data: its parts in order.
- Parameters:
parts (Sequence[TemplatePart])
- parts¶
Literal text and references.
- Type:
collections.abc.Sequence[schedr._model.values.TemplatePart]
- references()¶
The references in this template, in order.
- Returns:
Every reference of the template’s parts.
- Return type:
list[Reference]
- to_json()¶
The template as DAG JSON.
- Returns:
A list of
{"text": ...}and{"ref": ...}parts.- Return type:
list[dict[str, Any]]
- class schedr._model.values.LiteralValue(value)¶
Bases:
objectA JSON value as encoded by the API (with tagged extra types), passed as is.
- Parameters:
value (Any)
- value¶
The JSON-compatible value.
- Type:
Any
- to_json()¶
The value as DAG JSON.
- Returns:
{"literal": ...}.- Return type:
dict[str, Any]
- class schedr._model.values.RefValue(reference)¶
Bases:
objectA reference passed with its type.
- Parameters:
reference (Reference)
- reference¶
The reference.
- to_json()¶
The value as DAG JSON.
- Returns:
{"ref": ...}.- Return type:
dict[str, Any]
- class schedr._model.values.TemplateValue(template)¶
Bases:
objectA t-string, rendered to a string at run time.
- Parameters:
template (Template)
- template¶
The template.
- references()¶
The template’s references.
- Returns:
Its references, in order.
- Return type:
list[Reference]
- to_json()¶
The value as DAG JSON.
- Returns:
{"template": [...]}.- Return type:
dict[str, Any]
- class schedr._model.values.ListValue(items)¶
Bases:
objectA list whose elements may contain references.
- Parameters:
items (Sequence[Value])
- items¶
The elements.
- Type:
collections.abc.Sequence[schedr._model.values.Value]
- references()¶
The elements’ references, in order.
- Returns:
Every reference at any depth.
- Return type:
list[Reference]
- to_json()¶
The value as DAG JSON.
- Returns:
{"list": [...]}.- Return type:
dict[str, Any]
- class schedr._model.values.MapValue(entries)¶
Bases:
objectA dictionary (string keys) whose values may contain references.
- Parameters:
entries (Mapping[str, Value])
- entries¶
The entries.
- Type:
collections.abc.Mapping[str, schedr._model.values.Value]
- references()¶
The values’ references, by key order.
- Returns:
Every reference at any depth, ordered by key (as stored).
- Return type:
list[Reference]
- to_json()¶
The value as DAG JSON.
- Returns:
{"map": {...}}with keys sorted (as the Rust side stores them).- Return type:
dict[str, Any]
- type schedr._model.values.Value = LiteralValue | RefValue | TemplateValue | ListValue | MapValue¶
Any task argument value.