Skip to content

Job REST API

Chris Churas edited this page May 7, 2015 · 27 revisions
Call Example URL
Creates a Job /rest/jobs
Partial Update a Job /rest/jobs/12345?status=Error
Update a Job /rest/jobs/12345
Get a Job /rest/jobs/1234
Get a list of Jobs /rest/jobs
Delete a Job /rest/jobs/1234

Create a Job

Creates a Job which is an invocation of a Workflow.

Method: POST
Path: /rest/jobs
Content-Type: application/json
Content:

Content needs to be a Job in Json format. See Example Job Json for the minimum fields required to create a Job.

NOTE The owner field should be set to the value of runasuser, who is the person logged into the portal or workflow service.

Return: Json representation of Job with id set Example return
Error: Returns 500 Internal Service Error

Example CURL call:

curl -X POST -H "Content-Type: application/json" \
-d '{
  "name" : "some job",
  "owner" : "someuser",
  "parameters" : [ {
    "name" : "param1",
    "value" : "some value"
  } ],
  "workflow" : {
    "id" : 10,
  }
}' \ 
https://crbsworkflow.appspot.com/rest/jobs

Partial Update a Job

Updates a Job using Query Parameters attached to end of URL.

Method: POST
Path: /rest/jobs/<JOB ID>?status=[]&estcpu=[]&estruntime=[]&estdisk=[]&submitdate=[]&startdate=[]&finishdate=[]&submittedtosched=[]&jobid=[]&deleted=[]&error=[]&detailederror=[]
Content-Type: application/json
Content:

Just pass {} since the id of the Job is passed in the URL.

Query Parameters:
  • status Sets status of Job
  • estcpu Sets estimated CPU in seconds needed to complete this Job
  • estruntime Sets estimated walltime of Job in seconds
  • estdisk Sets estimated disk that will be consumed in bytes
  • submitdate Sets Job submit date. Should be milliseconds since Epoch
  • startdate Sets Job start date. Should be milliseconds since Epoch
  • finishdate Sets Job Finish date. Should be milliseconds since Epoch
  • submittedtosched Set to true if Job has been submitted to cluster or false if not.
  • jobid Sets the cluster job id
  • downloadurl
  • deleted Sets deletion value of Job. true for deleted false if not.
  • error Sets error for Job
  • detailederror Sets detailed error for Job.
Return: Json representation of Job with changes Example return
Error: Returns 500 Internal Service Error

Example CURL call:

curl -X POST -H "Content-Type: application/json" \
-d '{}' \ 
https://crbsworkflow.appspot.com/rest/jobs/123234?status=Error&estcpu=123&estruntime=4444&estdisk=234234&submitdate=1400201297000&startdate=1400201297000&finishdate=1400201297000&submittedtosched=true&jobid=34545

Update a Job

Updates a Job with Json representation set in content of call. WARNING this method performs no checks and will completely replace the Job with the Json contents.

Method: PUT
Path: /rest/jobs/<JOB ID>
Content-Type: application/json
Content:

Should contain JSON representation of Job. NOTE: The job id in the Json will be ignored and replaced with value of set in URL.

Query Parameters:
Return: Json representation of Job with changes Example return
Error: Returns 500 Internal Service Error

Example CURL call:

curl -X POST -H "Content-Type: application/json" \
-d '{<JSON REPRESENTATION OF JOB>}' \ 
https://crbsworkflow.appspot.com/rest/jobs/123234

Get a Job

Obtains a single Job in Json format by id

The output of this method is affected by the permissions of the account used for authentication. If the account is authorized to see all jobs then call will return the job associated with id regardless of owner. If the account only is authorized to see their jobs then the job will only be returned if the owner of the job matches the account. If there is no match then no job will be returned.

Method: GET
Path: /rest/jobs/<JOB ID>
Content-Type: application/json
Return: Json representation of Job Example return
Error: Returns 500 Internal Service Error

Example CURL call:

curl -X GET \ 
https://crbsworkflow.appspot.com/rest/jobs/1

Get a list of Jobs

Obtains a list of Jobs in Json format. The list can be filtered by parameters added to the URL.

The output of this method is affected by the permissions of the account used for authentication. If the account is authorized to see all jobs then all parameters below are valid. If the account only is authorized to see their jobs then the owner query parameter must be omitted or set to the same value as the account login or to a user they are allowed to run as. Any request that attempts to retrieve data they don't have permission for will result in an error.

Method: GET
Path: /rest/jobs/<JOB ID>?status=[]&owner=[]&noparams=[]&noworkflowparams=[]&notsubmittedtoscheduler=[]&showdeleted=
Content-Type: application/json
Query Parameters:
  • status Only return jobs matching status
  • owner Only return jobs matching owner
  • noparams If set to true omit Parameters for Job
  • noworkflowparams If set to true omit Parameters in Workflow
  • notsubmittedtoscheduler If set to true return Jobs that have NOT been submitted to cluster for processing
  • showdeleted If set to true then all Workflows including those who have been deleted logically will be displayed. If set to false or omitted then only Workflows that have NOT been logically deleted will be displayed
Return: Json representation of Job Example return
Error: Returns 500 Internal Service Error

Example CURL call:

curl -X GET \ 
https://crbsworkflow.appspot.com/rest/jobs/1?status=Running&owner=bob&noparams=true&noworkflowparams=true&notsubmittedtoscheduler=true

Delete a Job

Deletes a Job. A Job can only be deleted if its output WorkspaceFile is NOT being used as input for any other Jobs. By default the delete is a logical delete. This job will return the status in Json format.

Method: DELETE
Path: /rest/jobs/<JOB ID>?permanentlydelete=[]
Content-Type: application/json
Content:

Just pass {} since the id of the Job is passed in the URL.

Query Parameters:
  • permanentlydelete If set to true then the Job will be physically deleted instead of just logically deleted which is the case if set to false or omitted.
Return: Json denoting success or failure of deletion Example return
Error: Returns 500 Internal Service Error

Example CURL call:

curl -X DELETE -H "Content-Type: application/json" \ 
https://crbsworkflow.appspot.com/rest/jobs/123234
Clone this wiki locally