This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-0-test by this push:
     new b28d3a606c9 [v3-0-test] Skip more span-related DB queries in the 
scheduler when tracing is disabled (#54591) (#54626)
b28d3a606c9 is described below

commit b28d3a606c913f5b7ee3f1a6bf0f67b49d770422
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Aug 18 19:33:40 2025 +0100

    [v3-0-test] Skip more span-related DB queries in the scheduler when tracing 
is disabled (#54591) (#54626)
    
    (cherry picked from commit 4550cd2bb47ac3b27807161b5568751d6d9fbe29)
    
    Co-authored-by: Shlomit-B <[email protected]>
---
 airflow-core/src/airflow/jobs/scheduler_job_runner.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/airflow-core/src/airflow/jobs/scheduler_job_runner.py 
b/airflow-core/src/airflow/jobs/scheduler_job_runner.py
index f093a3e3607..981117c0733 100644
--- a/airflow-core/src/airflow/jobs/scheduler_job_runner.py
+++ b/airflow-core/src/airflow/jobs/scheduler_job_runner.py
@@ -283,7 +283,8 @@ class SchedulerJobRunner(BaseJobRunner, LoggingMixin):
 
     def _exit_gracefully(self, signum: int, frame: FrameType | None) -> None:
         """Clean up processor_agent to avoid leaving orphan processes."""
-        self._end_active_spans()
+        if self._is_tracing_enabled():
+            self._end_active_spans()
 
         if not _is_parent_process():
             # Only the parent process should perform the cleanup.
@@ -1931,7 +1932,8 @@ class SchedulerJobRunner(BaseJobRunner, LoggingMixin):
                 return callback
 
             if (
-                dag_run.scheduled_by_job_id is not None
+                self._is_tracing_enabled()
+                and dag_run.scheduled_by_job_id is not None
                 and dag_run.scheduled_by_job_id != self.job.id
                 and self.active_spans.get(dag_run.run_id) is None
             ):

Reply via email to