Creating New AMPs using API
You can create AMPs using API V2.
- Get the valid
runtime_identifierby using the GET request using filter parameters like kernel, editor, and edition.For example, if you want to create the AMP and it requires the following runtime based on project-metadata.yaml of the AMP, then use the filter like {"kernel":"Python 3.9","editor":"Workbench","edition":"Standard"} to get a smaller list of runtimes:curl -X GET "https://<workbenchURL>/api/v2/runtimes?search_filter=%7B%22kernel%22%3A%22Python%203.9%22%2C%22editor%22%3A%22Workbench%22%2C%22edition%22%3A%22Standard%22%7D" -H "accept: application/json" -H "Authorization: Bearer <API Token>"This command will display a list of runtimes that match the filter.
- Using the
runtime_identifierobtained in the previous step, you can create an AMP. Following is the sample payload used to trigger the creation of one of the AMPs. You can add additional key-value pairs as needed under the environment object based on the project-metadata.yaml file of the AMP you are trying to create.{ "configure_prototype_request": { "execute_amp_steps": true, "run_import_tasks": true, "runtime_identifier": "docker.repository.cloudera.com/cloudera/cdsw/ml-runtime-workbench-python3.9-standard:2024.05.2-b14" }, "create_project_request": { "description": "amps v2", "environment": { "HF_TOKEN": "<HF TOKEN>" }, "git_url": "https://github.com/cloudera/CML_AMP_Image_Analysis", "name": "amps_v2", "template": "git", "visibility": "private" } }Example: The following is an example of creating an AMP that requires multiple environment variables with IBM WatsonXAI.{ "configure_prototype_request": { "execute_amp_steps": true, "run_import_tasks": true, "runtime_identifier": "docker.repository.cloudera.com/cloudera/cdsw/ml-runtime-pbj-workbench-python3.9-standard:2024.10.1-b12" }, "create_project_request": { "description": "watson amps v2", "environment": { "IBM_WATSONXAI_ENDPOINT": "https://us-south.ml.cloud.ibm.com", "IBM_API_KEY": "<Put valid key>", "IBM_PROJECT_ID": "<Put valid project ID>" }, "git_url": "https://github.com/agupta-git/CML_AMP_watsonxai", "name": "watson_v2", "template": "git", "visibility": "private" } } - You can now see that a new project has been created in your Cloudera AI Workbench which is carrying out the tasks listed in its project-metadata.yaml file. After all the tasks are executed, your new AMP-project will be ready to use.
