nodet / dowml

A library and command line client to use Decision Optimization on IBM Watson Machine Learning (WML). NOT SUPPORTED BY IBM.
Apache License 2.0
3 stars 0 forks source link

Wait for Space to be ready after creation #39

Closed nodet closed 2 years ago

nodet commented 2 years ago

When the space is created, the following message is printed:

Space has been created. However some background setup activities might still be on-going. 
Check for 'status' field in the response. It has to show 'active' before space can be used. If 
its not 'active', you can monitor the state with a call to spaces.get_details(space_id)

As it happens that the first command after the space creation fails, we should probably indeed wait:

dowml> solve ../examples/afiro.mps
    deployment_id = self._get_deployment_id()
  File "/home/runner/work/dowml/dowml/src/dowml/dowmllib.py", line 1069, in _get_deployment_id
    deployment_id = self._create_deployment(deployment_name)
  File "/home/runner/work/dowml/dowml/src/dowml/dowmllib.py", line 1074, in _create_deployment
    model_id = self._get_model_id()
  File "/home/runner/work/dowml/dowml/src/dowml/dowmllib.py", line 1094, in _get_model_id
    details = client.repository.get_details()
  File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/ibm_watson_machine_learning/repository.py", line 1034, in get_details
    model_details = self._client._models.get_details()
  File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/ibm_watson_machine_learning/models.py", line 1946, in get_details
    return self._get_artifact_details(url, model_uid, limit, 'models', _async=asynchronous, _all=get_all)
  File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/ibm_watson_machine_learning/wml_resource.py", line 173, in _get_artifact_details
    return self._get_with_or_without_limit(
  File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/ibm_watson_machine_learning/wml_resource.py", line 271, in _get_with_or_without_limit
    result = self._handle_response(200, op_name, response_get)
  File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/ibm_watson_machine_learning/wml_resource.py", line 73, in _handle_response
    raise ApiRequestFailure(u'Failure during {}.'.format(operationName), response)
ibm_watson_machine_learning.wml_client_error.ApiRequestFailure: Failure during models. (GET ***/ml/v4/models?version=2021-06-24&space_id=2094f226-a8d4-4b5c-a363-17e8911f8de1&limit=200)
Status code: 404, body: {
  "trace": "cad96240fff4421f31c74b83b91471d7",
  "errors": [{
    "code": "downstream_error_cams",
    "message": "The requested asset does not exist in the downstream service",
    "more_info": "https://cloud.ibm.com/apidocs/machine-learning"
  }, {
    "code": "does_not_exist",
    "message": "CATSV5025E: Unable to find Catalog for space '2094f226-a8d4-4b5c-a363-17e8911f8de1'"
  }],
  "status_code": "404"
}
make: *** [Makefile:32: fulltests] Error 1
Error: Process completed with exit code 2.
nodet commented 2 years ago

This gave the following log:

2021-11-02 09:28:37,055 This space doesn't exist yet. Creating it...
2021-11-02 09:28:38,882 Space created, with state=preparing.
2021-11-02 09:28:38,882 Space id: 06ac2040-9a8a-42a7-9f82-f63d730e74c8
nodet commented 2 years ago

And now we get:

2021-11-02 10:08:52,070 This space doesn't exist yet. Creating it...
2021-11-02 10:09:25,373 Space created, with state=active.
2021-11-02 10:09:25,373 Space id: 88fef3e9-fca9-4167-a85c-981987438b61

I will assume that this fixes the issue, until proven otherwise.