Skip to content

TS SDK: replace registerTask with Dag and registerDags - #71144

Open
jason810496 wants to merge 1 commit into
apache:mainfrom
jason810496:refactor/ts-sdk/dag-authoring-api
Open

TS SDK: replace registerTask with Dag and registerDags#71144
jason810496 wants to merge 1 commit into
apache:mainfrom
jason810496:refactor/ts-sdk/dag-authoring-api

Conversation

@jason810496

@jason810496 jason810496 commented Aug 5, 2026

Copy link
Copy Markdown
Member

Why

registerTask({ dagId, taskId }, handler) binds one handler to a Python stub Dag/task pair at a time and leaves no object that can carry native TypeScript Dag declaration later (#69288). This PR changes only the user-facing authoring interface so it can grow into TaskFlow and native Dag support without another breaking change.

How

Please noted that the spec at both Dag and Task level arguments (DagSpec, TaskSpec) are no-op, I intentionally placeholder them in this PR to prevent further breaking change.

  • new Dag(dagId, spec?) takes a positional id plus an optional trailing spec object.
  • dag.task(taskId, handler, options?) returns a Task handle, with inputs and spec as named options ({ inputs: { extracted }, spec: { retries: 2 } }) so either can be given alone and future options need no new parameter.
  • A Dag instance retains its spec and each task's (taskId, handler, spec, inputs), so a future serialize() can produce the serialized Dag JSON for DagFileParsingResult.serialized_dags.
  • registerTask, listRegisteredTasks, and TaskRegistration are replaced with registerDags(...dags) as entrypoint.

Was generative AI tooling used to co-author this PR?

@jason810496 jason810496 self-assigned this Aug 5, 2026
@jason810496
jason810496 force-pushed the refactor/ts-sdk/dag-authoring-api branch 3 times, most recently from ab7eba5 to dab6b7b Compare August 6, 2026 04:33
registerTask bound one handler at a time to a Dag/task pair declared in a
Python stub file, and left no object that could later carry a natively
declared TypeScript Dag. Reworking only the authoring interface now means
native Dag support and TaskFlow-style data passing can arrive without a
second breaking change for users: a Dag instance keeps its spec and every
task's handler, spec and declared inputs, which is what a future
serialize() needs to emit the serialized Dag JSON.

Producing that JSON stays out of scope, so Dag parsing still answers with
no serialized Dags. The coordinator wire protocol and the bundle manifest
shape are unchanged.
@jason810496
jason810496 force-pushed the refactor/ts-sdk/dag-authoring-api branch from dab6b7b to 1676164 Compare August 6, 2026 04:58
@jason810496
jason810496 marked this pull request as ready for review August 6, 2026 05:02
@uranusjr

uranusjr commented Aug 6, 2026

Copy link
Copy Markdown
Member

What’s the plan to do the external vs pure TS dags after this?

@jason810496

jason810496 commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

What’s the plan to do the external vs pure TS dags after this?

Along with #71213, the user should set the is_mixed_language_dag for the mixed language Dag case, it will look somehow like new Dag("my_ts_mixed_lang", spec: {is_mixed_language_dag: True, schedule: "..."}).

Additionally, we can introduce a new ExternalDag or new MixedLangDag if we feel having explicitly different user interface is better. IMO, having the is_mixed_language_dag on DagSpec level plus user education should be enough for the first stage.

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.

2 participants