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.- operator_class: type[airflow.models.baseoperator.BaseOperator][source]¶
- params: ParamsDict | dict[source]¶
- class airflow.models.mappedoperator.MappedOperator(context=None)[source]¶
Bases:
airflow.models.abstractoperator.AbstractOperator
Object representing a mapped operator in a DAG.
- property roots: Sequence[airflow.models.abstractoperator.AbstractOperator][source]¶
Implementing DAGNode.
- property leaves: Sequence[airflow.models.abstractoperator.AbstractOperator][source]¶
Implementing DAGNode.
- property execution_timeout: datetime.timedelta | None[source]¶
- property max_retry_delay: datetime.timedelta | None[source]¶
- property retry_delay: datetime.timedelta[source]¶
- property sla: datetime.timedelta | None[source]¶
- property output: airflow.models.xcom_arg.XComArg[source]¶
Returns reference to XCom pushed by current operator
- params: ParamsDict | dict[source]¶
- operator_extra_links: Collection[airflow.models.baseoperator.BaseOperatorLink][source]¶
- 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.
- iter_mapped_dependencies()[source]¶
Upstream dependencies that provide XComs used by this task for task mapping.
- get_parse_time_mapped_ti_count()[source]¶
Number of mapped task instances that can be created on DAG run creation.
This only considers literal mapped arguments, and would return None when any non-literal values are used for mapping.
- Raises
NotFullyPopulated – If non-literal mapped arguments are encountered.
NotMapped – If the operator is neither mapped, nor has any parent mapped task groups.
- Returns
Total number of mapped TIs this task should have.
- Return type
- get_mapped_ti_count(run_id, *, session)[source]¶
Number of mapped TaskInstances that can be created at run time.
This considers both literal and non-literal mapped arguments, and the result is therefore available when all depended tasks have finished. The return value should be identical to
parse_time_mapped_ti_count
if all mapped arguments are literal.- Raises
NotFullyPopulated – If upstream tasks are not all complete yet.
NotMapped – If the operator is neither mapped, nor has any parent mapped task groups.
- Returns
Total number of mapped TIs this task should have.
- Return type
- render_template_fields(context, jinja_env=None)[source]¶
Template all attributes listed in self.template_fields.
This updates context to reference the map-expanded task and relevant information, without modifying the mapped operator. The expanded task in context is then rendered in-place.
- Parameters
context (airflow.utils.context.Context) – Context dict with values to apply on content.
jinja_env (jinja2.Environment | None) – Jinja environment to use for rendering.