uranusjr commented on code in PR #30704:
URL: https://github.com/apache/airflow/pull/30704#discussion_r1188477820
##########
airflow/jobs/scheduler_job_runner.py:
##########
@@ -1083,8 +1084,11 @@ def _do_scheduling(self, session: Session) -> int:
callback_tuples = self._schedule_all_dag_runs(guard, dag_runs,
session)
# Send the callbacks after we commit to ensure the context is up to
date when it gets run
+ # cache saves time during scheduling of many dag_runs for same dag
+ cached_get_dag: Callable = lru_cache()(lambda dag_id:
self.dagbag.get_dag(dag_id, session=session))
Review Comment:
VS Code uses Pylance, which uses additional guessing to infer types. The
heuristics mostly work well and are very helpful, but are not always flawless.
Correctly annotating the callable would be more friendly for people using other
tools.
Mypy identifies the type to be `Any` (using `typing.reveal_type()` to
inspect):
```
$ mypy airflow/jobs/scheduler_job_runner.py
airflow/jobs/scheduler_job_runner.py:1092: note: Revealed type is "Any"
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]