Skip to content

Java SDK: Add setVariable and deleteVariable to the task Client - #72676

Merged
jason810496 merged 2 commits into
apache:mainfrom
FrankYang0529:airflow-java-sdk-variable-write
Sep 14, 2026
Merged

jason810496 merged 2 commits into
apache:mainfrom
FrankYang0529:airflow-java-sdk-variable-write

Conversation

@FrankYang0529

Copy link
Copy Markdown
Member

Add setVariable and deleteVariable to the Java SDK task Client, which completes the variable-read-write runtime capability.

How

  • Add Client.setVariable(key, value, description) and Client.deleteVariable(key). description defaults to null. setVariable has @JvmOverloads, like the existing getXCom and setXCom, because Java cannot use Kotlin default arguments. With the annotation, Java code can call it with two arguments.
  • In CoordinatorClient, setVariable sends a PutVariable message to the supervisor. deleteVariable sends DeleteVariable and waits for the supervisor's OKResponse.
  • A Jackson mixin in Frame.kt serializes PutVariable with @JsonInclude(ALWAYS). jsonschema2pojo annotates generated models with NON_NULL, so without the mixin a null description would be missing from the wire map. The supervisor would then fail validation and never reply, and the JVM would block forever.

Verification

  • ./gradlew :sdk:test :sdk:ktlintCheck
  • breeze testing airflow-e2e-tests --e2e-test-mode java_sdk tests/airflow_e2e_tests/java_sdk_tests/test_java_sdk_dag.py

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

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@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 filling up the gap, no major concern from me. LGTM overall, thanks.

@FrankYang0529
FrankYang0529 force-pushed the airflow-java-sdk-variable-write branch 2 times, most recently from 79c506c to 1ff0335 Compare September 8, 2026 12:11
Signed-off-by: PoAn Yang <payang@apache.org>
Signed-off-by: PoAn Yang <payang@apache.org>
@FrankYang0529
FrankYang0529 force-pushed the airflow-java-sdk-variable-write branch from 1ff0335 to 72b72e2 Compare September 8, 2026 13:17
@jason810496
jason810496 merged commit 2678bc8 into apache:main Sep 14, 2026
95 checks passed
@FrankYang0529
FrankYang0529 deleted the airflow-java-sdk-variable-write branch September 14, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants