Updates multiple jobs in a single request. This is a batch version of the UpdateJob API.
The result of updating each job is reported individually in the response. Because the batch request can result in a combination of successful and unsuccessful actions, you should check for batch errors even when the call returns an HTTP status code of 200.
When you change the status of a job to ARCHIVED, the job can't be scheduled or archived.
An archived job and its steps and tasks are deleted after 120 days. The job can't be recovered.
Parameters:
-
client_token
(Optional[ClientToken], default:
None
)
–
The unique token which the server uses to recognize retries of the same request.
-
jobs
(BatchUpdateJobItems)
–
The list of jobs to update. You can specify up to 100 jobs per request.
Raises:
Examples:
Update multiple jobs in a single request
>>> client.batch_update_job(jobs=[{'farmId': 'farm-1234567890abcdef1234567890abcdef', 'queueId': 'queue-1234567890abcdef1234567890abcdef', 'jobId': 'job-1234567890abcdef1234567890abcdef', 'targetTaskRunStatus': 'FAILED'}, {'farmId': 'farm-1234567890abcdef1234567890abcdef', 'queueId': 'queue-1234567890abcdef1234567890abcdef', 'jobId': 'job-234567890abcdef1234567890abcdef1', 'targetTaskRunStatus': 'FAILED'}])
Source code in docs_src/capo_deadline/_services/deadline.py
| def batch_update_job(
self,
jobs: "capo_deadline.types.batch_update_job_items.BatchUpdateJobItems",
*,
config_overrides: Optional[deadlineClientConfig] = None,
client_token: Optional["capo_deadline.types.client_token.ClientToken"] = None,
) -> "capo_deadline.types.batch_update_job_response.BatchUpdateJobResponse":
"""<p>Updates multiple jobs in a single request. This is a batch version of the <code>UpdateJob</code> API.</p> <p>The result of updating each job is reported individually in the response. Because the batch request can result in a combination of successful and unsuccessful actions, you should check for batch errors even when the call returns an HTTP status code of 200.</p> <p>When you change the status of a job to <code>ARCHIVED</code>, the job can't be scheduled or archived.</p> <important> <p>An archived job and its steps and tasks are deleted after 120 days. The job can't be recovered.</p> </important>
Args:
client_token: <p>The unique token which the server uses to recognize retries of the same request.</p>
jobs: <p>The list of jobs to update. You can specify up to 100 jobs per request.</p>
Raises:
capo_deadline.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform the action.</p>
capo_deadline.errors.internal_server_error_exception.InternalServerErrorException: <p>Deadline Cloud can't process your request right now. Try again later.</p>
capo_deadline.errors.throttling_exception.ThrottlingException: <p>Your request exceeded a request rate quota.</p>
capo_deadline.errors.validation_exception.ValidationException: <p>The request isn't valid. This can occur if your request contains malformed JSON or unsupported characters.</p>
capo_deadline.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Update multiple jobs in a single request
>>> client.batch_update_job(jobs=[{'farmId': 'farm-1234567890abcdef1234567890abcdef', 'queueId': 'queue-1234567890abcdef1234567890abcdef', 'jobId': 'job-1234567890abcdef1234567890abcdef', 'targetTaskRunStatus': 'FAILED'}, {'farmId': 'farm-1234567890abcdef1234567890abcdef', 'queueId': 'queue-1234567890abcdef1234567890abcdef', 'jobId': 'job-234567890abcdef1234567890abcdef1', 'targetTaskRunStatus': 'FAILED'}])
"""
def _handler(
req: "OperationRequest[capo_deadline.types.batch_update_job_request.BatchUpdateJobRequest]",
) -> OperationResponse[
"capo_deadline.types.batch_update_job_response.BatchUpdateJobResponse"
]:
import capo_deadline._operations.deadline.batch_update_job
output, http_response = (
capo_deadline._operations.deadline.batch_update_job.batch_update_job(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_deadline.types.batch_update_job_request.BatchUpdateJobRequest",
) -> dict[str, Any]:
import capo_deadline.types.batch_update_job_request
return capo_deadline.types.batch_update_job_request.redact_sensitive(input_)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("BatchUpdateJob", redact_input=_redact_input),
)
input_: capo_deadline.types.batch_update_job_request.BatchUpdateJobRequest = {
"jobs": jobs
}
if client_token is None:
client_token = str(uuid.uuid4())
input_["client_token"] = client_token
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|