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


##########
airflow-core/docs/authoring-and-scheduling/language-sdks/typescript.rst:
##########
@@ -295,6 +295,28 @@ The packer reads the name from the call as written, so a 
call it cannot read, su
 Name that task explicitly: without an id it falls back to the handler's 
run-time name, which
 minification has already changed.
 
+Order-only edges
+~~~~~~~~~~~~~~~~
+
+An edge that carries no value has no argument name to travel under, so it is 
drawn between the
+references themselves with ``before`` and ``after``, the TypeScript pair for 
Python's ``>>`` and
+``<<``:
+
+.. code-block:: typescript
+
+    const loaded = load({ transformed });
+    const cleaned = cleanup();
+
+    loaded.before(cleaned);                  // load >> cleanup
+    cleaned.after(loaded, transformed);      // [load, transform] >> cleanup
+

Review Comment:
   Fixed — the comments now name the references the lines actually use, `loaded 
>> cleaned`.



##########
airflow-core/docs/authoring-and-scheduling/language-sdks/typescript.rst:
##########
@@ -295,6 +295,28 @@ The packer reads the name from the call as written, so a 
call it cannot read, su
 Name that task explicitly: without an id it falls back to the handler's 
run-time name, which
 minification has already changed.
 
+Order-only edges
+~~~~~~~~~~~~~~~~
+
+An edge that carries no value has no argument name to travel under, so it is 
drawn between the
+references themselves with ``before`` and ``after``, the TypeScript pair for 
Python's ``>>`` and
+``<<``:
+
+.. code-block:: typescript
+
+    const loaded = load({ transformed });
+    const cleaned = cleanup();
+
+    loaded.before(cleaned);                  // load >> cleanup
+    cleaned.after(loaded, transformed);      // [load, transform] >> cleanup
+
+Both take any number of references, so one call draws several edges, and 
drawing an edge that
+already exists changes nothing. Each returns the reference it was called on, so
+``loaded.before(cleaned).before(notified)`` draws both edges from ``load``.

Review Comment:
   Fixed.



##########
ts-sdk/src/sdk/dag.ts:
##########
@@ -324,11 +362,15 @@ export class Dag {
   readonly spec: DagSpec;
   readonly #tasks = new Map<string, TaskRecord>();
   readonly #inputs = new Map<string, RecordedInputs>();
+  // Keyed "upstream\u0000downstream", so declaring an edge twice records it

Review Comment:
   It is the six-character escape `\u0000`, not a control character in the 
file, but it reads badly. The separator is now a named constant 
(`EDGE_KEY_SEPARATOR`) and the comment no longer spells it.



##########
ts-sdk/src/sdk/dag.ts:
##########
@@ -291,6 +328,7 @@ export type RecordedInputs = Readonly<Record<string, 
TaskRef | JsonValue>>;
 // Dag's private state without public accessors on the class.
 let taskRecordsOf: (dag: Dag) => ReadonlyMap<string, TaskRecord>;
 let inputsOf: (dag: Dag) => ReadonlyMap<string, RecordedInputs>;
+let orderEdgesOf: (dag: Dag) => readonly OrderEdge[];

Review Comment:
   Self-loops are now rejected where the edge is drawn, since that needs no 
graph walk: `a.before(a)` throws. General cycle detection is the next PR but 
one, #73440; the test comment no longer refers forward to it.



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