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 downloads no data available #27

Merged
merged 2 commits into from
Nov 8, 2021

Conversation

cpaulik
Copy link
Collaborator

@cpaulik cpaulik commented Nov 1, 2021

Fixes #26

If the CDS API does not have any data available we catch this with the error
callback. Only the string Reason: Request returned no data is available to
catch this. If the CDS package would ever change their error messages this would
break.

As a return code the python errno.ENODATA is used if no data is present. I've
not been able to find more widely used default error codes so I would argue that
also just using -10 by convention would be ok instead.

Other changes

I've also removed the usage of the * import in this MR.

@cpaulik cpaulik requested a review from wpreimes November 1, 2021 17:11
…eanly

If the CDS API does not have any data available we catch this with the error
callback. Only the string `Reason: Request returned no data` is available to
catch this. If the CDS package would ever change their error messages this would
break.

As a return code the python errno.ENODATA is used if no data is present. I've
not been able to find more widely used default error codes so I would argue that
also just using `-10` by convention would be ok instead.
@cpaulik cpaulik force-pushed the handle-downloads-no-data-available branch from 184813f to b1870ad Compare November 2, 2021 13:51
@wpreimes
Copy link
Member

wpreimes commented Nov 7, 2021

Looks good. I think we should optimize the download function here for integration into task schedulers, towards automated data updates. And providing more feedback on a data request is a good start. I don't know how the CDS API will develop, maybe the wrapper here will be obsolete at some point...
I think error code 62 is fine. A test to make sure that the return string doesn't change would be good. But I can add that one when I fix the CI.

@wpreimes wpreimes merged commit 587fc1e into master Nov 8, 2021
@cpaulik
Copy link
Collaborator Author

cpaulik commented Nov 8, 2021

Thanks.

Do you have any other things planned for this package in the short term? If not then it would be great if we could tag a new version.

@wpreimes
Copy link
Member

wpreimes commented Nov 8, 2021

I will add the pipelines to test and release the package and then draft a new version in the next days, is that ok?

@cpaulik
Copy link
Collaborator Author

cpaulik commented Nov 8, 2021

Sure, let me know if you need any help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle requests that fail because no data is available yet
2 participants