Delete an Asynchronous Job

delete

/r-scripts/v2/jobs/{jobId}

Delete an asynchronous job specified by *jobId* from the Database.

Request

Path Parameters

There's no request body for this operation.

Back to Top

Response

Supported Media Types

200 Response

Job is deleted.
Body ()
Root Schema : JSONObject
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

If your function is taking too long to run and you need to abort or delete it, you can use cURL to send a DELETE request to stop the running function call. Follow these steps to delete a running job :

  1. Define a function: The function, tmrqfun2, takes a significant amount of time for completion.
    begin
      sys.rqScriptCreate('tmrqfun2',
         'function() {
              Sys.sleep(1800)
    res <- "Hello World!"
    res
    }');
    end;
    /
  2. Run the script: The following cURL command runs the script named 'tmrqfun2' with asynchronous values.
    curl -i -k -X POST --header "Authorization: Bearer ${token}" 
    --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"service":"LOW", "asyncFlag":true, "timeout": 4800}'  
    "https://<server>/oml/api/r-scripts/v2/do-eval/tmrqfun2"
    HTTP/1.1 201 Created
    Server: nginx/1.20.1
    Date: Tue, 18 Feb 2025 17:01:05 GMT GMT
    Content-Length: 0
    Connection: keep-alive
    Strict-Transport-Security: max-age=31536000; includeSubDomains
    X-Content-Type-Options: nosniff
    Cache-Control: no-cache, no-store, must-revalidate
    Pragma: no-cache
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1;mode=block
    Content-Security-Policy: default-src 'none'; connect-src 'self'; font-src 'self' static.oracle.com; img-src 'self' data: static.oracle.com; media-src 'none'; object-src 'none'; script-src 'self' static.oracle.com 'unsafe-inline' 'unsafe-eval'; style-src 'self' static.oracle.com 'unsafe-inline'; frame-ancestors 'none'
    Set-Cookie: JSESSIONID=node0q111ieg2vqdj1wf7cnlf2ao2k0.node0; Path=/oml; Secure; HttpOnly
    Expires: Thu, 01 Jan 1970 00:00:00 GMT
    Location: https://phoenix363074.dev3sub2phx.databasede3phx.oraclevcn.com/oml/api/r-scripts/v2/jobs/<jobId>
  3. Check the job status: Check the jobs with ID to see if they are running.
    curl -i -k -X GET --header "Authorization: Bearer ${token}" 
    --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"service":"LOW"}'  
    "https://<server>/oml/api/r-scripts/v2/jobs/<jobId>"
    HTTP/1.1 202 Accepted
    Date: Tue, 18 Feb 2025 17:02:01 GMT GMT
    Content-Type: application/json
    Content-Length: 93
    Connection: keep-alive
    Strict-Transport-Security: max-age=31536000; includeSubDomains
    X-Content-Type-Options: nosniff
    Cache-Control: no-cache, no-store, must-revalidate
    Pragma: no-cache
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1;mode=block
    Content-Security-Policy: default-src 'none'; connect-src 'self'; font-src 'self' static.oracle.com; img-src 'self' data: static.oracle.com; media-src 'none'; object-src 'none'; script-src 'self' static.oracle.com 'unsafe-inline' 'unsafe-eval'; style-src 'self' static.oracle.com 'unsafe-inline'; frame-ancestors 'none'
     
    {"createdDate":" Feb 18,2025 17:01","status":"job is still running","elapsedTime":"00:00:47"}
  4. Delete the job: Delete the job with jobid, <jobId>.
    curl -i -X DELETE --header "Authorization: Bearer ${token}" \
    --header 'Accept: application/json' \
    "<oml-cloud-service-location-url>/oml/api/r-scripts/v2/jobs/<jobId>"
    {
        "result": "job deleted successfully"
    }
  5. Delete the job a second time: If you attempt to delete a job ID for the second time it will result in Failure as job is no longer accessible.
    curl -i -X DELETE --header "Authorization: Bearer ${token}" \--header 'Accept: application/json' \"<oml-cloud-service-location-url>/oml/api/r-scripts/v2/jobs/<jobId>"
    HTTP/2 400 Bad Request
    {
        "errorMessage": "job not found with id '<jobId>'",
        "errorCode": 1026,
        "request_id": "OML-7a98765edacf4310b16277e6cf"
    }
Back to Top