Skip to content

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

Draft
jason810496 wants to merge 1 commit into
apache:mainfrom
jason810496:feature/java-sdk-dag-level-queue
Draft

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

Conversation

@jason810496

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.
@Builder.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?

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>

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.

1 participant