Skip to content

Commit 60b8056

Browse files
0vj00venkat
and
venkat
authored
Fix broken stat scheduler_loop_duration (#42886)
* wip * wip * fix lint err --------- Co-authored-by: venkat <[email protected]>
1 parent b86bb24 commit 60b8056

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

airflow/jobs/scheduler_job_runner.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,16 +1088,18 @@ def _run_scheduler_loop(self) -> None:
10881088
)
10891089

10901090
for loop_count in itertools.count(start=1):
1091-
with Trace.start_span(span_name="scheduler_job_loop", component="SchedulerJobRunner") as span:
1091+
with Trace.start_span(
1092+
span_name="scheduler_job_loop", component="SchedulerJobRunner"
1093+
) as span, Stats.timer("scheduler.scheduler_loop_duration") as timer:
10921094
span.set_attribute("category", "scheduler")
10931095
span.set_attribute("loop_count", loop_count)
1094-
with Stats.timer("scheduler.scheduler_loop_duration") as timer:
1095-
if self.using_sqlite and self.processor_agent:
1096-
self.processor_agent.run_single_parsing_loop()
1097-
# For the sqlite case w/ 1 thread, wait until the processor
1098-
# is finished to avoid concurrent access to the DB.
1099-
self.log.debug("Waiting for processors to finish since we're using sqlite")
1100-
self.processor_agent.wait_until_finished()
1096+
1097+
if self.using_sqlite and self.processor_agent:
1098+
self.processor_agent.run_single_parsing_loop()
1099+
# For the sqlite case w/ 1 thread, wait until the processor
1100+
# is finished to avoid concurrent access to the DB.
1101+
self.log.debug("Waiting for processors to finish since we're using sqlite")
1102+
self.processor_agent.wait_until_finished()
11011103

11021104
with create_session() as session:
11031105
# This will schedule for as many executors as possible.

0 commit comments

Comments
 (0)