diff options
author | Sietze van Buuren <Sietze.vanBuuren@de.bosch.com> | 2022-06-20 12:19:37 +0000 |
---|---|---|
committer | Andrej Shadura <andrew.shadura@collabora.co.uk> | 2023-01-04 15:26:24 +0100 |
commit | 9be8db8ab65c5d02155865668ce1686306d44825 (patch) | |
tree | cc5ed1d0a14e9cfb10d28e6903e7619c94f8e959 | |
parent | d895259eee46eb2a41747bfc554dc9597f3597e0 (diff) |
Fix jobs status methods for new LAVA API
* Since LAVA v2018.2 the `SchedulerAPI` method `job_status` has been
deprecated. It was removed completely in LAVA v2020.02.
* Now, it is recommended to use the methods `job_state` or
`job_health`.
* This commits introduces a fix, so that the new method `job_state`
is used instead of the (removed) `job_status` method.
Signed-off-by: Sietze van Buuren <Sietze.vanBuuren@de.bosch.com>
-rw-r--r-- | lqa_api/connection.py | 5 | ||||
-rw-r--r-- | lqa_api/job.py | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lqa_api/connection.py b/lqa_api/connection.py index dcfd871..a6b344f 100644 --- a/lqa_api/connection.py +++ b/lqa_api/connection.py @@ -93,7 +93,10 @@ class Connection(object): return self._conn.scheduler.job_output(job_id, offset).data def job_status(self, job_id): - return self._conn.scheduler.job_status(job_id) + try: + return self._conn.scheduler.job_state(job_id) + except AttributeError: + return self._conn.scheduler.job_status(job_id) def get_device_status(self, hostname): return self._conn.scheduler.get_device_status(hostname) diff --git a/lqa_api/job.py b/lqa_api/job.py index 72a03c7..0d69dcb 100644 --- a/lqa_api/job.py +++ b/lqa_api/job.py @@ -163,7 +163,10 @@ class Job(object): @property def status(self): self._fetch_job_status() - return self._status.get('job_status', None) + try: + return self._status['job_state'] + except KeyError: + return self._status.get('job_status', None) @property def test_runs(self): |