ChickenBenny commented on code in PR #74869:
URL: https://github.com/apache/airflow/pull/74869#discussion_r4303016744


##########
airflow-core/src/airflow/api_fastapi/execution_api/services/task_instances.py:
##########
@@ -44,18 +45,42 @@ def client_supports_arg_bindings() -> bool:
     return AddArgBindingsToTIRunContext.is_applied
 
 
-def get_arg_bindings(dag_bag: DBDagBag, ti: Any, *, session: Session) -> list 
| None:
+def get_stub_task(dag_bag: DBDagBag, ti: Any, *, session: Session) -> 
SerializedOperator | None:
     """
-    Extract the stub task's TaskFlow arg spec from its Dag version.
+    Return the task of *ti* from its Dag version if a language SDK runs it, 
else ``None``.
 
-    Mapped (``.expand()``) stubs never capture a parse-time spec, so they 
resolve to
-    ``None`` here and keep the legacy ignored-args behavior; per-map-index 
delivery
-    lands in a follow-up.
+    Both ``@task.stub`` tasks and the tasks of a Dag defined natively in a 
language SDK
+    serialize with ``is_stub=True``.
     """
     if ti.dag_version_id is None:
         return None
     if (dag := dag_bag.get_dag(ti.dag_version_id, session=session)) is None:
         return None
     if (task := dag.task_dict.get(ti.task_id)) is None or not task.is_stub:
         return None
+    return task
+
+
+def get_arg_bindings(dag_bag: DBDagBag, ti: Any, *, session: Session) -> list 
| None:
+    """
+    Extract the stub task's TaskFlow arg spec from its Dag version.
+
+    Mapped (``.expand()``) stubs never capture a parse-time spec, so they 
resolve to
+    ``None`` here and keep the legacy ignored-args behavior; per-map-index 
delivery
+    lands in a follow-up.
+    """
+    if (task := get_stub_task(dag_bag, ti, session=session)) is None:
+        return None
     return task.arg_bindings
+
+
+def get_language_sdk_execution_timeout(dag_bag: DBDagBag, ti: Any, *, session: 
Session) -> float | None:

Review Comment:
   I fixed it in 658b8147ed, but went a slightly different way from your 
suggestion: a negative value is clamped to `0.0` instead of returning `None`. 
This aligns with how the Python task runner handles it, where a negative 
timeout fails the task right away rather than disabling the timeout: 
https://github.com/apache/airflow/blob/f3784d2e9e10c175ba4421e2afbb14b61feb3519/task-sdk/src/airflow/sdk/execution_time/task_runner.py#L2318-L2326



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