Delete job id from DB
delete
/r-scripts/v1/jobs/{jobId}
Delete job from table by job_id
Request
Path Parameters
-
jobId(required):
The id of the asynchronous job
Response
202 Response
Job is still pending.
302 Response
Returns the Content-Location header where the result of the job can be fetched.
Headers
401 Response
When the user doesn't have privileges to perform the action.
500 Response
Problem connecting to Broker, finding the job id or other unexpected error.
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 :
- 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; /
- 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/v1/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/v1/jobs/ce91e852-8e91-46da-b26c-6314d9d9f267
- 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/v1/jobs/ce91e852-8e91-46da-b26c-6314d9d9f267"
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"}
- Delete the job: Delete the job with jobid,
ce91e852-8e91-46da-b26c-6314d9d9f267
.curl -i -k -X DELETE --header "Authorization: Bearer ${token}" --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"service":"LOW"}' "https://<server>/oml/api/r-scripts/v1/jobs/ce91e852-8e91-46da-b26c-6314d9d9f267"
HTTP/1.1 200 OK Server: nginx/1.20.1 Date: Tue, 18 Feb 2025 17:03:50 GMT GMT Content-Type: application/json Content-Length: 139 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' {"Message":"Job ce91e852-8e91-46da-b26c-6314d9d9f267 sucessfully deleted container ending : LOW-1732561821973"}
- 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 -k -X DELETE --header "Authorization: Bearer ${token}" --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"service":"LOW"}' "https://<server>/oml/api/r-scripts/v1/jobs/ce91e852-8e91-46da-b26c-6314d9d9f26"
HTTP/1.1 200 OK Date: Tue, 18 Feb 2025 17:04:20 GMT Content-Type: application/json Content-Length: 102 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' {"Message":"Job ce91e852-8e91-46da-b26c-6314d9d9f267 status is FAILURE and not applicable to delete" }