Terminate a Job
Problem
You want to terminate a Job associated with your Content.
Solution
Important
This action requires owner, collaborator, or administrator privileges.
Note
Requires posit-sdk>=0.6.0
First, obtain the content
object. In this example, we get the content using it’s GUID. Then obtain the job using it’s key. Call the destroy
method to request a job termination event. This event is asynchronous and will take a few moments to process.
from posit import connect
= '154bd2af-e8fa-4aa4-aab8-dcef701f4af9'
CONTENT_GUID = 'CwCoI9tizMRRcvLw'
JOB_KEY
= connect.Client()
client = client.content.get(CONTENT_GUID)
content = content.jobs.find(JOB_KEY)
job job.destroy()
Use the API to delete a job using its job key. You’ll need the GUID for the content item, and the job key associated with the job you wish to kill.
- Get content GUID from the Dashboard’s Info tab, or by following Viewing Content Information.
- To find the job key, see Viewing Jobs for Content.
library(connectapi)
library(httr)
<- "154bd2af-e8fa-4aa4-aab8-dcef701f4af9"
CONTENT_ITEM_GUID <- "CwCoI9tizMRRcvLw"
JOB_KEY
<- connect()
client <- client$DELETE(
response ::glue("v1/content/{CONTENT_ITEM_GUID}/jobs/{JOB_KEY}"),
glue )
> print(response)
://connect.company.co/__api__/v1/content/fdc3f938-3ace-4a22-8af2-1a8f17828b6a/jobs/CwCoI9tizMRRcvLw]
Response [https: 2024-06-21 17:48
Date: 200
Status-Type: application/json; charset=utf-8
Content: 199 B Size