We already provide a working demo serving-template in the demo-team
folder. Feel free to use this as a template.
- We use Bruno as the API Client to communicate with SAP AI Core.
- You should have Python installed
- We provide a Bruno Collection and a partially preconfigured Bruno environment file for you to access AI Core
- You should have Docker installed.
- At least one person in your team should have a DockerHub account
- You will train your ML Models locally on your own machine
- Follow the guide in this README and in the following example repository: https://github.com/ironedr/hackathon-demo
- In Bruno, if you see text in 2 Curly Braces (e.g.
{{configuration_id}}
) do not change or delet it. This value will be filled out automatically when you execute a request.
- Import the bruno collection into Bruno.
- Click on the 3 dots
...
next to the Collection NameAI-Core_participants
and select settings - In the collection settings go the
Auth
Tab and selectBasic Auth
- For the username field enter the value
{{client_id}}
and use{{client_secret}}
for the password field - In the upper right corner where you see
No Environment
, click on the Dropdown box and selectaicore_hackathon
- Now click on the same dropdown again an select
Configure
. In here, Set the correct values for the fields client-id and client-secret in the hackathon bruno environment (if not already set) - Use the "Authenticate" POST request in the bruno collection
- There will be 2 GitHub repositories: a) the repository containing the ml source code that the team creates. b) our hackathon repository where they provide the serving-template for their own ml-service
- The teams should follow the guidelines in this repository: https://github.com/ironedr/hackathon-demo to create their own source-code repository and start development
- After writing their API and building a docker-image, each team should provide a serving-template by forking the following repository and creating a PR request: https://github.com/EkinTiras/hackathon/tree/main
In SAP AI Core, ML-Services that provide an API are called Deployments. The following steps are necessary to create a deployment for your ML-app:
- Prerequisites:
- The app-code is ready
- the docker image has been pushed to dockerhub
- the team's
serving-template.yaml
is correct and has been merged into this repository - the teams have configured their
resource_group_id
andapplication_name
in the bruno environment config - set the
scenario_id
value in your bruno environment (each team has defined this in their serving-template in the field:labels: scenarios.ai.sap.com/id: <scenario-id>
- set the value for the field
execution_id
in the bruno environment:metadata: name: <your-executable-id>
- set a configuration name for your team in the
config_name
field in the bruno environment - Select the
Create Configuration
request in your Bruno Collection- Configure environment variables (for example hyper parameters) that your service needs to run. (If you don't need any just set the name,
executableId
,scenarioId
andname
){ "name": "{{config_name}}", "executableId": "{{executable_id}}", "scenarioId": "{{scenario_id}}", "your_env_variable": "<provide_your_value>" }
- Configure environment variables (for example hyper parameters) that your service needs to run. (If you don't need any just set the name,
- Send request. The configuration will be created for you and a configurationId will be returned. We have a bruno script that automatically copies this value to the
configuration_id
field in your bruno environment - Create the deployment by sending the request. This is how your request body should look like:
{ "configurationId": "{{configuration_id}}" }
- The
deployment-id
is automatically stored in the bruno environment. - Check the state of your deployment by running the "Get information about specific deployment" request.
- (Optional) Debugging: use the
Get logs for specific deployment
request to search for clues in case of errors. - Do not create more than 1 deployment. If you need to create a new one, make sure to the delete the old one first
- Select the PATCH request to
Update the target status of a deployment
and in the body, set the targetStatus toSTOPPED
:{ "targetStatus": "STOPPED" }
- This operation will be scheduled but not executed immediately. Check the status of your deployment periodically with the
Get information about specific deploymen
request. Once thestatus
field is set toSTOPPED
continue with the next step. - Execute the "Mark deployment as deleted" request. Now you can go ahead and create a new deployment you want to.
- Specify the value for the
endpoint
field in your bruno environment (that's the endpoint your flask server is offering but do not include the/v2/
part e.g./v2/classify
becomesclassify
or/v2/predict
becomespredict
) - Select the
Send request to your deployment
request and configure the request body. The data you put here, is the one that your flask application expects. - Send the request