@@ -109,7 +109,7 @@ def test_localtaskjob_essential_attr(self, dag_maker):
109
109
of LocalTaskJob can be assigned with
110
110
proper values without intervention
111
111
"""
112
- with dag_maker ("test_localtaskjob_essential_attr" ):
112
+ with dag_maker ("test_localtaskjob_essential_attr" , serialized = True ):
113
113
op1 = EmptyOperator (task_id = "op1" )
114
114
115
115
dr = dag_maker .create_dagrun ()
@@ -127,6 +127,7 @@ def test_localtaskjob_essential_attr(self, dag_maker):
127
127
check_result_2 = [getattr (job1 , attr ) is not None for attr in essential_attr ]
128
128
assert all (check_result_2 )
129
129
130
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
130
131
def test_localtaskjob_heartbeat (self , dag_maker ):
131
132
session = settings .Session ()
132
133
with dag_maker ("test_localtaskjob_heartbeat" ):
@@ -173,6 +174,7 @@ def test_localtaskjob_heartbeat(self, dag_maker):
173
174
assert not job1 .task_runner .run_as_user
174
175
job_runner .heartbeat_callback ()
175
176
177
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
176
178
@mock .patch ("subprocess.check_call" )
177
179
@mock .patch ("airflow.jobs.local_task_job_runner.psutil" )
178
180
def test_localtaskjob_heartbeat_with_run_as_user (self , psutil_mock , _ , dag_maker ):
@@ -227,6 +229,7 @@ def test_localtaskjob_heartbeat_with_run_as_user(self, psutil_mock, _, dag_maker
227
229
assert ti .pid != job1 .task_runner .process .pid
228
230
job_runner .heartbeat_callback ()
229
231
232
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
230
233
@conf_vars ({("core" , "default_impersonation" ): "testuser" })
231
234
@mock .patch ("subprocess.check_call" )
232
235
@mock .patch ("airflow.jobs.local_task_job_runner.psutil" )
@@ -282,6 +285,7 @@ def test_localtaskjob_heartbeat_with_default_impersonation(self, psutil_mock, _,
282
285
assert ti .pid != job1 .task_runner .process .pid
283
286
job_runner .heartbeat_callback ()
284
287
288
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
285
289
def test_heartbeat_failed_fast (self ):
286
290
"""
287
291
Test that task heartbeat will sleep when it fails fast
@@ -323,6 +327,7 @@ def test_heartbeat_failed_fast(self):
323
327
delta = (time2 - time1 ).total_seconds ()
324
328
assert abs (delta - job .heartrate ) < 0.8
325
329
330
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
326
331
@conf_vars ({("core" , "task_success_overtime" ): "1" })
327
332
def test_mark_success_no_kill (self , caplog , get_test_dag , session ):
328
333
"""
@@ -354,6 +359,7 @@ def test_mark_success_no_kill(self, caplog, get_test_dag, session):
354
359
"State of this instance has been externally set to success. Terminating instance." in caplog .text
355
360
)
356
361
362
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
357
363
def test_localtaskjob_double_trigger (self ):
358
364
dag = self .dagbag .dags .get ("test_localtaskjob_double_trigger" )
359
365
task = dag .get_task ("test_localtaskjob_double_trigger_task" )
@@ -392,6 +398,7 @@ def test_localtaskjob_double_trigger(self):
392
398
393
399
session .close ()
394
400
401
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
395
402
@patch .object (StandardTaskRunner , "return_code" )
396
403
@mock .patch ("airflow.jobs.scheduler_job_runner.Stats.incr" , autospec = True )
397
404
def test_local_task_return_code_metric (self , mock_stats_incr , mock_return_code , create_dummy_dag ):
@@ -424,6 +431,7 @@ def test_local_task_return_code_metric(self, mock_stats_incr, mock_return_code,
424
431
]
425
432
)
426
433
434
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
427
435
@patch .object (StandardTaskRunner , "return_code" )
428
436
def test_localtaskjob_maintain_heart_rate (self , mock_return_code , caplog , create_dummy_dag ):
429
437
dag , task = create_dummy_dag ("test_localtaskjob_double_trigger" )
@@ -456,6 +464,7 @@ def test_localtaskjob_maintain_heart_rate(self, mock_return_code, caplog, create
456
464
assert time_end - time_start < job1 .heartrate
457
465
assert "Task exited with return code 0" in caplog .text
458
466
467
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
459
468
def test_mark_failure_on_failure_callback (self , caplog , get_test_dag ):
460
469
"""
461
470
Test that ensures that mark_failure in the UI fails
@@ -488,6 +497,7 @@ def test_mark_failure_on_failure_callback(self, caplog, get_test_dag):
488
497
"State of this instance has been externally set to failed. Terminating instance."
489
498
) in caplog .text
490
499
500
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
491
501
def test_dagrun_timeout_logged_in_task_logs (self , caplog , get_test_dag ):
492
502
"""
493
503
Test that ensures that if a running task is externally skipped (due to a dagrun timeout)
@@ -520,6 +530,7 @@ def test_dagrun_timeout_logged_in_task_logs(self, caplog, get_test_dag):
520
530
assert ti .state == State .SKIPPED
521
531
assert "DagRun timed out after " in caplog .text
522
532
533
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
523
534
def test_failure_callback_called_by_airflow_run_raw_process (self , monkeypatch , tmp_path , get_test_dag ):
524
535
"""
525
536
Ensure failure callback of a task is run by the airflow run --raw process
@@ -555,6 +566,7 @@ def test_failure_callback_called_by_airflow_run_raw_process(self, monkeypatch, t
555
566
assert m , "pid expected in output."
556
567
assert os .getpid () != int (m .group (1 ))
557
568
569
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
558
570
@conf_vars ({("core" , "task_success_overtime" ): "5" })
559
571
def test_mark_success_on_success_callback (self , caplog , get_test_dag ):
560
572
"""
@@ -586,6 +598,7 @@ def test_mark_success_on_success_callback(self, caplog, get_test_dag):
586
598
"State of this instance has been externally set to success. Terminating instance." in caplog .text
587
599
)
588
600
601
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
589
602
def test_success_listeners_executed (self , caplog , get_test_dag ):
590
603
"""
591
604
Test that ensures that when listeners are executed, the task is not killed before they finish
@@ -623,6 +636,7 @@ def test_success_listeners_executed(self, caplog, get_test_dag):
623
636
)
624
637
lm .clear ()
625
638
639
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
626
640
@conf_vars ({("core" , "task_success_overtime" ): "3" })
627
641
def test_success_slow_listeners_executed_kill (self , caplog , get_test_dag ):
628
642
"""
@@ -659,6 +673,7 @@ def test_success_slow_listeners_executed_kill(self, caplog, get_test_dag):
659
673
)
660
674
lm .clear ()
661
675
676
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
662
677
@conf_vars ({("core" , "task_success_overtime" ): "3" })
663
678
def test_success_slow_task_not_killed_by_overtime_but_regular_timeout (self , caplog , get_test_dag ):
664
679
"""
@@ -698,6 +713,7 @@ def test_success_slow_task_not_killed_by_overtime_but_regular_timeout(self, capl
698
713
)
699
714
lm .clear ()
700
715
716
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
701
717
@pytest .mark .parametrize ("signal_type" , [signal .SIGTERM , signal .SIGKILL ])
702
718
def test_process_os_signal_calls_on_failure_callback (
703
719
self , monkeypatch , tmp_path , get_test_dag , signal_type
@@ -792,6 +808,7 @@ def send_signal(ti, signal_sent, sig):
792
808
lines = f .readlines ()
793
809
assert len (lines ) == 0
794
810
811
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
795
812
@pytest .mark .parametrize (
796
813
"conf, init_state, first_run_state, second_run_state, task_ids_to_run, error_message" ,
797
814
[
@@ -876,6 +893,7 @@ def test_fast_follow(
876
893
if scheduler_job_runner .processor_agent :
877
894
scheduler_job_runner .processor_agent .end ()
878
895
896
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
879
897
@conf_vars ({("scheduler" , "schedule_after_task_execution" ): "True" })
880
898
def test_mini_scheduler_works_with_wait_for_upstream (self , caplog , get_test_dag ):
881
899
dag = get_test_dag ("test_dagrun_fast_follow" )
@@ -944,7 +962,7 @@ def task_function(ti):
944
962
945
963
os .kill (psutil .Process (os .getpid ()).ppid (), signal .SIGSEGV )
946
964
947
- with dag_maker (dag_id = "test_segmentation_fault" ):
965
+ with dag_maker (dag_id = "test_segmentation_fault" , serialized = True ):
948
966
task = PythonOperator (
949
967
task_id = "test_sigsegv" ,
950
968
python_callable = task_function ,
@@ -975,7 +993,7 @@ def test_number_of_queries_single_loop(mock_get_task_runner, dag_maker):
975
993
mock_get_task_runner .return_value .return_code .side_effects = [[0 ], codes ]
976
994
977
995
unique_prefix = str (uuid .uuid4 ())
978
- with dag_maker (dag_id = f"{ unique_prefix } _test_number_of_queries" ):
996
+ with dag_maker (dag_id = f"{ unique_prefix } _test_number_of_queries" , serialized = True ):
979
997
task = EmptyOperator (task_id = "test_state_succeeded1" )
980
998
981
999
dr = dag_maker .create_dagrun (run_id = unique_prefix , state = State .NONE )
@@ -992,6 +1010,7 @@ def test_number_of_queries_single_loop(mock_get_task_runner, dag_maker):
992
1010
class TestSigtermOnRunner :
993
1011
"""Test receive SIGTERM on Task Runner."""
994
1012
1013
+ @pytest .mark .skip_if_database_isolation_mode # Does not work in db isolation mode
995
1014
@pytest .mark .parametrize (
996
1015
"daemon" , [pytest .param (True , id = "daemon" ), pytest .param (False , id = "non-daemon" )]
997
1016
)
0 commit comments