Skip to content

update_job_execution

update_job_execution(
    job_id: JobId,
    thing_name: ThingName,
    status: JobExecutionStatus,
    *,
    config_overrides: Optional[IoTJobsDataPlaneClientConfig] = None,
    status_details: Optional[DetailsMap] = None,
    step_timeout_in_minutes: Optional[StepTimeoutInMinutes] = None,
    expected_version: Optional[ExpectedVersion] = None,
    include_job_execution_state: Optional[IncludeExecutionState] = None,
    include_job_document: Optional[IncludeJobDocument] = None,
    execution_number: Optional[ExecutionNumber] = None,
) -> UpdateJobExecutionResponse

Updates the status of a job execution.

Requires permission to access the UpdateJobExecution action.

Parameters:

  • job_id (JobId) –

    The unique identifier assigned to this job when it was created.

  • thing_name (ThingName) –

    The name of the thing associated with the device.

  • status (JobExecutionStatus) –

    The new status for the job execution (IN_PROGRESS, FAILED, SUCCESS, or REJECTED). This must be specified on every update.

  • status_details (Optional[DetailsMap], default: None ) –

    Optional. A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged.

    The maximum length of the value in the name/value pair is 1,024 characters.

  • step_timeout_in_minutes (Optional[StepTimeoutInMinutes], default: None ) –

    Specifies the amount of time this device has to finish execution of this job. If the job execution status is not set to a terminal state before this timer expires, or before the timer is reset (by again calling UpdateJobExecution, setting the status to IN_PROGRESS, and specifying a new timeout value in this field) the job execution status will be automatically set to TIMED_OUT. Note that setting or resetting the step timeout has no effect on the in progress timeout that may have been specified when the job was created (CreateJob using field timeoutConfig).

    Valid values for this parameter range from 1 to 10080 (1 minute to 7 days). A value of -1 is also valid and will cancel the current step timer (created by an earlier use of UpdateJobExecutionRequest).

  • expected_version (Optional[ExpectedVersion], default: None ) –

    Optional. The expected current version of the job execution. Each time you update the job execution, its version is incremented. If the version of the job execution stored in Jobs does not match, the update is rejected with a VersionMismatch error, and an ErrorResponse that contains the current job execution status data is returned. (This makes it unnecessary to perform a separate DescribeJobExecution request in order to obtain the job execution status data.)

  • include_job_execution_state (Optional[IncludeExecutionState], default: None ) –

    Optional. When included and set to true, the response contains the JobExecutionState data. The default is false.

  • include_job_document (Optional[IncludeJobDocument], default: None ) –

    Optional. When set to true, the response contains the job document. The default is false.

  • execution_number (Optional[ExecutionNumber], default: None ) –

    Optional. A number that identifies a particular job execution on a particular device.

Raises:

Source code in docs_src/capo_iot_jobs_data_plane/_services/io_t_jobs_data_plane.py
def update_job_execution(
    self,
    job_id: "capo_iot_jobs_data_plane.types.job_id.JobId",
    thing_name: "capo_iot_jobs_data_plane.types.thing_name.ThingName",
    status: "capo_iot_jobs_data_plane.types.job_execution_status.JobExecutionStatus",
    *,
    config_overrides: Optional[IoTJobsDataPlaneClientConfig] = None,
    status_details: Optional[
        "capo_iot_jobs_data_plane.types.details_map.DetailsMap"
    ] = None,
    step_timeout_in_minutes: Optional[
        "capo_iot_jobs_data_plane.types.step_timeout_in_minutes.StepTimeoutInMinutes"
    ] = None,
    expected_version: Optional[
        "capo_iot_jobs_data_plane.types.expected_version.ExpectedVersion"
    ] = None,
    include_job_execution_state: Optional[
        "capo_iot_jobs_data_plane.types.include_execution_state.IncludeExecutionState"
    ] = None,
    include_job_document: Optional[
        "capo_iot_jobs_data_plane.types.include_job_document.IncludeJobDocument"
    ] = None,
    execution_number: Optional[
        "capo_iot_jobs_data_plane.types.execution_number.ExecutionNumber"
    ] = None,
) -> "capo_iot_jobs_data_plane.types.update_job_execution_response.UpdateJobExecutionResponse":
    """<p>Updates the status of a job execution.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiotjobsdataplane.html">UpdateJobExecution</a> action.</p>

    Args:
        job_id: <p>The unique identifier assigned to this job when it was created.</p>
        thing_name: <p>The name of the thing associated with the device.</p>
        status: <p>The new status for the job execution (IN_PROGRESS, FAILED, SUCCESS, or REJECTED). This must be specified on every update.</p>
        status_details: <p> Optional. A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged.</p> <p>The maximum length of the value in the name/value pair is 1,024 characters.</p>
        step_timeout_in_minutes: <p>Specifies the amount of time this device has to finish execution of this job. If the job execution status is not set to a terminal state before this timer expires, or before the timer is reset (by again calling <code>UpdateJobExecution</code>, setting the status to <code>IN_PROGRESS</code>, and specifying a new timeout value in this field) the job execution status will be automatically set to <code>TIMED_OUT</code>. Note that setting or resetting the step timeout has no effect on the in progress timeout that may have been specified when the job was created (<code>CreateJob</code> using field <code>timeoutConfig</code>).</p> <p>Valid values for this parameter range from 1 to 10080 (1 minute to 7 days). A value of -1 is also valid and will cancel the current step timer (created by an earlier use of <code>UpdateJobExecutionRequest</code>).</p>
        expected_version: <p>Optional. The expected current version of the job execution. Each time you update the job execution, its version is incremented. If the version of the job execution stored in Jobs does not match, the update is rejected with a VersionMismatch error, and an ErrorResponse that contains the current job execution status data is returned. (This makes it unnecessary to perform a separate DescribeJobExecution request in order to obtain the job execution status data.)</p>
        include_job_execution_state: <p>Optional. When included and set to true, the response contains the JobExecutionState data. The default is false.</p>
        include_job_document: <p>Optional. When set to true, the response contains the job document. The default is false.</p>
        execution_number: <p>Optional. A number that identifies a particular job execution on a particular device.</p>

    Raises:
        capo_iot_jobs_data_plane.errors.certificate_validation_exception.CertificateValidationException: <p>The certificate is invalid.</p>
        capo_iot_jobs_data_plane.errors.invalid_request_exception.InvalidRequestException: <p>The contents of the request were invalid.</p>
        capo_iot_jobs_data_plane.errors.invalid_state_transition_exception.InvalidStateTransitionException: <p>An update attempted to change the job execution to a state that is invalid because of the job execution's current state (for example, an attempt to change a request in state SUCCESS to state IN_PROGRESS). In this case, the body of the error message also contains the executionState field.</p>
        capo_iot_jobs_data_plane.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot_jobs_data_plane.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
        capo_iot_jobs_data_plane.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot_jobs_data_plane.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iot_jobs_data_plane.types.update_job_execution_request.UpdateJobExecutionRequest]",
    ) -> OperationResponse[
        "capo_iot_jobs_data_plane.types.update_job_execution_response.UpdateJobExecutionResponse"
    ]:
        import capo_iot_jobs_data_plane._operations.iot_laser_thing_job_manager_external_service.update_job_execution

        output, http_response = (
            capo_iot_jobs_data_plane._operations.iot_laser_thing_job_manager_external_service.update_job_execution.update_job_execution(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateJobExecution")
    )
    input_: capo_iot_jobs_data_plane.types.update_job_execution_request.UpdateJobExecutionRequest = {
        "job_id": job_id,
        "thing_name": thing_name,
        "status": status,
    }
    if status_details is not None:
        input_["status_details"] = status_details
    if step_timeout_in_minutes is not None:
        input_["step_timeout_in_minutes"] = step_timeout_in_minutes
    if expected_version is not None:
        input_["expected_version"] = expected_version
    if include_job_execution_state is not None:
        input_["include_job_execution_state"] = include_job_execution_state
    if include_job_document is not None:
        input_["include_job_document"] = include_job_document
    if execution_number is not None:
        input_["execution_number"] = execution_number

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