You can submit a job by making a POST request to the Task API's endpoint.
Using curl:
export TASK_API_ENDPOINT=<TASK_API_ENDPOINT> # e.g. export TASK_API_ENDPOINT=https://***.elb.us-west-2.amazonaws.com/train-iris
export DEST_S3_DIR=<YOUR_S3_DIRECTORY># e.g. export DEST_S3_DIR=s3://my-bucket/dircurl $TASK_API_ENDPOINT \-XPOST-H"Content-Type: application/json" \-d"{\"config\": {\"dest_s3_dir\": \"$DEST_S3_DIR\"}}"# > {"job_id":"69b183ed6bdf3e9b","api_name":"train-iris",...}
Or, using Python requests:
import corteximport requestscx = cortex.client("aws")# "aws" is the name of the Cortex environment used in this exampletask_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
cortexgettrain-iris69b183ed6bdf3e9b
View the results
Once the job is complete, you should be able to find the trained model in the directory you've specified.