Repository navigation
Java SDK: Trigger another Dag's run from a native Java Dag #74440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jason810496
merged 12 commits into
jason/java-sdk/native-dag-branch
from
jason/java-sdk/native-dag-trigger-dag-run
Oct 9, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4b43050
Java SDK: Trigger another Dag's run from a native Java Dag
jason810496 a8d8d11
Java SDK: Point both example triggers at a Dag that triggers nothing
jason810496 4f263fc
Java SDK: Say why a switch cannot choose a task that triggers a Dag run
jason810496 5d01380
Java SDK: Snapshot a TriggerDagRun when its task is declared
jason810496 ddd5fd7
Java SDK: Check a TriggerDagRun setting the way every other config ke…
jason810496 e13fd59
Java SDK: Describe what a trigger task pushes and how it names a run
jason810496 375bef2
Java SDK: Correct which runtimes already run trigger tasks
jason810496 fb0b40b
Java SDK: Format a trigger task's date-times in one place
jason810496 1cd51bf
Java SDK: Reject a trigger method that throws a checked exception
jason810496 e638c38
Java SDK: Give the trigger fixture a logical date every SDK can write
jason810496 192db48
Java SDK: Run a trigger task through runTask in tests
jason810496 c4a82f6
Java SDK: Check a trigger task polls the run it started
jason810496 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
java-sdk/example/src/java/org/apache/airflow/example/nativedag/TargetExample.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| // "native" is a Java keyword, so the native-Dag examples live in "nativedag". | ||
| package org.apache.airflow.example.nativedag; | ||
|
|
||
| import static java.lang.System.Logger.Level.INFO; | ||
|
|
||
| import java.util.List; | ||
| import org.apache.airflow.sdk.*; | ||
|
|
||
| // The Dag the other two native examples trigger. It triggers nothing itself, | ||
| // so the examples cannot trigger each other in a loop. | ||
| public class TargetExample { | ||
| private static final System.Logger log = System.getLogger(TargetExample.class.getName()); | ||
|
|
||
| public static class Receive implements Task { | ||
| @Override | ||
| public void execute(Context context, Client client) { | ||
| log.log(INFO, "Triggered by another Dag"); | ||
| } | ||
| } | ||
|
|
||
| public static DagDef build() { | ||
| var dag = | ||
| new DagDef("java_native_target_example") | ||
| .config("description", "Pure-Java Dag that the other native examples trigger") | ||
| .config("catchup", false) | ||
| .config("tags", List.of("example", "java-sdk")); | ||
| dag.task("receive", Receive.class); | ||
| return dag; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.