Temporary workaround for missing "has_finished" flag from the API. 0.10.1

Tue, 09 Feb 2021 17:12:25 +0200

author
ioannis@ioannis-VirtualBox
date
Tue, 09 Feb 2021 17:12:25 +0200
changeset 57
8d487e4e20ae
parent 56
c9df25012168
child 58
77e16041ad00

Temporary workaround for missing "has_finished" flag from the API.

CHANGELOG.rst file | annotate | diff | comparison | revisions
scc_access/__init__.py file | annotate | diff | comparison | revisions
scc_access/scc_access.py file | annotate | diff | comparison | revisions
--- a/CHANGELOG.rst	Tue Feb 09 09:41:52 2021 +0200
+++ b/CHANGELOG.rst	Tue Feb 09 17:12:25 2021 +0200
@@ -1,6 +1,10 @@
 Changelog
 =========
 
+0.10.1 - 2021-02-09
+------------------
+* Temporary workaround for missing "has_finished" flag from the API.
+
 0.10.0 - 2021-02-04
 ------------------
 * Support for new version of web interface (to be released on 2021-02-09.
--- a/scc_access/__init__.py	Tue Feb 09 09:41:52 2021 +0200
+++ b/scc_access/__init__.py	Tue Feb 09 17:12:25 2021 +0200
@@ -1,1 +1,1 @@
-__version__ = "0.10.0"
\ No newline at end of file
+__version__ = "0.10.1"
\ No newline at end of file
--- a/scc_access/scc_access.py	Tue Feb 09 09:41:52 2021 +0200
+++ b/scc_access/scc_access.py	Tue Feb 09 17:12:25 2021 +0200
@@ -395,7 +395,7 @@
         logger.info('Measurement %s found.', measurement_id)
 
         if measurement is not None:
-            while measurement.is_running:
+            while not measurement.has_finished:
                 measurement.log_processing_status()
                 time.sleep(10)
                 measurement, status = self.get_measurement(measurement_id)
@@ -695,6 +695,15 @@
 
         super().__init__(base_url, dict_response)
 
+    @property
+    def has_finished(self):
+        """ Temporary implementation for SCC version 5.2.0, until the API returns a flag indicating if the
+        processing measurement has finished. """
+        if (self.is_running is False) and (self.hirelpp != 0 or self.elpp != 0):
+            return True
+        else:
+            return False
+
     def log_processing_status(self):
         """ Log module status. """
         logger.info("Measurement is being processed. Status: {}, {}, {}, {}, {}, {}). Please wait.".format(

mercurial