Version/Environment (if relevant):
This applies to all versions of Domino.
Issue:
You need a guide on creating your first Model API.
Resolution:
Use this step-by-step guide along with:
- Host Models as REST APIs
- Model APIs section of the Publishing in Domino course in Domino University:
Steps:
1) Confirm that you have either the model.py or model.R file that’s included in the quick-start project’s Domino File System (DFS):
2) In this guide, we’ll use the model.py file. Note the my_model
function in the code, which you’ll use this later to invoke your model:
3) There are three ways to create a Model API:
A) From your Project > Overview > Publish a Model as an API section > Publish Model
B) From your Project > Model APIs > Create Model API:
C) From the blue left-side navigation, choose Model APIs > Create Model API:
4) Step 1 of 2:
Enter the model name and description. Select your project from the dropdown.
5) Step 2 of 2:
Under The file containing the code to invoke: Select model.py from the dropdown
Under The function to invoke: type in my_model
Click on Create Model
You have options to: exclude files, choose a different environment, set a resource quota, choose the request type, and to log HTTP requests and responses to the model instance logs.
Optional checkbox: "Log HTTP requests and responses to model instance logs”
6) Click over to the Versions tab. The Image Building status will be Preparing to build:
7) Click on View Build Logs to view the build’s progress.
8) Under the Version column, click on the Version number to view the details. Under the 3-dot menu on the right, you have the option to cancel the version or open it in a workspace.
The version’s status will start out in Pending and will proceed to Running after the Build logs show that it’s complete. The details page includes the Model Source information: project, filename, model function used to invoke the model, and the environment.
9) Once in the Running state, you can test your code. Go to the Overview tab > Tester tab > Send.
Use the Request window to make calls to the Model API from the Domino web application. You'll find additional tabs next to Tester with example code to call the Model API with other tools and in various programming languages.
10) Troubleshooting: Check the Model API logs when your Model API fails. Check the Logs column for a specific Model API version to view and download these logs:
- Build Logs to review everything that happened to build the image. See the build definition loaded and the metadata needed to complete the build.
- Export Logs to review the export details of the Model API.
- Instance Logs to review logs related to individual containers for the selected Model API instance. View all Model APIs and all containers or filter the information by Model API and container.
- Deployment Logs to see a chronological order of events related to the deployment. These events include heartbeats, Jobs, deployments, and Kubernetes events. Inspect payloads that contain pod and status information. Container status information identifies where images are in the deployment and indicates their state.
Comments
0 comments
Please sign in to leave a comment.