Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Get request status #94

Closed
valpesendorfer opened this issue Oct 7, 2024 · 3 comments
Closed

Get request status #94

valpesendorfer opened this issue Oct 7, 2024 · 3 comments

Comments

@valpesendorfer
Copy link

Hello,

before migrating to the new CDS platform, it was possible to check a request's status through querying https://cds.climate.copernicus.eu/api/tasks/<id>. After migration, this URL route returns a 404 response.

Is there any possibility to check a requests status programmatically with the new CDS?

Thanks!

(This is related to the issue ecmwf/cdsapi#122 and the corresponding ECMWF forum post)

@malmans2
Copy link
Member

malmans2 commented Oct 7, 2024

Hi there,

This is supported in cads-api-client as follows:

from cads_api_client import ApiClient

client = ApiClient()
remote = client.get_remote(REQUEST_UID)
remote.status

Please note that at the moment cads-api-client is not considered stable, and the official package recommended by ECMWF is cdsapi.

@valpesendorfer
Copy link
Author

thanks @malmans2 for the quick response.

Is cads-api-client going to become stable and the eventual replacement for interacting with CDS? As far as I understand, the newer cdsapi is "wrapping" the cads-api-client LegacyApiClient - is there any chance the status could be surfaced through there to the cdsapi?

Thanks again

@malmans2
Copy link
Member

malmans2 commented Oct 7, 2024

Is cads-api-client going to become stable and the eventual replacement for interacting with CDS?

Unfortunately, I'm not the right person to address this question.

As far as I understand, the newer cdsapi is "wrapping" the cads-api-client LegacyApiClient - is there any chance the status could be surfaced through there to the cdsapi?

You are correct that there is a LegacyApiClient used to ensure backward compatibility with the cdsapi.Client methods. The reason you're unable to retrieve a job using the request ID is because you are manually instantiating the Result object.

If you’d like to continue using cdsapi exclusively, you can do the following:

cdsapi_client = cdsapi.Client(...)
remote = cdsapi_client.client.get_remote(REQUEST_UID)

where cdsapi_client.client is the cads_api_client.ApiClient used under the hood. However, please note that also this snippet is not guaranteed to be stable.

@malmans2 malmans2 closed this as completed Oct 7, 2024
Holmgren825 added a commit to Holmgren825/cdsapi_helper that referenced this issue Nov 15, 2024
The behaviour of the current `Client` is apparently unstable according
to ecmwf-projects/cads-api-client#94.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants