This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 8cb3518 Attempt to fix flaky timeout test (#18862)
8cb3518 is described below
commit 8cb351875ec4b902693a5f7b27db3f526075e348
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sun Oct 10 10:09:03 2021 +0200
Attempt to fix flaky timeout test (#18862)
The test_do_schedule_max_active_runs_dag_timed_out test
fails occasionally with task state where it is in
queuing rather than running state:
```
> assert run2.state == State.RUNNING
E AssertionError: assert 'queued' == <TaskInstance...NG: 'running'>
E - running
E + queued
```
The most likey reason was that sesion was not flushed after
task state has been set to Failed and the subsequent
query that queues subsequent runs did not see that there are
no more active dag_runs running.
---
tests/jobs/test_scheduler_job.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/jobs/test_scheduler_job.py b/tests/jobs/test_scheduler_job.py
index 87ebd51..9581016 100644
--- a/tests/jobs/test_scheduler_job.py
+++ b/tests/jobs/test_scheduler_job.py
@@ -2694,7 +2694,7 @@ class TestSchedulerJob:
session.refresh(run1)
assert run1.state == State.FAILED
assert run1_ti.state == State.SKIPPED
-
+ session.flush()
# Run relevant part of scheduling again to assert run2 has been
scheduled
self.scheduler_job._start_queued_dagruns(session)
session.flush()