Delete Asynchronous Jobs Matching Filters

delete

/r-scripts/v2/jobs

Delete asynchronous jobs matching all supplied filters; at least one filter must be supplied.

Request

Query Parameters

There's no request body for this operation.

Back to Top

Response

Supported Media Types

200 Response

Jobs are deleted.
Body ()
Root Schema : JSONObject
Type: object
Show Source

400 Response

Invalid parameters specified.
Body ()
Root Schema : InvalidParameterValueException
Type: object
Show Source

401 Response

When the user doesn't have privileges to perform the action.
Body ()
Root Schema : UnauthorizedException
Type: object
Show Source

500 Response

Problem connecting to Broker, finding the job id or other unexpected error.
Body ()
Root Schema : ComputeContainerException
Type: object
Show Source
Back to Top

Examples

Use the asynchronous job deletion endpoint to delete jobs that match specified filters. The examples show deletion by status, comments pattern, and job age. Each request is independent. You can combine one or more filters for bulk job deletion.

The filters demonstrated are:

  • Jobs with cancelled status
  • Jobs whose comments match a pattern
  • Jobs created more than 1,800 seconds ago
  • Jobs with completion time status

Each example includes the request and a sample response.

Delete jobs with cancelled status

To delete jobs with cancelled status, set status to cancelled.

curl -i -k -X DELETE \
    --header "Authorization: Bearer ${token}" \
    --header 'Accept: application/json' \
    "<oml-cloud-service-location-url>/oml/api/r-scripts/v2/jobs?status=cancelled"

The response reports the number of deleted jobs.

{
    "result": "Successfully deleted 1 jobs"
}

Delete jobs matching a comments pattern

To delete jobs whose comments match a pattern, set commentsPattern to that pattern. This example uses random.

curl -i -k -X DELETE \
    --header "Authorization: Bearer ${token}" \
    --header 'Accept: application/json' \
    "<oml-cloud-service-location-url>/oml/api/r-scripts/v2/jobs?commentsPattern=random"

The response reports the number of deleted jobs.

{
    "result": "Successfully deleted 1 jobs"
}

Delete jobs created more than 1,800 seconds ago

To delete jobs created more than 1,800 seconds ago, set createdOlderThanSeconds to 1800.

curl -i -k -X DELETE \
    --header "Authorization: Bearer ${token}" \
    --header 'Accept: application/json' \
    "<oml-cloud-service-location-url>/oml/api/r-scripts/v2/jobs?createdOlderThanSeconds=1800"

The response reports the number of deleted jobs.

{
    "result": "Successfully deleted 1 jobs"
}

Delete jobs finished more than 1,800 seconds ago

To delete jobs finished more than 1,800 seconds ago, set finishedOlderThanSeconds to 1800.

curl -i -k -X DELETE \
    --header "Authorization: Bearer ${token}" \
    --header 'Accept: application/json' \
    "<oml-cloud-service-location-url>/oml/api/r-scripts/v2/jobs?finishedOlderThanSeconds=1800"

The response reports the number of deleted jobs.

{
    "result": "Successfully deleted 3 jobs"
}

Delete jobs matching two filters: status and comments pattern

To delete jobs with a FINISH status and comments that match a pattern, set status and commentsPattern. This example deletes jobs whose status is FINISH and whose comments match random:

curl -i -k -X DELETE \
  --header "Authorization: Bearer ${token}" \
  --header 'Accept: application/json' \
  "<oml-cloud-service-location-url>/oml/api/r-scripts/v2/jobs?commentsPattern=random&status=FINISH"

The response reports the number of deleted jobs:

{
  "result": "Successfully deleted 2 jobs"
}
Back to Top