Skip to content

Push XCom if BaseOperator.do_xcom_push is True and if task returns a value #45230

@kaxil

Description

@kaxil

Add support for pushing XCom values by just returning from a function.

def push_by_returning(**kwargs):
    """Pushes an XCom without a specific target, just by returning it"""
    return "hi from push_by_returning"

push2 = PythonOperator(
    task_id="push_by_returning",
    dag=dag,
    python_callable=push_by_returning,
)

Currently, we support explicit ti.xcom_push and pull with Task SDK

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions