Skip to content

Java SDK: Let a native Java Dag set one queue for all its tasks - #74538

Open
jason810496 wants to merge 3 commits into
apache:mainfrom
jason810496:feature/java-sdk-dag-level-queue
Open

jason810496 wants to merge 3 commits into
apache:mainfrom
jason810496:feature/java-sdk-dag-level-queue

Conversation

@jason810496

@jason810496 jason810496 commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Why

Every task of a native Java Dag runs on the Java coordinator, so each one needs a queue that [sdk] queue_to_coordinator routes there. Airflow's Dag has no queue setting, so authors had to repeat the same queue on every task. The Go and TypeScript SDKs already take a Dag-level queue; this gives Java the same.

What changes

queue can be set once on the Dag, in both styles. Each task inherits it, unless the task sets its own queue.

// Annotation style.
@Airflow.Dag(id = "etl", schedule = "@daily", queue = "java")
public class Etl { ... }

// Interface style.
var dag = new DagDef("etl").config("queue", "java");
dag.task("extract", Extract.class);                           // runs on "java"
dag.task("heavy", Heavy.class).config("queue", "java_large"); // its own queue wins
  • Same rules as Go and TypeScript: conditions, switches and TriggerDagRun tasks inherit the queue too, a task's own queue always wins, and the queue is never written on the serialized Dag itself.
  • The native Java examples now set queue = "java", which the README's setup already routes to the Java coordinator.

Was generative AI tooling used to co-author this PR?

@jason810496 jason810496 self-assigned this Oct 10, 2026
@jason810496
jason810496 force-pushed the feature/java-sdk-dag-level-queue branch from d356396 to a591e4e Compare October 14, 2026 07:08
@jason810496
jason810496 marked this pull request as ready for review October 14, 2026 07:32
@jason810496
jason810496 requested a review from uranusjr as a code owner October 14, 2026 07:32

@FrankYang0529 FrankYang0529 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.

Overall LGTM.

Comment thread java-sdk/sdk/src/main/kotlin/org/apache/airflow/sdk/DagDef.kt
@jason810496
jason810496 force-pushed the feature/java-sdk-dag-level-queue branch from a591e4e to 8bfb07f Compare October 20, 2026 01:53
jason810496 and others added 3 commits October 20, 2026 02:04
Every task of a native Java Dag runs on the Java coordinator, so each one
needs a queue that queue_to_coordinator routes there. Airflow's Dag has no
queue setting, so authors had to repeat the same queue on every task. The
Go and TypeScript SDKs already take a Dag-level queue that each task
inherits unless it sets its own; this gives Java the same.

Co-Authored-By: Claude <noreply@anthropic.com>
A blank queue matched no coordinator, so every task stayed queued.
The parsing docs still said there was no Dag-level queue and routed a
queue the examples do not use.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@jason810496
jason810496 force-pushed the feature/java-sdk-dag-level-queue branch from 8bfb07f to 6a5819f Compare October 20, 2026 02:07
@jason810496 jason810496 added the backport-to-v3-4-test Backport to v3-4-test label Oct 20, 2026
@jason810496 jason810496 added this to the Airflow 3.4.0 milestone Oct 20, 2026

This branch has not been deployed

No deployments
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