Skip to content

Commit

Permalink
apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
ephraimbuddy committed Jun 16, 2021
1 parent 11b0de5 commit 6e41893
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions airflow/jobs/local_task_job.py
Expand Up @@ -272,8 +272,9 @@ def _update_dagrun_state_for_paused_dag(self, session=None):
Checks for paused dags with DagRuns in the running state and
update the DagRun state if possible
"""
dag_run = self.task_instance.get_dagrun(session=session)
if dag_run:
dag = dag_run.dag = self.task_instance.task.dag
if dag.get_is_paused(session=session):
dag = self.task_instance.task.dag
if dag.get_is_paused():
dag_run = self.task_instance.get_dagrun(session=session)
if dag_run:
dag_run.dag = dag
dag_run.update_state(session=session, execute_callbacks=True)
2 changes: 1 addition & 1 deletion tests/jobs/test_local_task_job.py
Expand Up @@ -749,5 +749,5 @@ def test_number_of_queries_single_loop(self, mock_get_task_runner, return_codes)
mock_get_task_runner.return_value.return_code.side_effects = return_codes

job = LocalTaskJob(task_instance=ti, executor=MockExecutor())
with assert_queries_count(17):
with assert_queries_count(16):
job.run()

0 comments on commit 6e41893

Please sign in to comment.