Skip to content

Commit 78265ec

Browse files
committed
Rename StubTask to TaskHandler in the Java SDK ADRs
Python declares the task; an SDK supplies only its body. Naming the SDK object after the task overloads a word the native surface already uses for something the user creates with dag.Task, so it names the role the SDK actually plays instead.
1 parent 9d6d7ef commit 78265ec

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎java-sdk/adr/0001-mixed-lang-dag-interface.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ This ADR only answers: given that spec, what does the Java code a user writes lo
3636

3737
## Decision
3838

39-
The annotation is `@Builder.StubTask(dagId, taskId)`, not `@Builder.Task(id)`. Python declares the
39+
The annotation is `@Builder.TaskHandler(dagId, taskId)`, not `@Builder.Task(id)`. Python declares the
4040
task with `@task.stub` and Java supplies only its body, so the two are different things and should
4141
not share a name: `@Builder.Dag`/`@Builder.Task` stay with the native surface, where Java owns the
4242
Dag ([ADR-0002](0002-native-dag-interface.md)). Python owns both ids too, so a handler names the pair
@@ -49,7 +49,7 @@ code reads it.
4949
### 1. Annotation based with positional injection
5050

5151
```java
52-
@Builder.StubTask(dagId = "etl", taskId = "score")
52+
@Builder.TaskHandler(dagId = "etl", taskId = "score")
5353
public long score(Client client, long rows, double threshold, List<String> regions) { ... }
5454
```
5555

@@ -83,7 +83,7 @@ public static class ReportInput implements TaskInput {
8383
public long transformed;
8484
}
8585

86-
@Builder.StubTask(dagId = "etl", taskId = "report")
86+
@Builder.TaskHandler(dagId = "etl", taskId = "report")
8787
public void report(ReportInput input) {
8888
log.log(INFO, "Report {0} for transformed value {1}", input.runLabel, input.transformed);
8989
if (!"nightly".equals(input.runLabel)) {
@@ -145,7 +145,7 @@ One verb, overloaded, and everything registers as a class: nothing is constructe
145145
in code the processor writes and type-checks — without asking a Dag author to track argument
146146
order by hand.
147147
- `@Builder.XCom` is retired; the Python call site is the only source of data-flow wiring.
148-
- Renaming the shipped `@Builder.Task` to `@Builder.StubTask(dagId, taskId)` for this surface
148+
- Renaming the shipped `@Builder.Task` to `@Builder.TaskHandler(dagId, taskId)` for this surface
149149
breaks existing mixed-language Dags, which change one annotation and name the Dag they belong to.
150150
- The public surface is not final until the open question above is resolved.
151151

‎java-sdk/adr/0002-native-dag-interface.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Nothing is constructed at registration. Task classes are instantiated per task-i
145145
run ([ADR-0001](0001-mixed-lang-dag-interface.md)), and the Dag definition itself is read once, at
146146
registration, without running a task body.
147147

148-
One bundle carries native Dags and mixed-language stub tasks alike
148+
One bundle carries native Dags and mixed-language task handlers alike
149149
([ADR-0001](0001-mixed-lang-dag-interface.md)), so one process serves both.
150150

151151
## Alternatives
@@ -170,7 +170,7 @@ One bundle carries native Dags and mixed-language stub tasks alike
170170
- A task method is plain Java with a real signature, so nothing about the authoring surface exists
171171
only to satisfy the compiler: no twin class, no `In<T>`, no `TaskRef<T>` wrapper.
172172
- Native tasks keep `@Builder.Task`, while the mixed-language surface moves to
173-
`@Builder.StubTask` ([ADR-0001](0001-mixed-lang-dag-interface.md)), so an annotation names
173+
`@Builder.TaskHandler` ([ADR-0001](0001-mixed-lang-dag-interface.md)), so an annotation names
174174
which of the two things a method is.
175175
- The interface-based surface wires edges through object references (`after(extract)`) rather than
176176
through compile-time-generated calls, so it needs no tree reading and works under any compiler.
@@ -202,6 +202,6 @@ One bundle carries native Dags and mixed-language stub tasks alike
202202
Today's shipped `Dag` has only `addTask(id, definition)`, which returns the Dag rather than a ref;
203203
`.config(...)` is keyed to the Dag serialization schema.
204204
- **`register` is one overloaded verb**: `register(Class<?>)` for an annotated class, `register(Dag)`
205-
for a built one, and `register(dagId, taskId, Class<? extends Task>)` for a stub task
205+
for a built one, and `register(dagId, taskId, Class<? extends Task>)` for a task handler
206206
([ADR-0001](0001-mixed-lang-dag-interface.md)). It is proposed here; today a bundle is built from an
207207
`Iterable<Dag>` through `BundleBuilder.getDags()`.

0 commit comments

Comments
 (0)