ephraimbuddy commented on code in PR #56616:
URL: https://github.com/apache/airflow/pull/56616#discussion_r2429235807
##########
task-sdk/tests/task_sdk/execution_time/test_task_runner.py:
##########
@@ -499,6 +502,27 @@ def test_run_task_timeout(time_machine, create_runtime_ti,
mock_supervisor_comms
mock_supervisor_comms.send.assert_called_with(TaskState(state=TaskInstanceState.FAILED,
end_date=instant))
+def test_execution_timeout(time_machine, create_runtime_ti,
mock_supervisor_comms):
+ def sleep_and_catch_other_exceptions():
+ with contextlib.suppress(Exception):
+ # Catching Exception should NOT catch AirflowTaskTimeout
+ time.sleep(5)
+
+ op = PythonOperator(
+ task_id="test_timeout",
+ execution_timeout=timedelta(seconds=1),
+ python_callable=sleep_and_catch_other_exceptions,
+ )
+
+ ti = create_runtime_ti(task=op, dag_id="dag_execution_timeout")
+
+ instant = timezone.datetime(2024, 12, 3, 10, 0)
+ time_machine.move_to(instant, tick=False)
Review Comment:
Good catch. Not needed. Also removed the mock_supervisior_comms which is
also not needed. These were added while I try several ways to test it.
--
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]