aaron-y-chen commented on code in PR #73357:
URL: https://github.com/apache/airflow/pull/73357#discussion_r4056277492


##########
ts-sdk/src/coordinator/client.ts:
##########
@@ -126,6 +139,23 @@ export function createCoordinatorClient(
       return value;
     },
 
+    async setVariable(key: string, value: string, description?: string | 
null): Promise<void> {
+      // `description` is a required wire field the supervisor validates, so it
+      // is always sent; null is what Python's `Variable.set` stores by 
default.
+      const msg: PutVariable = {
+        type: "PutVariable",
+        key,
+        value,
+        description: description ?? null,
+      };
+      await rpc("PutVariable", null, msg, () => undefined, "throw");

Review Comment:
   When the supervisor returns a 404, Go propagates the error and Java throws 
ApiError:
   
   
https://github.com/apache/airflow/blob/7f13852f7d6358036c63e24b4a7a5de80eaaddce/go-sdk/pkg/execution/client.go#L129-L139
   
   
https://github.com/apache/airflow/blob/7f13852f7d6358036c63e24b4a7a5de80eaaddce/java-sdk/sdk/src/main/kotlin/org/apache/airflow/sdk/execution/Comm.kt#L203-L210
   
   That’s why I pass "throw". Otherwise, rpc returns null and the failed write 
appears successful.
   
   
https://github.com/apache/airflow/blob/7f13852f7d6358036c63e24b4a7a5de80eaaddce/ts-sdk/src/coordinator/client.ts#L103-L108



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