Copilot commented on code in PR #70719:
URL: https://github.com/apache/airflow/pull/70719#discussion_r3685453869
##########
task-sdk/tests/task_sdk/execution_time/test_task_runner.py:
##########
@@ -980,6 +988,214 @@ def test_defer_task_queue_assignment(
)
[email protected](
+ ("should_retry", "expected_state"),
+ [
+ (True, TaskInstanceState.UP_FOR_RETRY),
+ (False, TaskInstanceState.FAILED),
+ ],
+)
+def test_defer_with_unserializable_kwargs_honours_retries_and_callbacks(
+ should_retry, expected_state, create_runtime_ti, mock_supervisor_comms
+):
+ """
+ A task that defers with a non-serializable ``next_kwargs`` value must fail
like any
+ other task, rather than taking the whole run down.
+
+ ``_defer_task`` runs ``serde_serialize`` on the deferral kwargs, which
raises
+ ``TypeError`` for anything it has no serializer for (a file handle, a
client object,
+ a lambda). That raise happens inside ``run()``'s ``except TaskDeferred``
handler, so
+ before the fix it escaped ``run()`` without evaluating retries or running
callbacks --
+ the same defect as https://github.com/apache/airflow/issues/70683, reached
without
+ involving the API server at all.
Review Comment:
Test docstring references a GitHub issue URL/number. Per Airflow testing
guidelines, avoid issue numbers in test docstrings; keep the rationale but
remove the issue identifier.
This issue also appears on line 5415 of the same file.
--
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]