From f476ee7a79f05a22a95498e315edcce450a7e319 Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Fri, 31 Jul 2015 13:17:16 -0700 Subject: [PATCH] lock.find_stale_locks: filter out some non-scheduled runs These fix some places where the current heuristic misidentifies scheduled runs for no-owner --dry-run --stale searches. Signed-off-by: Dan Mick --- teuthology/lock.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/teuthology/lock.py b/teuthology/lock.py index 2524ff99e..845cfa83e 100644 --- a/teuthology/lock.py +++ b/teuthology/lock.py @@ -578,10 +578,27 @@ def find_stale_locks(owner=None): if description in cache: return True (name, job_id) = description.split('/')[-2:] + + # this job might happen to have two '/' in its desc, but + # not be a scheduled job; demand that the split resulted in + # an int + try: + int(job_id) + except ValueError: + cache.add(description) + return True + url = os.path.join(config.results_server, 'runs', name, 'jobs', job_id, '') resp = requests.get(url) - job_info = resp.json() + + # paddles may not have heard of this job; if so, it's not one we want + try: + job_info = resp.json() + except ValueError: + cache.add(description) + return True + if job_info['status'] in ('running', 'waiting'): cache.add(description) return True -- 2.47.3