eodms-sgdot / py-eodms-rapi

EODMS RAPI Client is a Python3 package used to access the REST API service provided by the Earth Observation Data Management System (EODMS) from Natural Resources Canada.
Other
13 stars 4 forks source link

Feature request - maximum number of attempts for accessing the download #10

Closed mdkwant closed 2 years ago

mdkwant commented 2 years ago

Request to add feature to have a maximum number of attempts the download query will try to attempt to download. Where a timetout error is given when the maximum number of attempts is reached. Use case: We use this script operationally and sometimes server space is needed after say x ammount of time. We need to have the option to stop the script after x ammount of time is passed so other activities can be started.

in line 1389

def download(self, items, dest, wait=60.0, attempts=5):

and in line 1447 - 1455

` attempt = 1 complete_items = [] while len(unique_items) > len(complete_items) and attempt <= attempts: time.sleep(wait) attempt += 1

        # start, end = self._get_dateRange(unique_items)
        # orders = self.get_orders(dtstart=start, dtend=end)
        orders = self.get_orders()`

image

mdkwant commented 2 years ago

And including a log message when maximum number is reached:

Line 1457:

        if attempt > attempts:
            msg = "Maximum number of attempts reached"
            self._log_msg(msg)
            return []
keballantyne commented 2 years ago

Maximum attempts has been added when downloading images for v1.4.0