amoghrajesh commented on code in PR #59711:
URL: https://github.com/apache/airflow/pull/59711#discussion_r2645189256


##########
airflow-core/src/airflow/api_fastapi/execution_api/datamodels/taskinstance.py:
##########
@@ -139,7 +139,7 @@ class TIDeferredStatePayload(StrictBaseModel):
     trigger_timeout: timedelta | None = None
     next_method: str
     """The name of the method on the operator to call in the worker after the 
trigger has fired."""
-    next_kwargs: Annotated[dict[str, Any], Field(default_factory=dict)]
+    next_kwargs: Annotated[JsonValue, Field(default_factory=dict)]

Review Comment:
   Gave it some more thought and I think that we should make it as `dict[str, 
JsonValue]` instead.
   
   Worker -> API Server (Deferral):
   ```python
   {  "state": "deferred",  "trigger_kwargs": {"moment": {"__classname__": 
"datetime.datetime", "__version__": 1, "datetime": 
"2024-01-15T10:30:00+00:00"}},  "next_kwargs": {"retry": {"__classname__": 
"bool", "__version__": 1, "bool": true}}}
   ```
   Which will always be a `dict[str, JsonValue]`
   
   API Server -> Worker (Resumption):
   When worker resumes task, API server sends TaskInstance context with:
   ```python
   {  "next_kwargs": {"retry": {"__classname__": "bool", "__version__": 1, 
"bool": true}}}
   ```
   Which will always be a `dict[str, JsonValue]`
   
   Because in both directions, we send `dict[str, JsonValue]`, we should have 
`next_kwargs` be `dict[str, JsonValue]`



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