amoghrajesh commented on code in PR #45282:
URL: https://github.com/apache/airflow/pull/45282#discussion_r1899433271
##########
task_sdk/tests/execution_time/test_task_runner.py:
##########
@@ -295,6 +295,47 @@ def test_run_raises_base_exception(time_machine,
mocked_parse, make_ti_context):
)
+def test_run_raises_system_exit(time_machine, mocked_parse, make_ti_context):
+ """Test running a basic task that exits with SystemExit exception."""
+ from airflow.providers.standard.operators.python import PythonOperator
+
+ task = PythonOperator(
+ task_id="system_exit_task",
+ python_callable=lambda: exit(10),
+ )
+
+ what = StartupDetails(
+ ti=TaskInstance(
+ id=uuid7(),
+ task_id="system_exit_task",
+ dag_id="basic_dag_system_exit",
+ run_id="c",
+ try_number=1,
+ ),
+ file="",
+ requests_fd=0,
+ ti_context=make_ti_context(),
+ )
+
+ ti = mocked_parse(what, "basic_dag_system_exit", task)
+
+ instant = timezone.datetime(2024, 12, 3, 10, 0)
+ time_machine.move_to(instant, tick=False)
+
+ with mock.patch(
+ "airflow.sdk.execution_time.task_runner.SUPERVISOR_COMMS", create=True
+ ) as mock_supervisor_comms:
Review Comment:
Alright, yeah, didn't realise it was added in #45245
--
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]