Bug fix when downloading processed files.

Thu, 06 May 2021 17:29:49 +0300

author
ioannis@ioannis-VirtualBox
date
Thu, 06 May 2021 17:29:49 +0300
changeset 62
33a1ebad3f7e
parent 61
c4e03940780a
child 63
a41f71f80c1d

Bug fix when downloading processed files.

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	Mon Apr 26 12:15:02 2021 +0300
+++ b/CHANGELOG.rst	Thu May 06 17:29:49 2021 +0300
@@ -1,5 +1,8 @@
 Changelog
 =========
+0.10.3 - 2021-05-06
+-------------------
+* Fixed bug when downloading measurement files.
 
 0.10.1 - 2021-02-09
 -------------------
@@ -7,7 +10,7 @@
 
 0.10.0 - 2021-02-04
 -------------------
-* Support for new version of web interface (to be released on 2021-02-09.
+* Support for new version of web interface (to be released on 2021-02-09).
 * Output of module exit codes and their description.
 * Support of the "delay" parameter when uploading files.
 
--- a/scc_access/__init__.py	Mon Apr 26 12:15:02 2021 +0300
+++ b/scc_access/__init__.py	Thu May 06 17:29:49 2021 +0300
@@ -1,1 +1,1 @@
-__version__ = "0.10.2"
\ No newline at end of file
+__version__ = "0.10.3"
\ No newline at end of file
--- a/scc_access/scc_access.py	Mon Apr 26 12:15:02 2021 +0300
+++ b/scc_access/scc_access.py	Thu May 06 17:29:49 2021 +0300
@@ -378,6 +378,7 @@
         # try to wait for measurement to appear in API
         measurement = None
         logger.info("Looking for measurement %s on the SCC.", measurement_id)
+
         while attempts_count < max_attempts:
             attempts_count += 1
             measurement, status = self.get_measurement(measurement_id)
@@ -388,8 +389,9 @@
                     time.sleep(time_sleep)
             else:
                 break
+        print("Measurement: {}".format(measurement))
 
-        if attempts_count == max_attempts:
+        if measurement is None:
             logger.error("Measurement %s doesn't seem to exist.", measurement_id)
             if exit_if_missing:
                 sys.exit(1)
@@ -397,37 +399,35 @@
                 return measurement
 
         logger.info('Measurement %s found.', measurement_id)
+        while not measurement.has_finished:
+            measurement.log_processing_status()
+            time.sleep(10)
+            measurement, status = self.get_measurement(measurement_id)
 
-        if measurement is not None:
-            while not measurement.has_finished:
-                measurement.log_processing_status()
-                time.sleep(10)
-                measurement, status = self.get_measurement(measurement_id)
-
-            logger.info("Measurement processing finished.")
-            measurement.log_detailed_status()
+        logger.info("Measurement processing finished.")
+        measurement.log_detailed_status()
 
-            if measurement.hirelpp == 127:
-                logger.info("Downloading HiRElPP files.")
-                self.download_hirelpp(measurement_id)
-            if measurement.cloudmask == 127:
-                logger.info("Downloading cloud screening files.")
-                self.download_cloudmask(measurement_id)
-            if measurement.elpp == 127:
-                logger.info("Downloading ElPP files.")
-                self.download_elpp(measurement_id)
-            if measurement.elda == 127:
-                logger.info("Downloading ELDA files.")
-                self.download_elda(measurement_id)
-                logger.info("Downloading ELDA plots.")
-                self.download_plots(measurement_id)
-            if measurement.elic == 127:
-                logger.info("Downloading ELIC files.")
-                self.download_elic(measurement_id)
-            if measurement.is_calibration and measurement.eldec==0:
-                logger.info("Downloading ELDEC files.")
-                self.download_eldec(measurement_id)
-            logger.info("--- Processing finished. ---")
+        if measurement.hirelpp == 127:
+            logger.info("Downloading HiRElPP files.")
+            self.download_hirelpp(measurement_id)
+        if measurement.cloudmask == 127:
+            logger.info("Downloading cloud screening files.")
+            self.download_cloudmask(measurement_id)
+        if measurement.elpp == 127:
+            logger.info("Downloading ElPP files.")
+            self.download_elpp(measurement_id)
+        if measurement.elda == 127:
+            logger.info("Downloading ELDA files.")
+            self.download_elda(measurement_id)
+            logger.info("Downloading ELDA plots.")
+            self.download_plots(measurement_id)
+        if measurement.elic == 127:
+            logger.info("Downloading ELIC files.")
+            self.download_elic(measurement_id)
+        if measurement.is_calibration and measurement.eldec==0:
+            logger.info("Downloading ELDEC files.")
+            self.download_eldec(measurement_id)
+        logger.info("--- Processing finished. ---")
 
         return measurement
 

mercurial