ChickenBenny commented on code in PR #75387:
URL: https://github.com/apache/airflow/pull/75387#discussion_r4434923986
##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -383,36 +383,33 @@ def ti_run(
if first_task_reschedule_start_date is not None:
context.first_task_reschedule_start_date =
first_task_reschedule_start_date
- # Avoid loading the serialized Dag on the normal Python task path:
only a lang-SDK
- # (foreign-runtime) task needs its definition here, and ti.is_stub
carries the row's own copy
- # of the serialized flag.
- serialized_task = get_task(dag_bag, ti, session=session) if ti.is_stub
else None
-
- # Only set for lang-SDK (foreign-runtime) tasks with a captured
TaskFlow arg
- # spec; the route excludes unset fields, keeping regular responses
lean.
- if client_supports_arg_bindings() and (arg_bindings :=
get_arg_bindings(serialized_task)):
- try:
- context.arg_bindings =
get_arg_bindings_adapter().validate_python(arg_bindings)
- except ValidationError:
- log.exception(
- "Serialized arg_bindings spec failed validation",
- dag_id=ti.dag_id,
- task_id=ti.task_id,
- dag_version_id=ti.dag_version_id,
- )
- raise HTTPException(
- status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
- detail={
- "reason": "invalid_arg_bindings",
- "message": "The serialized TaskFlow arg spec for this
stub task is not valid.",
- },
- )
+ # Only a lang-SDK (foreign-runtime) task needs its definition here: a
Python task parses its
+ # Dag file itself. ti.is_stub carries the row's own copy of the
serialized flag, so a Python
+ # task never loads the serialized Dag.
+ if ti.is_stub and (serialized_task := get_task(dag_bag, ti,
session=session)) is not None:
+ # The route excludes unset fields, keeping responses without a
captured TaskFlow arg spec lean.
+ if client_supports_arg_bindings() and (arg_bindings :=
get_arg_bindings(serialized_task)):
Review Comment:
Fix with 69d2458. The version check now runs first, so a client without
`arg_bindings` support never loads the serialized Dag. It also covers
`execution_timeout`, which is fine: that field only exists in a later API
version, so older clients would have it stripped anyway. I added a short
comment there so it doesn't look like a mistake later.
--
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]