XD-DENG commented on a change in pull request #10729:
URL: https://github.com/apache/airflow/pull/10729#discussion_r483806158
##########
File path: tests/jobs/test_backfill_job.py
##########
@@ -1441,3 +1441,97 @@ def test_backfill_run_backwards(self):
dag.clear()
session.close()
+
+ def test_reset_orphaned_tasks_with_orphans(self):
+ """Create dagruns and esnure only ones with correct states are
reset."""
Review comment:
typo `esnure`
##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -1759,3 +1759,46 @@ def _emit_pool_metrics(self, session: Session = None) ->
None:
@provide_session
def heartbeat_callback(self, session: Session = None) -> None:
Stats.incr('scheduler_heartbeat', 1, 1)
+
+ @provide_session
+ def reset_state_for_orphaned_tasks(self, session: Session = None):
Review comment:
I understand this is "overwriting" the same method in the parent class
"BaseJob", but may be good to mention return type in the docstring (or add type
annotations), especially given its return type (returns int) is different from
the same method in the parent class (returns list).
##########
File path: tests/jobs/test_scheduler_job.py
##########
@@ -3328,7 +3327,7 @@ def
test_reset_orphaned_tasks_external_triggered_dag(self):
session.commit()
reset_tis = scheduler.reset_state_for_orphaned_tasks(session=session)
- self.assertEqual(1, len(reset_tis))
+ self.assertEqual(1, reset_tis)
Review comment:
due to the same reason mentioned above, may be good to change the
variable name to something like `num_reset_tis` to avoid confusion
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]