import cortex
import requests
cx = cortex.client("aws") # "aws" is the name of the Cortex environment used in this example
task_endpoint = cx.get_api("train-iris")["endpoint"]
dest_s3_dir = # S3 directory where the model will be uploaded, e.g. "s3://my-bucket/dir"
job_spec = {
"config": {
"dest_s3_dir": dest_s3_dir
}
}
response = requests.post(task_endpoint, json=job_spec)
print(response.text)
# > {"job_id":"69b183ed6bdf3e9b","api_name":"train-iris",...}
Monitor the job
$ cortex get train-iris 69b183ed6bdf3e9b
View the results
Once the job is complete, you should be able to find the trained model in the directory you've specified.