From 3a829196b9477da5a17a4a5ebf080662830431ad Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Tue, 14 Feb 2023 16:32:51 -0800 Subject: [PATCH] Expand the scope of zkprofile Currently the zkprofile command only profiles the pipeline refresh operations. This expands the scope to include all pipeline operations (refreshing and then any subsequent changes). In particular, this will help identify places where we write too much data. Change-Id: Ida7bcb311b5037f6ce15a166ddeae6db44ed6709 --- zuul/scheduler.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/zuul/scheduler.py b/zuul/scheduler.py index a546339c3e..e81f1f900c 100644 --- a/zuul/scheduler.py +++ b/zuul/scheduler.py @@ -2242,6 +2242,9 @@ class Scheduler(threading.Thread): blocking=False) as lock,\ self.createZKContext(lock, self.log) as ctx: with pipeline.manager.currentContext(ctx): + if ((tenant.name, pipeline.name) in + self._profile_pipelines): + ctx.profile = True with self.statsd_timer(f'{stats_key}.handling'): refreshed = self._process_pipeline( tenant, pipeline) @@ -2310,14 +2313,10 @@ class Scheduler(threading.Thread): stats_key = f'zuul.tenant.{tenant.name}.pipeline.{pipeline.name}' ctx = pipeline.manager.current_context - if (tenant.name, pipeline.name) in self._profile_pipelines: - ctx.profile = True with self.statsd_timer(f'{stats_key}.refresh'): pipeline.change_list.refresh(ctx) pipeline.summary.refresh(ctx) pipeline.state.refresh(ctx) - if (tenant.name, pipeline.name) in self._profile_pipelines: - ctx.profile = False pipeline.state.setDirty(self.zk_client.client) if pipeline.state.old_queues: