airflow.models.mappedoperator
¶
Module Contents¶
Classes¶
An "intermediate state" returned by |
|
Object representing a mapped operator in a DAG. |
Functions¶
|
|
|
|
Attributes¶
- class airflow.models.mappedoperator.OperatorPartial[source]¶
An “intermediate state” returned by
BaseOperator.partial()
.This only exists at DAG-parsing time; the only intended usage is for the user to call
.expand()
on it at some point (usually in a method chain) to create aMappedOperator
to add into the DAG.
- class airflow.models.mappedoperator.MappedOperator(context=None)[source]¶
Bases:
airflow.models.abstractoperator.AbstractOperator
Object representing a mapped operator in a DAG.
- unmap(resolve)[source]¶
Get the “normal” Operator after applying the current mapping.
The resolve argument is only used if
operator_class
is a real class, i.e. if this operator is not serialized. Ifoperator_class
is not a class (i.e. this DAG has been deserialized), this returns a SerializedBaseOperator that “looks like” the actual unmapping result.If resolve is a two-tuple (context, session), the information is used to resolve the mapped arguments into init arguments. If it is a mapping, no resolving happens, the mapping directly provides those init arguments resolved from mapped kwargs.
- expand_mapped_task(run_id, *, session)[source]¶
Create the mapped task instances for mapped task.
- Returns
The newly created mapped TaskInstances (if any) in ascending order by map index, and the maximum map_index.
- Return type
tuple[Sequence[airflow.models.taskinstance.TaskInstance], int]
- iter_mapped_dependencies()[source]¶
Upstream dependencies that provide XComs used by this task for task mapping.
- parse_time_mapped_ti_count()[source]¶
Number of mapped TaskInstances that can be created at DagRun create time.
- Returns
None if non-literal mapped arg encountered, or the total number of mapped TIs this task should have.
- Return type
int | None
- run_time_mapped_ti_count(run_id, *, session)[source]¶
Number of mapped TaskInstances that can be created at run time.
- Returns
None if upstream tasks are not complete yet, or the total number of mapped TIs this task should have.
- Return type
int | None
- render_template_fields(context, jinja_env=None)[source]¶
Template all attributes listed in template_fields.
If the operator is mapped, this should return the unmapped, fully rendered, and map-expanded operator. The mapped operator should not be modified. However,
context
will be modified in-place to reference the unmapped operator for template rendering.If the operator is not mapped, this should modify the operator in-place.