Introduction
This guide assumes that you already authenticated and defined the project ID as variable PROJ
and the project token as variable PTOKEN
. For more information, please refer to Authentication.
View job information
View all jobs
Display the details of all the jobs from this project:
curl -s GET -H "Authorization: Bearer $PTOKEN" \
https://api.up42.com/projects/$PROJ/jobs/ | jq '.'
Display all the job IDs and their status from this project (test queries and real jobs):
curl -s GET -H "Authorization: Bearer $PTOKEN" \
https://api.up42.com/projects/$PROJ/jobs | jq -r '.data[] | .id,.status'
View job details
Display the details of one specific job.
JOB_ID=023694d4-1b52-46e8-a9a0-05c9ee23f15c
curl -L -s https://api.up42.com/projects/$PROJ/jobs/$JOB_ID \
-H "Authorization: Bearer $PTOKEN" -H 'Content-Type: application/json' | jq -r '.'
View job status
Display the status of one specific job.
JOB_ID=023694d4-1b52-46e8-a9a0-05c9ee23f15c
curl -L -s https://api.up42.com/projects/$PROJ/jobs/$JOB_ID \
-H "Authorization: Bearer $PTOKEN" -H 'Content-Type: application/json' \
| jq -r '.data.status'
View job tasks
Display the job tasks and save them in a separate file (job_tasks.json
).
JOB_ID=023694d4-1b52-46e8-a9a0-05c9ee23f15c
curl -s GET -H "Authorization: Bearer $PTOKEN" \
https://api.up42.com/projects/$PROJ/jobs/$JOB_ID/tasks \
| jq '.' > job_tasks.json
Extract the corresponding task IDs and save them in a new file (task_ids.json
).
cat job_tasks.json | jq -r '.data[] | .id' | uniq > task_ids.json
Update jobs
Rename job
Change the name of a previously run job and save the response in a new file (renamed_job_response.json
):
JOB_ID=63544e6a-0833-4f63-8739-9a822be7cb73
WORKFLOW=b7fe8da8-d9fb-4631-835e-88e4d4d2fa58
URL_RENAMED_JOB="https://api.up42.com/projects/$PROJ/workflows/$WORKFLOW/jobs/$JOB_ID"
curl -s -L -X PUT -H "Authorization: Bearer $PTOKEN" \
-H 'Content-Type: application/json' -d '{"name": "My recently renamed job"}' \
$URL_RENAMED_JOB | jq '.' > renamed_job_response.json
Re-run job
Run again a previously run job and save the response in a new file (rerun_job_response.json
):
JOB_ID=63544e6a-0833-4f63-8739-9a822be7cb73
WORKFLOW=b7fe8da8-d9fb-4631-835e-88e4d4d2fa58
URL_RERUN_JOB="https://api.up42.com/projects/$PROJ/workflows/$WORKFLOW/jobs/$JOB_ID?name=Rerun+my+job"
curl -s -L -X POST -H "Authorization: Bearer $PTOKEN" \
$URL_RERUN_JOB | jq '.' > rerun_job_response.json
Cancel job
Cancel a running job and save the response in a new file (cancel_job_response.json
):
JOB_ID=c4c5d591-d20a-4202-8116-a7585e388f32
URL_CANCEL_JOB="https://api.up42.com/projects/$PROJ/jobs/$JOB_ID/cancel"
curl -s -L -X POST -H "Authorization: Bearer $PTOKEN" $URL_CANCEL_JOB \
| jq '.' > cancel_job_response.json
Make sure that the job has been cancelled and no further credits will be consumed:
curl -s GET -H "Authorization: Bearer $PTOKEN" https://api.up42.com/projects/$PROJ/jobs/$JOB_ID | jq '.data.status'
Troubleshooting
Get log message (task)
The log messages are very useful to investigate and troubleshoot errors during job runs. Currently, the logs can only be viewed per job task. To display the log message of one job task, first define the job and task ID variables. Download the log message and save it in a text file (Task_Log.txt
):
JOB_ID=023694d4-1b52-46e8-a9a0-05c9ee23f15c
TASK_ID=299f950b-da2f-45f0-b0a7-a7898d449c75
curl -s GET -H "Authorization: Bearer $PTOKEN" \
https://api.up42.com/projects/$PROJ/jobs/$JOB_ID/tasks/$TASK_ID/logs > Task_Log.txt
Get log messages (job)
Use the file that you saved in the previous step to display the logs of all job tasks and save them in separate text files:
while read -r taskId; do curl -s GET -H "Authorization: Bearer $PTOKEN" \
https://api.up42.com/projects/$PROJ/jobs/$JOB_ID/tasks/$taskId/logs \
> task_log_$taskId.txt; done < task_ids.json