jason810496 commented on code in PR #72765:
URL: https://github.com/apache/airflow/pull/72765#discussion_r3967307534


##########
task-sdk/docs/lang-sdk-spec.rst:
##########
@@ -0,0 +1,167 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+
+Language SDK Spec
+=================
+
+This document fixes the terms an Airflow Language SDK (Go, Java, TypeScript, 
...) uses for
+its user-facing authoring interface, and how they fit together. Every SDK 
spells them in its
+own language's idiom; the terms and the flow are the same everywhere.
+
+Spec version: ``1.0``.
+
+There are two authoring features, and they differ in one thing: who owns the 
graph.
+
+.. code-block:: text
+
+     FEATURE 1                                   FEATURE 2
+     Mixed Language Stub Task                    Native Dag
+     Python owns the graph                       the SDK owns the graph
+
+     Python @task.stub                           Dag(spec)
+     declares dag_id, task_id,                          |
+     arguments, and every edge                          v
+           |                                           dag  <-- owns the 
schedule,
+           | binds by dag_id + task_id                  |        the tasks, 
the edges
+           v                                            v
+     fn --> StubTask(dagId, taskId, fn)          fn --> dag.Task(fn, options)
+                    |                                           |
+                    v                                           v
+              StubTaskRef                                    TaskRef
+                    |                                           |
+                    |                                           |  Inputs(ref) 
     data edge, carries a value
+                    |                                           |  before / 
after   order edge, carries nothing
+                    |                                           v
+                    |                                        TaskRef
+                    |                                           |
+                    +---------------------+---------------------+
+                                          |
+                                          v
+                          bundle.register(Dag | StubTask)
+                                          |
+                                          v
+                                   bundle.serve()  <-- the task subprocess 
entrypoint
+
+A ``StubTask`` supplies a body for a task Python already declared, so it names 
the
+``dagId``/``taskId`` pair it binds to and nothing else. A native ``Dag`` owns 
the schedule, the
+tasks, and the edges, so ``dag.Task`` returns a ``TaskRef`` that edges attach 
to. Both features
+land in the same ``bundle``, and one ``bundle.serve()`` call serves both, so a 
single process can carry
+native Dags and mixed-language stub tasks at once.
+
+Terms
+-----
+
+.. list-table::
+   :header-rows: 1
+   :widths: 22 78
+
+   * - Term
+     - Definition
+   * - ``fn``
+     - The function callable itself: the task body a user writes.
+   * - ``StubTask``
+     - Callable interface factory over ``(dagId, taskId, fn)``; returns a 
``StubTaskRef``.

Review Comment:
   It _could_ be just the `TaskRef`, but I feel it would be better to have the 
dedicated `TaskHandlerRef` to store both the `dagId` and `taskId` on the entity.
   
   In the case of native Task (`TaskRef`), it should only hold the TaskId, and 
the DagId will be hold by `DagRef`.



-- 
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]

Reply via email to