jason810496 commented on code in PR #71188:
URL: https://github.com/apache/airflow/pull/71188#discussion_r4071130658
##########
java-sdk/sdk/src/main/kotlin/org/apache/airflow/sdk/Bundle.kt:
##########
@@ -31,17 +31,72 @@ package org.apache.airflow.sdk
class Bundle(
dags: Iterable<DagDef>,
) {
- internal val dags: Map<String, DagDef> = dags.associateByDagId()
-}
+ internal val dags = linkedMapOf<String, DagDef>()
+
+ /** Creates an empty bundle to [register] into. */
+ constructor() : this(emptyList())
-private fun Iterable<DagDef>.associateByDagId(): Map<String, DagDef> {
- val dagMap = linkedMapOf<String, DagDef>()
- for (dag in this) {
- require(dagMap.putIfAbsent(dag.id, dag) == null) {
+ init {
+ dags.forEach { register(it) }
+ }
+
+ /**
+ * Registers a Dag.
+ *
+ * @return This bundle, for chaining.
+ * @throws IllegalArgumentException if another Dag shares its ID.
+ */
+ fun register(dag: DagDef): Bundle {
+ require(dags.putIfAbsent(dag.id, dag) == null) {
"Dags in bundle have duplicate ID: ${dag.id}"
}
+ return this
+ }
+
+ /**
+ * Registers every task handler a class holds, from the ids each
+ * [Builder.TaskHandler] names.
+ *
+ * @param handlerClass A class with [Builder.TaskHandler] methods.
+ * @return This bundle, for chaining.
+ * @throws IllegalArgumentException if the class has no generated
+ * registrar, because annotation processing did not run over it.
+ */
+ fun register(handlerClass: Class<*>): Bundle {
+ val registrar =
+ try {
+ Class.forName("${handlerClass.name}Handlers", true,
handlerClass.classLoader)
Review Comment:
Good catch, aligned in bf6a44c4d9: the registrar name now comes from one
shared function that both the processor and Bundle.register call, so
Outer.Inner resolves Outer_InnerHandlers.
##########
java-sdk/README.md:
##########
@@ -590,7 +590,7 @@ prek hook regenerate it.
<!-- BEGIN AUTO-GENERATED LANG-SDK COMPAT MATRIX -->
-*Min. Airflow version: 3.3 · supervisor schema: 2026-06-16*
+*Min. Airflow version: 3.3 · supervisor schema: 2026-10-30*
Review Comment:
Thanks for the catch. I think it's fine to keep it as-is, since
https://github.com/apache/airflow/pull/71757 would make all the matrix up to
date afterward.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]