From: Dan Mick Date: Fri, 31 Jul 2015 20:17:16 +0000 (-0700) Subject: lock.find_stale_locks: filter out some non-scheduled runs X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fheads%2Fwip-allow-no-owner-nuke;p=teuthology.git 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 --- 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