- Deploy a model for synchronous inference (real-time).
- Deploy a model for asynchronous inference.
- Access Domino assets in a Domino endpoint image.
- Request predictions from a Domino endpoint.
- Retrain a model.
- See an example of an asynchronous inference application.
How deploy works
When you deploy a model as a Domino endpoint, Domino packages the project’s files as a Flask application. By default, Domino copies all project files into the endpoint image, including the compute environment, project files, a Flask/Plumber harness that exposes the HTTP interface, and an authentication and load balancing layer. A Domino endpoint is an HTTP API endpoint wrapped around your inference code. You supply the arguments to your inference code as parameters in the HTTP request payload, and the response from the endpoint includes the prediction. When a Domino Endpoint is published, Domino runs the script that contains the function. As the process waits for input, any objects or functions from the script remain in memory. Each request sent to the endpoint runs the function. Since the script is only sourced at publish time, expensive initialization processes occur only once rather than on each request.Synchronous vs asynchronous
Decide if your model needs to be made available as a synchronous or asynchronous Domino endpoint. Synchronous inferenceDeploy the model so it can receive an HTTP request, make a prediction, and return results synchronously with low latency. This is useful for interactive applications where predictions must be made synchronously. Asynchronous inference
Deploy the model so it can process and make predictions asynchronously for computationally intensive workloads. The asynchronous HTTP interface polls for results after a request is queued. After completion, the endpoint returns the result as a response to the polling request. Domino limits the size of the request and response packets to 10 KB, so users are expected to send and receive the payloads by reference. After Domino picks up the processing request, it keeps the request alive for 30 minutes. Predictions are written to an external data store that you define.
Package Requirements
- Python
- R
To support the Flask harness that exposes a model written in Python, the following packages are required in your endpoint image:
- uWSGI
- Flask
- Six
- Prometheus-client
seldon-core package.When your model is registered with Domino’s Model Registry feature, the mlflow Python package will attempt to infer package requirements for your model and write them to a requirements.txt file. Domino will install these requirements during the build process. At the moment, no other requirements.txt files are installed when endpoint images are built.All of the required packages are pre-installed in all the flavors of Domino’s Compute Environment images, except the minimal image, which does not have seldon-core or mlflow.Deploy a model
Domino supports a few different methods for deploying a model as a Domino endpoint:- Deploy from the UI - For quick, one time deployments.
- Deploy with a scheduled job - Schedule a job and deploy a model from the job. Especially useful for keeping models trained on the latest data on a regular cadence.
- Deploy with the API - Use the Domino API to schedule jobs from other applications.
Deploy from the UI
Use the Domino UI to deploy your model directly from your browser.- In your project, go to Deployments > Endpoints > Create Domino Endpoint.
- Provide a name and description, and select the prediction code that executes when the model is called.
- (Optional) Select a custom compute environment to build the deployed model container.
-
(Optional) Configure scaling. The number of instances and compute resources attached to each instance. See Scale model deployments for more information.
You can also include a GPU if your administrator configured GPUs in your node pool.
- Under Request Type, select Sync for real-time predictions or Async for long-running predictions.
Update from a scheduled Job
You can use scheduled jobs to update an existing endpoint. This is especially useful for keeping models trained on the latest data. Select the Domino endpoint from the Update Domino Endpoint field when scheduling a job. This setting uses the state of the project’s files after the run to build and deploy a new version of an existing Domino endpoint. You can use automated deploy jobs to automatically keep your Domino endpoint up to date by using a training script in the job that trains on fresh data.Deploy with the Domino API
Use Domino’s APIs to programmatically build and deploy models. For more information, see Domino Platform API reference. Set theisAsync parameter to true in the API call to create an asynchronous inference endpoint.
Deploy Domino Endpoints on a remote data plane
Users may prefer to host their endpoints in a separate cluster or data plane than where the model was built, either for scalability or data proximity reasons. Domino facilitates this through its Create Endpoint feature, allowing models to be packaged and deployed close to where they’ll have the most impact. When deploying Model Endpoints to a remote data plane, select the hardware tier associated with the desired local or remote data plane from the Deployment Target list (previously resource quotas) in the New Model Endpoint form. Domino containerizes the model (MLflow or Project) as a Domino endpoint image, deploys it as an endpoint, and exposes a URL local to that remote cluster where a Nexus data plane has been deployed. Users can invoke it via the exposed URL and data movement is restricted to this remote data plane only. Limitations: Currently, Domino endpoints deployed to a remote data plane do not support asynchronous requests (described below) and integrated model monitoring.Access Domino artifacts from endpoint images
You can still access Domino artifacts from endpoint images. However, there are nuances to each artifact type. Learn how to use Domino artifacts from your endpoint image and keep them up to date.Domino endpoint environments
When you deploy a Domino endpoint, select the compute environment to include in the endpoint image. The environment bundles packages required by the inference script execution ahead of time.-
Domino endpoint hosts don’t read
requirements.txtfiles or execute commands defined in the pre-setup, post-setup, pre-run, or post-run scripts of your environment. If your project usesrequirements.txtor any setup scripts to install specific packages or repositories, add them to the Dockerfile instructions of your environment. - Your Domino endpoint doesn’t inherit environment variables set at the project level. However, you can set Domino endpoint-specific environment variables on the Domino endpoint settings page. This separation decouples the management of projects and deployed models. See Store Project credentials for more details.
-
Domino endpoints run using the
uidandgidof12574(thedominouser). A user with thisuidandgidmust exist in the selected environment for the Domino endpoint. See Create a Domino environment image for more details and instructions on how to use an existing image to create an environment. -
Domino endpoint image builds run using the
USERdirective last specified in theDockerfilefor the selected compute environment. Please ensure that the environment image sets the desired user for the Domino endpoint image build (e.g.USER rootif you want the Domino endpoint image build to run asroot).
Domino endpoint project files
Your Domino endpoint can access files from the project. Domino loads the project files onto the Domino endpoint host, similar to a Run or Workspace executor host, with a few important differences:- Domino adds project files to the image when you build a Domino endpoint. Starting or stopping the Domino endpoint won’t change the files on the model host. To update the model host files, you need to create a new version.
- Domino pulls Git repositories attached to projects when you build a Domino endpoint. Starting or stopping the Domino endpoint won’t change the files on the model host. To update the model host files, you need to create a new version.
-
The Domino endpoint host mounts project files at
/mnt/<username>/<project_name>. This location differs from the default location for Runs or Workspaces,/mnt/. You can use the Domino environment variableDOMINO_WORKING_DIRto reference the directory where your project is mounted. -
The Domino endpoint image excludes project files listed in the
.modelignorefile that are located in the project’s root directory. Excluded files are not mounted to the Domino endpoint host.
Add a Kubernetes volume to a synchronous Domino endpoint container
When you load inference data or write the response to an external volume, you can add Kubernetes volumes:- Select a Domino endpoint from the Endpoints page.
-
Go to Settings > Advanced > Add Volume.
Only hostPaths are supported.
-
Enter the values required.
- Name - Kubernetes volume name.
- Mount Path - mount point in the Domino endpoint container.
- path - the path of the Kubernetes host node that must be mounted in the Domino endpoint container, as configured by your administrator.
- Read Only? - the read/write permission of the mounted volume.
Request predictions
After you deploy the Domino endpoint, and its status changes to Running, try test inputs with the Tester tab in the Domino endpoint UI.JSON requests
Send your requests as JSON objects. Depending on how you wrote your prediction script, you need to format the JSON request as follows:-
If you use named parameters in your function definition, use a dictionary or parameter array in your JSON request. For example,
my_function(x, y, z), use{"data": {"x": 1, "y": 2, "z": 3}}or{"parameters": [1, 2, 3]}. -
If you use a dictionary in your function definition, use only a parameter array. For example,
my_function(dict)and your function then usesdict["x"],dict["y"]. Send the request:{"parameters": [{"x": 1, "y": 2, "z": 3}]}. -
In Python, you can also use kwargs to pass in a variable number of arguments. If you do this:
my_function(x, **kwargs)and your function then useskwargs["y"]andkwargs["z"], you can use a data dictionary to call your endpoint:{"data": {"x": 1, "y": 2, "z": 3}}.
| JSON Type | Python Type | R Type |
|---|---|---|
| dictionary | dictionary | named list |
| array | list | list |
| string | str | character |
| number (int) | int | integer |
| number (real) | float | numeric |
| true | True | TRUE |
| false | False | FALSE |
| null | None | N/A |
Synchronous requests
-
Request a prediction and retrieve the result: Pass the URL of the Domino Domino endpoint, authorization token, and input parameters. The response object contains the status, response headers, and result.
Asynchronous requests
- Domino cannot guarantee the processing order of predictions. The order in which predictions are handled can differ from the order of requests.
- The same prediction request may execute them more than once, so the prediction functions must be idempotent (not affected by repeated executions).
- Use model environment variables for secrets.
-
Request a prediction: Pass the URL of the Domino Domino endpoint, authorization token, and input parameters. Users typically pass a reference to the payload location for large payloads (>10 KB). A prediction identifier is returned for the user to poll for completion and retrieve the result.
-
Poll for completion / retrieve the results: Use the
prediction_idfrom the request to retrieve the result. The response includes one of the following statuses:SUCCEEDED,FAILED, orQUEUED. The results field contains the output from the predict function for a successful completion.
Retrain a model
Deploy a new versionAfter you retrain your model with new data or switch to a different machine learning algorithm, publish a new version of the Domino endpoint. To follow best practices, stop a previous version of the Domino endpoint and then deploy a new version.
Asynchronous example
This example shows a Python client application that creates a prediction request from an asynchronous Domino endpoint, polls periodically for completion, and retrieves the result.Use Spot instances for Domino Endpoints (PREVIEW)
We support serving Domino endpoints using cost-effective Spot instances. Select a hardware tier that uses node pools using Spot instances. If AWS interrupts a spot instance, endpoints deployed on that instance will be affected and either stop responding, if there are no remaining replicas of the endpoint on other AWS instances, or the remaining replicas still running on unaffected instances will experience an increased load and may have their performance degraded or also stop working, depending on the runtime characteristics of the model. If this happens, the remediation is to change the hardware tier of the endpoint to use a non-spot node pool until AWS spot instances of the requested type become available again.Next steps
- Monitor model endpoints: Track performance metrics, configure health checks, and access logs for troubleshooting.
- Access and security for Domino endpoints: Control access and add contributors to Domino endpoints.
- Scale and route Domino endpoints: Scale horizontally and vertically for optimal performance.
- Select Domino endpoint authorization mode: Authorize your Domino endpoint in unrestricted or restricted mode.
- Example of a Python client application that uses an asynchronous Domino endpoint.