From 6e237482804931b883790a2e6e439565ec999056 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Fri, 31 Jul 2009 16:48:27 +0200 Subject: [PATCH] jqueue: Fix error when WaitForJobChange gets invalid ID When JobQueue.WaitForJobChange gets an invalid or no longer existing job ID it tries to return job_info and log_entries, both of which aren't defined yet. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/jqueue.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/jqueue.py b/lib/jqueue.py index ff903ea07..e06c5f866 100644 --- a/lib/jqueue.py +++ b/lib/jqueue.py @@ -1101,6 +1101,10 @@ class JobQueue(object): """ logging.debug("Waiting for changes in job %s", job_id) + + job_info = None + log_entries = None + end_time = time.time() + timeout while True: delta_time = end_time - time.time() @@ -1142,7 +1146,10 @@ class JobQueue(object): logging.debug("Job %s changed", job_id) - return (job_info, log_entries) + if job_info is None and log_entries is None: + return None + else: + return (job_info, log_entries) @utils.LockedMethod @_RequireOpenQueue -- GitLab