You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jason810496 (via GitHub)" <gi...@apache.org> on 2026/07/03 13:53:20 UTC
Re: [PR] Add airflow-ts-pack bundle build tool for TypeScript SDK [airflow]
jason810496 commented on code in PR #69295:
URL: https://github.com/apache/airflow/pull/69295#discussion_r3520241967
##########
task-sdk/tests/task_sdk/coordinators/node/test_coordinator.py:
##########
@@ -45,27 +46,36 @@ def _make_ti(dag_id: str = "test_dag", queue: str = "ts") -> TaskInstance:
)
+def _metadata_yaml(schema_version: str) -> str:
+ return "\n".join(
+ [
+ 'airflow_bundle_metadata_version: "1.0"',
+ "sdk:",
+ " language: typescript",
+ ' version: "0.1.0"',
+ f' supervisor_schema_version: "{schema_version}"',
+ "source: src/airflow.ts",
+ "dags:",
+ " test_dag:",
+ " tasks:",
+ " - test_task",
+ "",
+ ]
+ )
Review Comment:
How about using `"""` template string? Then we can avoid the list concatenation.
##########
ts-sdk/example/package.json:
##########
@@ -5,15 +5,14 @@
"type": "module",
"license": "Apache-2.0",
"scripts": {
- "build": "esbuild src/main.ts --bundle --platform=node --format=esm --target=node22 --outfile=dist/bundle.mjs",
+ "build": "airflow-ts-pack src/main.ts --outdir dist",
Review Comment:
May I ask how will user install the `airflow-ts-pack` tool?
For the existing `airflow-go-pack` tool, users just need to configure the `tool github.com/apache/...` in the `go.mod` to support it.
##########
task-sdk/src/airflow/sdk/coordinators/node/coordinator.py:
##########
@@ -53,6 +57,38 @@ class _NodeBundle:
schema_version: str = attrs.field(validator=_validate_schema_version)
+def _read_embedded_metadata(bundle_path: pathlib.Path) -> dict[str, Any] | None:
Review Comment:
I wonder would it be better to set the metadata header at the beginning of the `.mjs`?
The reason for the Go-SDK side to concat at the end of the binary file is to make the file still executable as normal.
For TS-SDK side, since the `.mjs` itself is a normal file, it should be fine to peek at the beginning of the file IMO.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org