Deploying a model to Cloudera AI Gateway and Inference using the API
You can select a specific Cloudera AI Gateway and Inference instance and a model version from Cloudera AI Registry to deploy a new model.
-
Retrieve a registered model's model ID and model
version.
This information is available in the Model Hub section of the Anywhere Cloud Console, in the Models section.
You can also list the registered models with the API. Send a
GETrequest to https://${DOMAIN}/api/v1/registries/default/models, or to https://${DOMAIN}/api/v1/registries/default/models/[***MODEL_ID***] to see the versions of one model. -
Create the model specification for the selected model.
# cat ./examples/mlflow/model-spec-cml-registry.jsonThe following is an example output:
{ "namespace": "serving-default", "name": "mlflow-wine-test-from-registry-onnx", "spec": { "source": { "registrySource": { "modelId": "3azn-tmqe-wsze-5u4s", "version": 2 } } } }export DOMAIN=$(cdp ml describe-ml-serving-app --app-crn [***app-crn***] | jq -r '.app.cluster.domainName')Cloudera AI Inference service on Anywhere Cloud deploys models only from the Cloudera AI Registry of the same cluster. Leave the registryId field unset.
-
Create the Model Deployment by using the following Cloudera AI Gateway and Inference
OST /api/v1/deployments request:curl -v -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${AWC_TOKEN}" "https://${DOMAIN}/api/v1/deployments" -d @./examples/mlflow/model-spec-cml-registry.jsonThe
DOMAINlooks likeml-67814ad5-b79.eng-ml-d.xcu2-8y8x.dev.cldr.work.You can retrieve the
AWC_TOKENby performing the steps from Preparing to interact with the Cloudera AI. -
The response includes the new deployment, its ID, and a list of warnings.
Save the deployment ID, as it is required for subsequent API calls that reference the deployment.
Deployment creation is asynchronous. The deployment state transitions from
DEPLOYMENT_STATE_INITIALIZINGtoDEPLOYMENT_STATE_RUNNING. You can monitor the status by using the describe API call.
