You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ms...@apache.org on 2020/10/21 05:56:56 UTC
[airflow] branch master updated: Update TIs with a proper lock
(#11683)
This is an automated email from the ASF dual-hosted git repository.
msumit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/master by this push:
new 3caa539 Update TIs with a proper lock (#11683)
3caa539 is described below
commit 3caa539092d3a4196083d1db829fa1ed7d83fa95
Author: Sumit Maheshwari <sm...@twitter.com>
AuthorDate: Wed Oct 21 11:25:50 2020 +0530
Update TIs with a proper lock (#11683)
---
airflow/jobs/scheduler_job.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/airflow/jobs/scheduler_job.py b/airflow/jobs/scheduler_job.py
index a331e7b..8aee46c 100644
--- a/airflow/jobs/scheduler_job.py
+++ b/airflow/jobs/scheduler_job.py
@@ -849,7 +849,8 @@ class SchedulerJob(BaseJob): # pylint: disable=too-many-instance-attributes
# We need to do this for mysql as well because it can cause deadlocks
# as discussed in https://issues.apache.org/jira/browse/AIRFLOW-2516
if self.using_sqlite or self.using_mysql:
- tis_to_change: List[TI] = with_row_locks(query).all()
+ tis_to_change: List[TI] = with_row_locks(query, of=TI,
+ **skip_locked(session=session)).all()
for ti in tis_to_change:
ti.set_state(new_state, session=session)
tis_changed += 1