This is an automated email from the ASF dual-hosted git repository.

vatsrahul1001 pushed a commit to branch v3-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-4-test by this push:
     new fb0138b48d2 [v3-4-test] TS SDK: Collect dag_dependencies in the tasks 
pass (#75032) (#75191)
fb0138b48d2 is described below

commit fb0138b48d28c60b1b6279659a9c61c1532c1e3d
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Oct 20 14:32:17 2026 +0530

    [v3-4-test] TS SDK: Collect dag_dependencies in the tasks pass (#75032) 
(#75191)
    
    (cherry picked from commit 94ce2c9f9987a9d9a7cf71b008b066d05da158e8)
    
    Co-authored-by: Guan-Ming Chiu 
<[email protected]>
---
 ts-sdk/src/coordinator/serde.ts | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/ts-sdk/src/coordinator/serde.ts b/ts-sdk/src/coordinator/serde.ts
index c8bcd655009..ba789f0c907 100644
--- a/ts-sdk/src/coordinator/serde.ts
+++ b/ts-sdk/src/coordinator/serde.ts
@@ -100,21 +100,19 @@ function serializeEdgeInfo(dag: Dag): SerializedValue {
   return info;
 }
 
-/** The Dags this one's tasks depend on, for the UI dependency graph. */
-function serializeDagDependencies(dag: Dag): SerializedValue {
-  const dependencies: SerializedValue[] = [];
-  for (const [taskId, record] of getDagTaskRecords(dag)) {
-    for (const dependency of record.operator?.getDagDependencies?.() ?? []) {
-      dependencies.push({
-        source: dag.dagId,
-        target: dependency.target,
-        label: taskId,
-        dependency_type: dependency.dependencyType,
-        dependency_id: taskId,
-      });
-    }
-  }
-  return dependencies;
+/** The Dags this task depends on, for the UI dependency graph. */
+function serializeDagDependencies(
+  dagId: string,
+  taskId: string,
+  record: TaskRecord,
+): SerializedValue[] {
+  return (record.operator?.getDagDependencies?.() ?? []).map((dependency) => ({
+    source: dagId,
+    target: dependency.target,
+    label: taskId,
+    dependency_type: dependency.dependencyType,
+    dependency_id: taskId,
+  }));
 }
 
 /** How one set of authoring fields is written into a serialized object. */
@@ -164,6 +162,7 @@ export function serializeDag(
 ): Record<string, SerializedValue> {
   const graph = buildDagGraph(dag);
   const inputs = getDagTaskInputs(dag);
+  const dagDependencies: SerializedValue[] = [];
   const data: Record<string, SerializedValue> = {
     dag_id: dag.dagId,
     fileloc,
@@ -174,17 +173,18 @@ export function serializeDag(
     // a native TypeScript Dag's cron is read in UTC.
     timezone: "UTC",
     timetable: serializeTimetable(dag.spec.schedule, dag.dagId),
-    tasks: [...getDagTaskRecords(dag)].map(([taskId, record]) =>
-      serializeTask(
+    tasks: [...getDagTaskRecords(dag)].map(([taskId, record]) => {
+      dagDependencies.push(...serializeDagDependencies(dag.dagId, taskId, 
record));
+      return serializeTask(
         dag.dagId,
         taskId,
         record,
         graph.downstreamTaskIds.get(taskId),
         inputs.get(taskId),
         dag.spec.queue,
-      ),
-    ),
-    dag_dependencies: serializeDagDependencies(dag),
+      );
+    }),
+    dag_dependencies: dagDependencies,
     task_group: serializeTaskGroups(dag, graph),
     edge_info: serializeEdgeInfo(dag),
     params: [],

Reply via email to