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(self, unmap_kwargs=None)[source]¶
Get the “normal” Operator after applying the current mapping.
If
operator_class
is not a class (i.e. this DAG has been deserialized) then this will return a SerializedBaseOperator that aims to “look like” the real operator.- Parameters
unmap_kwargs (Optional[Dict[str, Any]]) – Override the args to pass to the Operator constructor. Only used when
operator_class
is still an actual class.
- expand_mapped_task(self, 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]
- render_template_fields(self, context, jinja_env=None)[source]¶
Template all attributes listed in template_fields.
Different from the BaseOperator implementation, this renders the template fields on the unmapped BaseOperator.
- Parameters
context (airflow.utils.context.Context) – Dict with values to apply on content
jinja_env (Optional[jinja2.Environment]) – Jinja environment
- Returns
The unmapped, populated BaseOperator
- Return type
Optional[airflow.models.baseoperator.BaseOperator]
- iter_mapped_dependencies(self)[source]¶
Upstream dependencies that provide XComs used by this task for task mapping.
- parse_time_mapped_ti_count(self)[source]¶
Number of mapped TaskInstances that can be created at DagRun create time.
- Returns
None if non-literal mapped arg encountered, or else total number of mapped TIs this task should have
- Return type
Optional[int]
- run_time_mapped_ti_count(self, run_id, *, session)[source]¶
Number of mapped TaskInstances that can be created at run time, or None if upstream tasks are not complete yet.
- Returns
None if upstream tasks are not complete yet, or else total number of mapped TIs this task should have
- Return type
Optional[int]