Skip to content

Implement comm handlers for callback supervisor - #65269

Merged
ferruzzi merged 6 commits into
apache:mainfrom
aws-mwaa:ferruzzi/executor-callbacks/comms-v2
Apr 23, 2026
Merged

Implement comm handlers for callback supervisor#65269
ferruzzi merged 6 commits into
apache:mainfrom
aws-mwaa:ferruzzi/executor-callbacks/comms-v2

Conversation

@ferruzzi

@ferruzziferruzzi commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

This enables limited API access from within the callback supervisor. With this change, callbacks can use GetVariable, GetConnection, GetXCom, GetAsset (ByName and ByUri), and MaskSecret. We can add more as they are requested, but this felt like a good foundation. These are common with the existing TaskInstance supervisor so those are extracted out into helpers in a new shared request_handlers.py location.

One thing to note is that Triggerer previously did not mask secrets conn.password or conn.extra and will now, bringing it inline with the other two. This is a change but felt like a bugfix since it's reasonable to assume that passwords, etc are masked by default.

Testing:
One way to test this manually, create a new dag with a custom callback:

In your dag bag:

@task.bash(task_id="sleep_task")defsleep_10_secs():
return"sleep 10"withDAG(
dag_id="comms_channel_testing",
deadline=DeadlineAlert(
reference=DeadlineReference.FIXED_DATETIME(datetime(1980, 8, 10, 2)),
interval=timedelta(0),
callback=SyncCallback(get_variable),
),
):
sleep_10_secs()

place the get_variable callback in a file in your plugins directory:

defget_variable():
# Be sure to manually create the Variable in the UI or CLI; environment variables use a different code pathfromairflow.sdk.definitions.variableimportVariableval=Variable.get("test_key", default="no comms!")
print(f"************** Successful callback! Variable value: {val} ************** ")

launch Airflow or Breeze and add the Variable named test_key via the UI or CLI (note that setting it via EnvVar is a different code path and won't hit this change).

Run the Dag. Since the fixed_datetime deadline is in the past, it will fire the callback immediately and you should see the success message bubble up into the Scheduler logs within a few seconds.

@kaxil - This is the final step to enable the Connections, Variables, etc that I believe you (and others) were asking about now that the previous PRs are merged.

Followup to #62645

EDIT: XCom removed from this batch as it requires noticeably more work than the others since ti required more parameters plumbed through, it can be its own PR


Was generative AI tooling used to co-author this PR?
  • [ x ] Yes (please specify the tool below)
    Some assistance from Cline/Claude

Comment threadairflow-core/src/airflow/jobs/triggerer_job_runner.py
Comment threadtask-sdk/src/airflow/sdk/execution_time/request_handlers.py Outdated
Comment threadtask-sdk/src/airflow/sdk/execution_time/callback_supervisor.py Outdated
Comment threadairflow-core/newsfragments/65269.significant.rst Outdated
Comment threadtask-sdk/src/airflow/sdk/execution_time/callback_supervisor.py Outdated

@ramitkatariaramitkataria left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me besides the open threads

@o-nikolaso-nikolas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some dangling asset stuff still needs removing, but otherwise lgtm

Comment threadairflow-core/newsfragments/65269.significant.rst Outdated
Comment threadtask-sdk/src/airflow/sdk/execution_time/request_handlers.py Outdated
@ferruzzi
ferruzzi merged commit 6dcfb1a into apache:mainApr 23, 2026
141 checks passed
@ferruzzi
ferruzzi deleted the ferruzzi/executor-callbacks/comms-v2 branch April 23, 2026 18:29
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Executors-coreLocalExecutor & SequentialExecutorarea:task-sdkarea:Triggerer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@ferruzzi@kaxil@ramitkataria@o-nikolas@vincbeck@vatsrahul1001