-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Closed
Labels
AIP-31Task Flow API for nicer DAG definitionTask Flow API for nicer DAG definitionkind:featureFeature RequestsFeature Requests
Description
Description
XComArg is a class that references an XCom entry from an operator. Can be used to explicitly set XCom dependencies and explictly pass results between operators.
Class attributes:
operator: BaseOperator: Origin operator instance.key: str: Stores key for XCom value. Defaults toairflow.models.xcom. XCOM_RETURN_KEY
Class methods
get(context: dict)-> Any: Resolves XCom value givenoperatorandkey.__getitem__(key, str) -> XComArg: Easy method to create new XComArg using the same operator but a different key.add_downstream_dependent(operator: BaseOperator)->None: Add an operator as a downstream dependency ofoperator. [Optional] Makes this task simpler.
Proposed implementation: https://github.com/casassg/corrent/blob/master/corrent/xcom_arg.py
Use case / motivation
- Explicit way to pass around results between operators.
- This object is a reference to an XCom value that has not been created and will need to be resolved in the future.
- It can generate new XComArgs that point to the same operator but has a different key by using the key accessor. E.g: output['train'].
- To do so, it includes as class attributes both the originating operator instance and a key (both needed to pull the XCom).
- Has a property op that allows access to the origin operator.
Stretch goal
- Store type class for the XCom and lie to MyPy when trying to check class signature.
match-gabeflores and turbaszek
Metadata
Metadata
Assignees
Labels
AIP-31Task Flow API for nicer DAG definitionTask Flow API for nicer DAG definitionkind:featureFeature RequestsFeature Requests