From 80e393f46f9bc6b07c519f804f83eb6d4e55d8ed Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Tue, 21 Apr 2015 11:52:25 +0200 Subject: [PATCH] Support spaces in Gearman functions names Jenkins allow spaces in its job names, when splitting the Gearman status flow, nodepool uses split() which includes both spaces and tabs. That causes an exception: ... File "nodepool/nodepool.py", line 1565, in getNeededNodes label_demand = self.gearman_client.getNeededWorkers() File "nodepool/nodepool.py", line 255, in getNeededWorkers queued = int(parts[1]) - int(parts[2]) ValueError: invalid literal for int() with base 10: 'Dashboard' That is caused by a job named 'Global-Dev Dashboard Data' with the status output being: build:Global-Dev Dashboard Data0023 Since Gearman uses tab separated fields, explicitly split on tabs. Change-Id: I72c49409808251ce87a55f8b6f444b6f57120550 --- nodepool/nodepool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodepool/nodepool.py b/nodepool/nodepool.py index ec0e3738f..541ec35c8 100644 --- a/nodepool/nodepool.py +++ b/nodepool/nodepool.py @@ -249,7 +249,7 @@ class GearmanClient(gear.Client): self._lostConnection(connection) continue for line in req.response.split('\n'): - parts = [x.strip() for x in line.split()] + parts = [x.strip() for x in line.split('\t')] if not parts or parts[0] == '.': continue if not parts[0].startswith('build:'):