Skip to content

Clear language SDK task XComs in the coordinator when a try starts - #74221

Merged
jason810496 merged 3 commits into
apache:mainfrom
FrankYang0529:airflow-java-sdk-clear-earlier-try-xcoms
Oct 17, 2026
Merged

jason810496 merged 3 commits into
apache:mainfrom
FrankYang0529:airflow-java-sdk-clear-earlier-try-xcoms

Conversation

@FrankYang0529

@FrankYang0529 FrankYang0529 commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Follow-up for #74178 (review). The coordinator now deletes the XComs once when a try starts, instead of each language SDK runtime deleting them.

Why

  • When a try starts, the API server returns xcom_keys_to_clear, the list of XComs that the worker must delete before the task runs. The Python task runner and the Go runtime delete these XComs. The Java and TypeScript runtimes do not.

How

  • _PopenActivitySubprocess, which the Java, Go and TypeScript coordinators share, now deletes the listed XComs after the server marks the try as running and before sending StartupDetails to the runtime.

Was generative AI tooling used to co-author this PR?
  • Yes - Claude Code

@FrankYang0529
FrankYang0529 force-pushed the airflow-java-sdk-clear-earlier-try-xcoms branch from 14c70d1 to 1da3011 Compare October 9, 2026 02:22
@FrankYang0529
FrankYang0529 marked this pull request as ready for review October 9, 2026 06:11
@FrankYang0529
FrankYang0529 force-pushed the airflow-java-sdk-clear-earlier-try-xcoms branch from 1da3011 to b7191c6 Compare October 9, 2026 07:01

@jason810496 jason810496 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the fix.

I pushed 34bbaee on top with a few fixes from review:

  • Rethrow CancellationException while clearing XComs, so a cancelled task doesn't report a failure or use up a retry.
  • Corrected the comment on why the worker clears XComs, and added a TODO: Python's XCom.delete also purges custom XCom backends, which the Java runtime can't do yet.
  • ServerTest: the fake supervisor thread is now a daemon and is always stopped, so a failing case doesn't leave a thread running.
  • Moved the throwing test transport to a shared NoOpTransport. The test fakes now use by NoOpTransport and override only what they use.

@uranusjr

Copy link
Copy Markdown
Member

Hm, should this be done in the coordinator instead of reimplemented in every sdk?

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm, should this be done in the coordinator instead of reimplemented in every sdk?

Yes, it would be better to cover this in the core layer instead of having it in each SDK.
Marked the PR as draft for now.

@jason810496
jason810496 marked this pull request as draft October 13, 2026 21:23
@FrankYang0529

Copy link
Copy Markdown
Member Author

Hm, should this be done in the coordinator instead of reimplemented in every sdk?

Yes, it would be better to cover this in the core layer instead of having it in each SDK. Marked the PR as draft for now.

Agree, it will be more clear. I will do it in this PR and close TS SDK one #74220.

@FrankYang0529
FrankYang0529 force-pushed the airflow-java-sdk-clear-earlier-try-xcoms branch from 34bbaee to ed8efe4 Compare October 14, 2026 04:11
@FrankYang0529 FrankYang0529 changed the title Java SDK: Clear the XComs of a task instance at the start of each try Clear language SDK task XComs in the coordinator when a try starts Oct 14, 2026
@FrankYang0529
FrankYang0529 force-pushed the airflow-java-sdk-clear-earlier-try-xcoms branch from ed8efe4 to 2f45b3a Compare October 14, 2026 05:55
@FrankYang0529
FrankYang0529 marked this pull request as ready for review October 14, 2026 07:00

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, thanks. The change matches my imagination and LGTM, one more thing before merge.
Could you help keep the go-sdk change out of this PR and keep them in a new follow-up PRs please? Thanks.

The Python task-sdk part is ready to go and it's ready to backport as well.
However, on the language SDK side, we need to wait for several backport PRs get merged first before the go-sdk change in one.

@FrankYang0529
FrankYang0529 force-pushed the airflow-java-sdk-clear-earlier-try-xcoms branch 2 times, most recently from 8f5255d to a76390e Compare October 16, 2026 03:47
Signed-off-by: PoAn Yang <payang@apache.org>
Signed-off-by: PoAn Yang <payang@apache.org>
Signed-off-by: PoAn Yang <payang@apache.org>
@FrankYang0529
FrankYang0529 force-pushed the airflow-java-sdk-clear-earlier-try-xcoms branch from a76390e to dfa034c Compare October 16, 2026 07:24
@FrankYang0529

Copy link
Copy Markdown
Member Author

Could you help keep the go-sdk change out of this PR and keep them in a new follow-up PRs please? Thanks.

Thanks for the review. I moved the go-sdk change out of this PR.

@jason810496 jason810496 added area:coordinator Coordinator: The interface to spawn Lang-SDK subprocesses backport-to-v3-4-test Backport to v3-4-test labels Oct 17, 2026
@jason810496 jason810496 added this to the Airflow 3.4.0 milestone Oct 17, 2026
@jason810496
jason810496 merged commit 4b464ee into apache:main Oct 17, 2026
108 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-4-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ v3-4-test PR Link

@FrankYang0529
FrankYang0529 deleted the airflow-java-sdk-clear-earlier-try-xcoms branch October 18, 2026 01:41
vatsrahul1001 pushed a commit that referenced this pull request Oct 18, 2026
…ry starts (#74221) (#74936)

* Clear language SDK task XComs in the coordinator when a try starts



* Keep XCom deletion in the Go runtime until backports are merged



* Use httpx2 in the new XCom clearing tests



---------
(cherry picked from commit 4b464ee)

Signed-off-by: PoAn Yang <payang@apache.org>
Co-authored-by: PoAn Yang <payang@apache.org>
vatsrahul1001 pushed a commit that referenced this pull request Oct 20, 2026
…ry starts (#74221) (#74936)

* Clear language SDK task XComs in the coordinator when a try starts



* Keep XCom deletion in the Go runtime until backports are merged



* Use httpx2 in the new XCom clearing tests



---------
(cherry picked from commit 4b464ee)

Signed-off-by: PoAn Yang <payang@apache.org>
Co-authored-by: PoAn Yang <payang@apache.org>
SameerMesiah97 pushed a commit to SameerMesiah97/airflow-oss-sm97 that referenced this pull request Oct 27, 2026
…pache#74221)

* Clear language SDK task XComs in the coordinator when a try starts

Signed-off-by: PoAn Yang <payang@apache.org>

* Keep XCom deletion in the Go runtime until backports are merged

Signed-off-by: PoAn Yang <payang@apache.org>

* Use httpx2 in the new XCom clearing tests

Signed-off-by: PoAn Yang <payang@apache.org>

---------

Signed-off-by: PoAn Yang <payang@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:coordinator Coordinator: The interface to spawn Lang-SDK subprocesses area:task-sdk backport-to-v3-4-test Backport to v3-4-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants