summaryrefslogtreecommitdiff
path: root/zuul
diff options
context:
space:
mode:
authorSimon Westphahl <simon.westphahl@bmw.de>2022-08-11 15:38:53 +0200
committerSimon Westphahl <simon.westphahl@bmw.de>2022-08-11 16:04:31 +0200
commitd61b9772ff6c5af57d93414bdc0f1a9d62ae35b4 (patch)
treeefdc3f3a2fff9102cb871b887a45e2391b4ce8b7 /zuul
parentd35b9f8c73df7fd84251d225f15f3cd22388690c (diff)
downloadzuul-d61b9772ff6c5af57d93414bdc0f1a9d62ae35b4.tar.gz
Fix zoned executor metric when unzoned is allowed
An executor can have a zone configured and at the same time allow unzoned jobs. In this case the executor was not counted for the zoned executor metric (online/accepting). Change-Id: Ib39947e3403d828b595cf2479e64789e049e63cc
Diffstat (limited to 'zuul')
-rw-r--r--zuul/executor/server.py4
-rw-r--r--zuul/scheduler.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/zuul/executor/server.py b/zuul/executor/server.py
index eac7fa7e5..e00612e9e 100644
--- a/zuul/executor/server.py
+++ b/zuul/executor/server.py
@@ -3157,6 +3157,10 @@ class ExecutorServer(BaseMergeServer):
self.allow_unzoned = get_default(self.config, 'executor',
'allow_unzoned', False)
+ # If this executor has no zone configured it is implicitly unzoned
+ if self.zone is None:
+ self.allow_unzoned = True
+
# Those attributes won't change, so it's enough to set them once on the
# component info.
self.component_info.zone = self.zone
diff --git a/zuul/scheduler.py b/zuul/scheduler.py
index 272235757..dfc922cf1 100644
--- a/zuul/scheduler.py
+++ b/zuul/scheduler.py
@@ -438,12 +438,12 @@ class Scheduler(threading.Thread):
mergers_online = 0
for executor_component in self.component_registry.all("executor"):
- if executor_component.allow_unzoned or not executor_component.zone:
+ if executor_component.allow_unzoned:
if executor_component.state == BaseComponent.RUNNING:
executors_unzoned_online += 1
if executor_component.accepting_work:
executors_unzoned_accepting += 1
- else:
+ if executor_component.zone:
zone_stats = zoned_executor_stats.setdefault(
executor_component.zone,
executor_stats_default.copy())