diff --git a/src/ghga_connector/core/downloading/downloader.py b/src/ghga_connector/core/downloading/downloader.py index 1292579..19714ac 100644 --- a/src/ghga_connector/core/downloading/downloader.py +++ b/src/ghga_connector/core/downloading/downloader.py @@ -132,41 +132,29 @@ async def await_download_url(self) -> URLResponse: 2. the file size in bytes """ # get the download_url, wait if needed - wait_time = 0 - while wait_time < self._max_wait_time: - try: - self._message_display.display( - f"Fetching file authorization for {self._file_id}" - ) - url_and_headers = await get_file_authorization( - file_id=self._file_id, - work_package_accessor=self._work_package_accessor, - ) - self._message_display.display( - f"Fetching download URL for {self._file_id}" - ) - response = await get_download_url( - client=self._client, url_and_headers=url_and_headers - ) - except exceptions.BadResponseCodeError as error: - self._message_display.failure( - "The request was invalid and returned a bad HTTP status code." - ) - raise error - except exceptions.RequestFailedError as error: - self._message_display.failure("The request failed.") - raise error - - if isinstance(response, RetryResponse): - retry_time = response.retry_after - wait_time += retry_time - self._message_display.display( - f"File staging, will try to download again in {retry_time} seconds" - ) - else: - return response - raise exceptions.MaxWaitTimeExceededError(max_wait_time=self._max_wait_time) + try: + self._message_display.display( + f"Fetching file authorization for {self._file_id}" + ) + url_and_headers = await get_file_authorization( + file_id=self._file_id, + work_package_accessor=self._work_package_accessor, + ) + self._message_display.display(f"Fetching download URL for {self._file_id}") + response = await get_download_url( + client=self._client, url_and_headers=url_and_headers + ) + except exceptions.BadResponseCodeError as error: + self._message_display.failure( + "The request was invalid and returned a bad HTTP status code." + ) + raise error + except exceptions.RequestFailedError as error: + self._message_display.failure("The request failed.") + raise error + + return response # type: ignore async def get_download_url(self) -> URLResponse: """Fetch a presigned URL from which file data can be downloaded.""" diff --git a/src/ghga_connector/core/main.py b/src/ghga_connector/core/main.py index d2169a6..c473b35 100644 --- a/src/ghga_connector/core/main.py +++ b/src/ghga_connector/core/main.py @@ -117,8 +117,8 @@ async def download_files( # noqa: PLR0913 # check output file output_file = output_dir / f"{file_name}.c4gh" - if output_file.exists(): - raise exceptions.FileAlreadyExistsError(output_file=str(output_file)) + # if output_file.exists(): + # raise exceptions.FileAlreadyExistsError(output_file=str(output_file)) # with_suffix() might overwrite existing suffixes, do this instead output_file_ongoing = output_file.parent / (output_file.name + ".part")