diff options
author | Stevan Radakovic <stevan.radakovic@linaro.org> | 2016-11-07 10:54:28 +0100 |
---|---|---|
committer | Stevan Radakovic <stevan.radakovic@linaro.org> | 2016-11-07 10:54:28 +0100 |
commit | 9159c96824c52cb650db2fb0661bca62c6ad835b (patch) | |
tree | 02b5553493116a178ffeafa96ed5fe92e76bc3e0 | |
parent | 12fba3ec0dc5a090837dd7fc7c4821e25b65249f (diff) |
-rw-r--r-- | lava_client.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lava_client.py b/lava_client.py index 5516627..3bd2932 100644 --- a/lava_client.py +++ b/lava_client.py @@ -32,6 +32,10 @@ from zmq.utils.strtypes import b, u FINISHED_JOB_STATUS = ["Complete", "Incomplete", "Canceled"] +class JobEndTimeoutError(Exception): + """ Raise when the specified job does not finish in certain timeframe. """ + + class Timeout(): """ Timeout error class with ALARM signal. Accepts time in seconds. """ class TimeoutError(Exception): @@ -73,17 +77,11 @@ class JobListener(): continue data = yaml.safe_load(data) - print data if "job" in data: - print data["job"] - print job_id if data["job"] == job_id: - print "equal" if data["status"] in FINISHED_JOB_STATUS: - break - - return data + return data except Timeout.TimeoutError: - return None - + raise JobEndTimeoutError( + "JobListener timed out after %s seconds." % timeout) |