Skip to content

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

Closed

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

Activity

  1. self-assigned this
    on Dec 27, 2024
  2. moved this from Next 2 Weeks to In Progress in AIP-72 - Task Execution Interface and SDKon Dec 27, 2024
  3. added a commit that references this issue on Dec 27, 2024
  4. added a commit that references this issue on Dec 27, 2024
  5. added this to the Airflow 3.0.0 milestone on Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions