]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
lock.find_stale_locks: filter out some non-scheduled runs wip-allow-no-owner-nuke
authorDan Mick <dan.mick@redhat.com>
Fri, 31 Jul 2015 20:17:16 +0000 (13:17 -0700)
committerDan Mick <dan.mick@redhat.com>
Tue, 4 Aug 2015 23:03:41 +0000 (16:03 -0700)
These fix some places where the current heuristic misidentifies
scheduled runs for no-owner --dry-run --stale searches.

Signed-off-by: Dan Mick <dan.mick@redhat.com>
teuthology/lock.py

index 2524ff99e8efcb20fcff9c09582234806d20bda9..845cfa83e82f179859bc7854a488115d17f03f53 100644 (file)
@@ -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