Back to JESS API

Cancel a Simulation Job

Use POST /job/<job_id> with a cancel command object to cancel an existing job.


Cancel Command

A Cancel Command Object has only one field, as shown in the example below:

    "cmd": "Cancel"

return object

A successful return object contains the status flag, a message, and the current status of the job, as shown in the example below.

  "ok" : true,
  "status" : "Cancel flag has been set for 12259",
  "data" : {
    "id" : 12255,
    "progress" : "20, 0, 0, 0, 16, 4, 0",
    "cancel_Flag" : true,
    "job_ID" : 12259,
    "status" : "QUEUED",
    "completion_Time" : 1608079500550,
    "status_Info" : "Job preparation done; awaiting execution.",
    "last_Update" : 1608079505339

At the time of return, the job has only been marked to be cancelled. It may take a couple of minutes before all of its simulation cases to be cancelled. You can check the status using the GET /job/status/<job_id> transaction. If the job is cancelled, you will see a return like below:

  "ok" : true,
  "status" : "12259 status available",
  "data" : {
    "id" : 12255,
    "progress" : "20, 0, 0, 12, 0, 8, 0",
    "cancel_Flag" : false,
    "job_ID" : 12259,
    "status" : "CANCELED",
    "completion_Time" : 1608079510027,
    "status_Info" : "Job is cancelled",
    "last_Update" : 1608079510027

Cancel Command Failed

If the specified job is not found, not controlled by the user, or not in a cancellable state, a Failed response will be received:

  "ok" : false,
  "status" : "Job 12250 is not found or not cancellable",
  "data" : null

Authorization Failed

An HTTP 401 - Unauthorized response will be received

Example using curl://

Assuming the session token has been saved in the cookies file using the log on command, send the cancel command using curl in Linux as below:

curl -b cookies -H 'Content-Type: application/json' -X POST -d '{"cmd": "Cancel"}'

On Windows:

curl -b cookies -H "Content-Type: application/json" -X POST -d "{\"cmd\": \"Cancel\"}"

Example using Python Requests

Make sure Requests is correctly installed in your Python environment, and run the following lines:

import requests

headers = {'Content-Type': 'application/json'}
body = {"cmd": "Cancel"}
job_id = 12250

# Make a post request. Session token must be available in the saved cookies during log-on
r ='' + str(job_id), headers=headers, json=body, cookies=cookies)

# Show return info