Skip to content

update_job

update_job(
    farm_id: FarmId,
    queue_id: QueueId,
    job_id: JobId,
    *,
    config_overrides: Optional[deadlineClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    target_task_run_status: Optional[JobTargetTaskRunStatus] = None,
    priority: Optional[JobPriority] = None,
    max_failed_tasks_count: Optional[MaxFailedTasksCount] = None,
    max_retries_per_task: Optional[MaxRetriesPerTask] = None,
    lifecycle_status: Optional[UpdateJobLifecycleStatus] = None,
    max_worker_count: Optional[MaxWorkerCount] = None,
    name: Optional[JobName] = None,
    description: Optional[JobDescriptionOverride] = None,
) -> UpdateJobResponse

Updates a job.

When you change the status of the job to ARCHIVED, the job can't be scheduled or archived.

An archived jobs and its steps and tasks are deleted after 120 days. The job can't be recovered.

Parameters:

  • farm_id (FarmId) –

    The farm ID of the job to update.

  • queue_id (QueueId) –

    The queue ID of the job to update.

  • job_id (JobId) –

    The job ID to update.

  • client_token (Optional[ClientToken], default: None ) –

    The unique token which the server uses to recognize retries of the same request.

  • target_task_run_status (Optional[JobTargetTaskRunStatus], default: None ) –

    The task status to update the job's tasks to.

  • priority (Optional[JobPriority], default: None ) –

    The updated job priority.

  • max_failed_tasks_count (Optional[MaxFailedTasksCount], default: None ) –

    The number of task failures before the job stops running and is marked as FAILED.

  • max_retries_per_task (Optional[MaxRetriesPerTask], default: None ) –

    The maximum number of retries for a job.

  • lifecycle_status (Optional[UpdateJobLifecycleStatus], default: None ) –

    The status of a job in its lifecycle. When you change the status of the job to ARCHIVED, the job can't be scheduled or archived.

    An archived jobs and its steps and tasks are deleted after 120 days. The job can't be recovered.

  • max_worker_count (Optional[MaxWorkerCount], default: None ) –

    The maximum number of worker hosts that can concurrently process a job. When the maxWorkerCount is reached, no more workers will be assigned to process the job, even if the fleets assigned to the job's queue has available workers.

    You can't set the maxWorkerCount to 0. If you set it to -1, there is no maximum number of workers.

    If you don't specify the maxWorkerCount, the default is -1.

    The maximum number of workers that can process tasks in the job.

  • name (Optional[JobName], default: None ) –

    The updated job name.

  • description (Optional[JobDescriptionOverride], default: None ) –

    The updated job description.

Raises:

Source code in docs_src/capo_deadline/_services/deadline.py
def update_job(
    self,
    farm_id: "capo_deadline.types.farm_id.FarmId",
    queue_id: "capo_deadline.types.queue_id.QueueId",
    job_id: "capo_deadline.types.job_id.JobId",
    *,
    config_overrides: Optional[deadlineClientConfig] = None,
    client_token: Optional["capo_deadline.types.client_token.ClientToken"] = None,
    target_task_run_status: Optional[
        "capo_deadline.types.job_target_task_run_status.JobTargetTaskRunStatus"
    ] = None,
    priority: Optional["capo_deadline.types.job_priority.JobPriority"] = None,
    max_failed_tasks_count: Optional[
        "capo_deadline.types.max_failed_tasks_count.MaxFailedTasksCount"
    ] = None,
    max_retries_per_task: Optional[
        "capo_deadline.types.max_retries_per_task.MaxRetriesPerTask"
    ] = None,
    lifecycle_status: Optional[
        "capo_deadline.types.update_job_lifecycle_status.UpdateJobLifecycleStatus"
    ] = None,
    max_worker_count: Optional[
        "capo_deadline.types.max_worker_count.MaxWorkerCount"
    ] = None,
    name: Optional["capo_deadline.types.job_name.JobName"] = None,
    description: Optional[
        "capo_deadline.types.job_description_override.JobDescriptionOverride"
    ] = None,
) -> "capo_deadline.types.update_job_response.UpdateJobResponse":
    """<p>Updates a job. </p> <p>When you change the status of the job to <code>ARCHIVED</code>, the job can't be scheduled or archived.</p> <important> <p>An archived jobs and its steps and tasks are deleted after 120 days. The job can't be recovered.</p> </important>

    Args:
        farm_id: <p>The farm ID of the job to update.</p>
        queue_id: <p>The queue ID of the job to update.</p>
        job_id: <p>The job ID to update.</p>
        client_token: <p>The unique token which the server uses to recognize retries of the same request.</p>
        target_task_run_status: <p>The task status to update the job's tasks to.</p>
        priority: <p>The updated job priority.</p>
        max_failed_tasks_count: <p>The number of task failures before the job stops running and is marked as <code>FAILED</code>.</p>
        max_retries_per_task: <p>The maximum number of retries for a job.</p>
        lifecycle_status: <p>The status of a job in its lifecycle. When you change the status of the job to <code>ARCHIVED</code>, the job can't be scheduled or archived.</p> <important> <p>An archived jobs and its steps and tasks are deleted after 120 days. The job can't be recovered.</p> </important>
        max_worker_count: <p>The maximum number of worker hosts that can concurrently process a job. When the <code>maxWorkerCount</code> is reached, no more workers will be assigned to process the job, even if the fleets assigned to the job's queue has available workers.</p> <p>You can't set the <code>maxWorkerCount</code> to 0. If you set it to -1, there is no maximum number of workers.</p> <p>If you don't specify the <code>maxWorkerCount</code>, the default is -1.</p> <p>The maximum number of workers that can process tasks in the job.</p>
        name: <p>The updated job name.</p>
        description: <p>The updated job description.</p>

    Raises:
        capo_deadline.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform the action.</p>
        capo_deadline.errors.conflict_exception.ConflictException: <p>Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time.</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.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource can't be found.</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.
    """

    def _handler(
        req: "OperationRequest[capo_deadline.types.update_job_request.UpdateJobRequest]",
    ) -> OperationResponse[
        "capo_deadline.types.update_job_response.UpdateJobResponse"
    ]:
        import capo_deadline._operations.deadline.update_job

        output, http_response = (
            capo_deadline._operations.deadline.update_job.update_job(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_deadline.types.update_job_request.UpdateJobRequest",
    ) -> dict[str, Any]:
        import capo_deadline.types.update_job_request

        return capo_deadline.types.update_job_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateJob", redact_input=_redact_input)
    )
    input_: capo_deadline.types.update_job_request.UpdateJobRequest = {
        "farm_id": farm_id,
        "queue_id": queue_id,
        "job_id": job_id,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if target_task_run_status is not None:
        input_["target_task_run_status"] = target_task_run_status
    if priority is not None:
        input_["priority"] = priority
    if max_failed_tasks_count is not None:
        input_["max_failed_tasks_count"] = max_failed_tasks_count
    if max_retries_per_task is not None:
        input_["max_retries_per_task"] = max_retries_per_task
    if lifecycle_status is not None:
        input_["lifecycle_status"] = lifecycle_status
    if max_worker_count is not None:
        input_["max_worker_count"] = max_worker_count
    if name is not None:
        input_["name"] = name
    if description is not None:
        input_["description"] = description

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output