kaxil commented on code in PR #44907:
URL: https://github.com/apache/airflow/pull/44907#discussion_r1888293743


##########
task_sdk/src/airflow/sdk/api/client.py:
##########
@@ -134,6 +135,13 @@ def defer(self, id: uuid.UUID, msg):
         # Create a deferred state payload from msg
         self.client.patch(f"task-instances/{id}/state", 
content=body.model_dump_json())
 
+    def reschedule(self, id: uuid.UUID, msg):
+        """Tell the API server that this TI has been reschduled."""
+        body = TIRescheduleStatePayload(**msg.model_dump(exclude_unset=True))

Review Comment:
   Yeah, I go back and forth on it.
   
   `RescheduleTask` is an easy one because it currently has only one attribute: 
`reschedule_date`, which is needed from `Task Runner` -> `Supervisor`, so it 
can be passed an explicit argument.
   
   But for something like defer it has `classpath`, `trigger_kwargs`, 
`next_method` and `trigger_timeout`, so we just need to decide whether we want 
to keep client code decoupled. The downside is some code duplication
   
   We don't strictly need to do that, as the `payload` expected by various 
endpoints, and therefore for client, are all in `_generated.py` which are 
inherited in `comms.py` anyway. So there is already a coupling of "comm 
messages" between Supervisor & Task Runner with the Some of the Payloads.
   
   ----
   
   But regardless of that, yes we should have the typehints.



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