Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle ENA API timeouts in upload-to-ena module #241

Open
Shettland opened this issue Nov 23, 2023 · 1 comment
Open

Handle ENA API timeouts in upload-to-ena module #241

Shettland opened this issue Nov 23, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@Shettland
Copy link
Member

When uploading multiple fastq files, ENA's API ussually throws a timeout that makes the process to crash. upload_to_ena currently handles it by dividing the total number of samples into batches of 20 samples (size arbitrarily selected) but sometimes a timeout is sill thrown anyways so some sort of retry should be implemented

@Shettland
Copy link
Member Author

Some sketch code that could work for this issue:

for file in file_list:
         if not self.upload_file_to_ena(file):
                for _ in range(n):
                    if self.upload_file_to_ena(file):
                        uploaded_files.append(file)
                        break
                else:
                    log.info("Unable to fetch %s from %s", file, folder)
                    failed_files.append(file)
return uploaded_files, failed_files

This code would try to upload, and if it fails, it would try again n times, breaking the loop if successful and printing an error message if it could not be uploaded

@Shettland Shettland added the bug Something isn't working label Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant