You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2024/10/17 22:46:42 UTC
(airflow) branch main updated: Fix broken stat scheduler_loop_duration (#42886)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 60b8056616 Fix broken stat scheduler_loop_duration (#42886)
60b8056616 is described below
commit 60b8056616e94f987c3096dff3b59211d649b4b0
Author: Venkat VJ <ve...@gmail.com>
AuthorDate: Thu Oct 17 15:46:36 2024 -0700
Fix broken stat scheduler_loop_duration (#42886)
* wip
* wip
* fix lint err
---------
Co-authored-by: venkat <ve...@venkats-MacBook-Pro.local>
---
airflow/jobs/scheduler_job_runner.py | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/airflow/jobs/scheduler_job_runner.py b/airflow/jobs/scheduler_job_runner.py
index e085efc314..a052bf700d 100644
--- a/airflow/jobs/scheduler_job_runner.py
+++ b/airflow/jobs/scheduler_job_runner.py
@@ -1088,16 +1088,18 @@ class SchedulerJobRunner(BaseJobRunner, LoggingMixin):
)
for loop_count in itertools.count(start=1):
- with Trace.start_span(span_name="scheduler_job_loop", component="SchedulerJobRunner") as span:
+ with Trace.start_span(
+ span_name="scheduler_job_loop", component="SchedulerJobRunner"
+ ) as span, Stats.timer("scheduler.scheduler_loop_duration") as timer:
span.set_attribute("category", "scheduler")
span.set_attribute("loop_count", loop_count)
- with Stats.timer("scheduler.scheduler_loop_duration") as timer:
- if self.using_sqlite and self.processor_agent:
- self.processor_agent.run_single_parsing_loop()
- # For the sqlite case w/ 1 thread, wait until the processor
- # is finished to avoid concurrent access to the DB.
- self.log.debug("Waiting for processors to finish since we're using sqlite")
- self.processor_agent.wait_until_finished()
+
+ if self.using_sqlite and self.processor_agent:
+ self.processor_agent.run_single_parsing_loop()
+ # For the sqlite case w/ 1 thread, wait until the processor
+ # is finished to avoid concurrent access to the DB.
+ self.log.debug("Waiting for processors to finish since we're using sqlite")
+ self.processor_agent.wait_until_finished()
with create_session() as session:
# This will schedule for as many executors as possible.