Introduce Builder annotations#1576
Merged
Merged
Conversation
ashb
reviewed
May 6, 2026
ashb
reviewed
May 6, 2026
jason810496
reviewed
May 6, 2026
This provides two annotations: DagBuilder and DagBuilder.Task that
*slightly* reduces the boilerplate needed to define tasks in Java (about
two lines per task, and two more lines for the dag).
The way this works is you do
@DagBuilder
public class MyDag {
@DagBuilder.Task
public void myTask(...) { ... }
}
and the compiler uses our annotation processor to generate a wrapper
class named MyDagBuilder with the needed tasks and dependencies defined.
You then can register the dag to the bundle via the builder by calling
MyDagBuilder.build()
in the BundleBuilder's getDags().
A lot of code for a little benefit for the moment, but this should make
taskflow-style XCom a lot easier. (This is not implemented yet.)
Generate extra code around the annotated function to pass in XCom references, and set XCom from the return value.
uranusjr
added a commit
that referenced
this pull request
May 27, 2026
* Introduce DagBuilder annotations
This provides two annotations: DagBuilder and DagBuilder.Task that
*slightly* reduces the boilerplate needed to define tasks in Java (about
two lines per task, and two more lines for the dag).
The way this works is you do
@DagBuilder
public class MyDag {
@DagBuilder.Task
public void myTask(...) { ... }
}
and the compiler uses our annotation processor to generate a wrapper
class named MyDagBuilder with the needed tasks and dependencies defined.
You then can register the dag to the bundle via the builder by calling
MyDagBuilder.build()
in the BundleBuilder's getDags().
A lot of code for a little benefit for the moment, but this should make
taskflow-style XCom a lot easier. (This is not implemented yet.)
* Push XCom from return value
* Support auto XCom set and get
Generate extra code around the annotated function to pass in XCom
references, and set XCom from the return value.
* Move builder annotations to 'Builder'
* Allow customizing generated builder class name
* Add tests for annotation processor
uranusjr
added a commit
that referenced
this pull request
May 27, 2026
* Introduce DagBuilder annotations
This provides two annotations: DagBuilder and DagBuilder.Task that
*slightly* reduces the boilerplate needed to define tasks in Java (about
two lines per task, and two more lines for the dag).
The way this works is you do
@DagBuilder
public class MyDag {
@DagBuilder.Task
public void myTask(...) { ... }
}
and the compiler uses our annotation processor to generate a wrapper
class named MyDagBuilder with the needed tasks and dependencies defined.
You then can register the dag to the bundle via the builder by calling
MyDagBuilder.build()
in the BundleBuilder's getDags().
A lot of code for a little benefit for the moment, but this should make
taskflow-style XCom a lot easier. (This is not implemented yet.)
* Push XCom from return value
* Support auto XCom set and get
Generate extra code around the annotated function to pass in XCom
references, and set XCom from the return value.
* Move builder annotations to 'Builder'
* Allow customizing generated builder class name
* Add tests for annotation processor
uranusjr
added a commit
that referenced
this pull request
May 29, 2026
* Introduce DagBuilder annotations
This provides two annotations: DagBuilder and DagBuilder.Task that
*slightly* reduces the boilerplate needed to define tasks in Java (about
two lines per task, and two more lines for the dag).
The way this works is you do
@DagBuilder
public class MyDag {
@DagBuilder.Task
public void myTask(...) { ... }
}
and the compiler uses our annotation processor to generate a wrapper
class named MyDagBuilder with the needed tasks and dependencies defined.
You then can register the dag to the bundle via the builder by calling
MyDagBuilder.build()
in the BundleBuilder's getDags().
A lot of code for a little benefit for the moment, but this should make
taskflow-style XCom a lot easier. (This is not implemented yet.)
* Push XCom from return value
* Support auto XCom set and get
Generate extra code around the annotated function to pass in XCom
references, and set XCom from the return value.
* Move builder annotations to 'Builder'
* Allow customizing generated builder class name
* Add tests for annotation processor
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
(Unit tests to come later…)
This provides two annotations: DagBuilder and DagBuilder.Task that slightly reduces the boilerplate needed to define tasks in Java (about two lines per task, and two more lines for the dag).
The way this works is you do
and the compiler uses our annotation processor to generate a wrapper class named MyDagBuilder with the needed tasks and dependencies defined. You then can register the dag to the bundle via the builder by calling
in the BundleBuilder's getDags().
A lot of code for a little benefit for the moment, but this should make taskflow-style XCom a lot easier. (This is not implemented yet.)
For reference, this is the generated source file
build/generated/sources/annotationProcessor/java/main/org/apache/airflow/example/AnnotationExampleBuilder.java