awsiot.iotjobs

class awsiot.iotjobs.IotJobsClient(mqtt_connection)

Bases: MqttServiceClient

The AWS IoT jobs service can be used to define a set of remote operations that are sent to and executed on one or more devices connected to AWS IoT.

AWS Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#jobs-mqtt-api

Parameters:

mqtt_connection (Connection) –

publish_describe_job_execution(request, qos)

Gets detailed information about a job execution.

API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-describejobexecution

Parameters:
Returns:

A Future whose result will be None if the request is successfully published. The Future’s result will be an exception if the request cannot be published.

Return type:

Future

publish_get_pending_job_executions(request, qos)

Gets the list of all jobs for a thing that are not in a terminal state.

API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-getpendingjobexecutions

Parameters:
Returns:

A Future whose result will be None if the request is successfully published. The Future’s result will be an exception if the request cannot be published.

Return type:

Future

publish_start_next_pending_job_execution(request, qos)

Gets and starts the next pending job execution for a thing (status IN_PROGRESS or QUEUED).

API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-startnextpendingjobexecution

Parameters:
Returns:

A Future whose result will be None if the request is successfully published. The Future’s result will be an exception if the request cannot be published.

Return type:

Future

publish_update_job_execution(request, qos)

Updates the status of a job execution. You can optionally create a step timer by setting a value for the stepTimeoutInMinutes property. If you don’t update the value of this property by running UpdateJobExecution again, the job execution times out when the step timer expires.

API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-updatejobexecution

Parameters:
  • request (UpdateJobExecutionRequest) – UpdateJobExecutionRequest instance.

  • qos (int) – The Quality of Service guarantee of this message

Returns:

A Future whose result will be None if the request is successfully published. The Future’s result will be an exception if the request cannot be published.

Return type:

Future

subscribe_to_describe_job_execution_accepted(request, qos, callback)

Subscribes to the accepted topic for the DescribeJobExecution operation

API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-describejobexecution

Parameters:
  • request (DescribeJobExecutionSubscriptionRequest) – DescribeJobExecutionSubscriptionRequest instance.

  • qos (int) – The Quality of Service guarantee of this message

  • callback (Callable[[DescribeJobExecutionResponse], None]) – Callback to invoke each time the event is received. The callback should take 1 argument of type DescribeJobExecutionResponse. The callback is not expected to return anything.

Returns:

Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.

Return type:

Tuple[Future, str]

subscribe_to_describe_job_execution_rejected(request, qos, callback)

Subscribes to the rejected topic for the DescribeJobExecution operation

API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-describejobexecution

Parameters:
  • request (DescribeJobExecutionSubscriptionRequest) – DescribeJobExecutionSubscriptionRequest instance.

  • qos (int) – The Quality of Service guarantee of this message

  • callback (Callable[[RejectedError], None]) – Callback to invoke each time the event is received. The callback should take 1 argument of type RejectedError. The callback is not expected to return anything.

Returns:

Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.

Return type:

Tuple[Future, str]

subscribe_to_get_pending_job_executions_accepted(request, qos, callback)

Subscribes to the accepted topic for the GetPendingJobsExecutions operation

API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-getpendingjobexecutions

Parameters:
Returns:

Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.

Return type:

Tuple[Future, str]

subscribe_to_get_pending_job_executions_rejected(request, qos, callback)

Subscribes to the rejected topic for the GetPendingJobsExecutions operation

API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-getpendingjobexecutions

Parameters:
  • request (GetPendingJobExecutionsSubscriptionRequest) – GetPendingJobExecutionsSubscriptionRequest instance.

  • qos (int) – The Quality of Service guarantee of this message

  • callback (Callable[[RejectedError], None]) – Callback to invoke each time the event is received. The callback should take 1 argument of type RejectedError. The callback is not expected to return anything.

Returns:

Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.

Return type:

Tuple[Future, str]

subscribe_to_job_executions_changed_events(request, qos, callback)

Subscribes to JobExecutionsChanged notifications for a given IoT thing.

API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-jobexecutionschanged

Parameters:
  • request (JobExecutionsChangedSubscriptionRequest) – JobExecutionsChangedSubscriptionRequest instance.

  • qos (int) – The Quality of Service guarantee of this message

  • callback (Callable[[JobExecutionsChangedEvent], None]) – Callback to invoke each time the event is received. The callback should take 1 argument of type JobExecutionsChangedEvent. The callback is not expected to return anything.

Returns:

Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.

Return type:

Tuple[Future, str]

subscribe_to_next_job_execution_changed_events(request, qos, callback)

API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-nextjobexecutionchanged

Parameters:
  • request (NextJobExecutionChangedSubscriptionRequest) – NextJobExecutionChangedSubscriptionRequest instance.

  • qos (int) – The Quality of Service guarantee of this message

  • callback (Callable[[NextJobExecutionChangedEvent], None]) – Callback to invoke each time the event is received. The callback should take 1 argument of type NextJobExecutionChangedEvent. The callback is not expected to return anything.

Returns:

Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.

Return type:

Tuple[Future, str]

subscribe_to_start_next_pending_job_execution_accepted(request, qos, callback)

Subscribes to the accepted topic for the StartNextPendingJobExecution operation

API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-startnextpendingjobexecution

Parameters:
Returns:

Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.

Return type:

Tuple[Future, str]

subscribe_to_start_next_pending_job_execution_rejected(request, qos, callback)

Subscribes to the rejected topic for the StartNextPendingJobExecution operation

API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-startnextpendingjobexecution

Parameters:
  • request (StartNextPendingJobExecutionSubscriptionRequest) – StartNextPendingJobExecutionSubscriptionRequest instance.

  • qos (int) – The Quality of Service guarantee of this message

  • callback (Callable[[RejectedError], None]) – Callback to invoke each time the event is received. The callback should take 1 argument of type RejectedError. The callback is not expected to return anything.

Returns:

Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.

Return type:

Tuple[Future, str]

subscribe_to_update_job_execution_accepted(request, qos, callback)

Subscribes to the accepted topic for the UpdateJobExecution operation

API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-updatejobexecution

Parameters:
  • request (UpdateJobExecutionSubscriptionRequest) – UpdateJobExecutionSubscriptionRequest instance.

  • qos (int) – The Quality of Service guarantee of this message

  • callback (Callable[[UpdateJobExecutionResponse], None]) – Callback to invoke each time the event is received. The callback should take 1 argument of type UpdateJobExecutionResponse. The callback is not expected to return anything.

Returns:

Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.

Return type:

Tuple[Future, str]

subscribe_to_update_job_execution_rejected(request, qos, callback)

Subscribes to the rejected topic for the UpdateJobExecution operation

API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-updatejobexecution

Parameters:
  • request (UpdateJobExecutionSubscriptionRequest) – UpdateJobExecutionSubscriptionRequest instance.

  • qos (int) – The Quality of Service guarantee of this message

  • callback (Callable[[RejectedError], None]) – Callback to invoke each time the event is received. The callback should take 1 argument of type RejectedError. The callback is not expected to return anything.

Returns:

Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.

Return type:

Tuple[Future, str]

class awsiot.iotjobs.DescribeJobExecutionRequest(*args, **kwargs)

Bases: ModeledClass

Data needed to make a DescribeJobExecution request.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
  • client_token (str) – An opaque string used to correlate requests and responses. Enter an arbitrary value here and it is reflected in the response.

  • execution_number (int) – Optional. A number that identifies a job execution on a device. If not specified, the latest job execution is returned.

  • include_job_document (bool) – Optional. Unless set to false, the response contains the job document. The default is true.

  • job_id (str) – The unique identifier assigned to this job when it was created. Or use $next to return the next pending job execution for a thing (status IN_PROGRESS or QUEUED). In this case, any job executions with status IN_PROGRESS are returned first. Job executions are returned in the order in which they were created.

  • thing_name (str) – The name of the thing associated with the device.

client_token

An opaque string used to correlate requests and responses. Enter an arbitrary value here and it is reflected in the response.

Type:

str

execution_number

Optional. A number that identifies a job execution on a device. If not specified, the latest job execution is returned.

Type:

int

include_job_document

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

Type:

bool

job_id

The unique identifier assigned to this job when it was created. Or use $next to return the next pending job execution for a thing (status IN_PROGRESS or QUEUED). In this case, any job executions with status IN_PROGRESS are returned first. Job executions are returned in the order in which they were created.

Type:

str

thing_name

The name of the thing associated with the device.

Type:

str

class awsiot.iotjobs.DescribeJobExecutionResponse(*args, **kwargs)

Bases: ModeledClass

Response payload to a DescribeJobExecution request.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
  • client_token (str) – A client token used to correlate requests and responses.

  • execution (JobExecutionData) – Contains data about a job execution.

  • timestamp (datetime.datetime) – The time when the message was sent.

client_token

A client token used to correlate requests and responses.

Type:

str

execution

Contains data about a job execution.

Type:

JobExecutionData

timestamp

The time when the message was sent.

Type:

datetime.datetime

class awsiot.iotjobs.DescribeJobExecutionSubscriptionRequest(*args, **kwargs)

Bases: ModeledClass

Data needed to subscribe to DescribeJobExecution responses.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
  • job_id (str) – Job ID that you want to subscribe to DescribeJobExecution response events for.

  • thing_name (str) – Name of the IoT Thing that you want to subscribe to DescribeJobExecution response events for.

job_id

Job ID that you want to subscribe to DescribeJobExecution response events for.

Type:

str

thing_name

Name of the IoT Thing that you want to subscribe to DescribeJobExecution response events for.

Type:

str

class awsiot.iotjobs.GetPendingJobExecutionsRequest(*args, **kwargs)

Bases: ModeledClass

Data needed to make a GetPendingJobExecutions request.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
  • client_token (str) – Optional. A client token used to correlate requests and responses. Enter an arbitrary value here and it is reflected in the response.

  • thing_name (str) – IoT Thing the request is relative to.

client_token

Optional. A client token used to correlate requests and responses. Enter an arbitrary value here and it is reflected in the response.

Type:

str

thing_name

IoT Thing the request is relative to.

Type:

str

class awsiot.iotjobs.GetPendingJobExecutionsResponse(*args, **kwargs)

Bases: ModeledClass

Response payload to a GetPendingJobExecutions request.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
  • client_token (str) – A client token used to correlate requests and responses.

  • in_progress_jobs (List[JobExecutionSummary]) – A list of JobExecutionSummary objects with status IN_PROGRESS.

  • queued_jobs (List[JobExecutionSummary]) – A list of JobExecutionSummary objects with status QUEUED.

  • timestamp (datetime.datetime) – The time when the message was sent.

client_token

A client token used to correlate requests and responses.

Type:

str

in_progress_jobs

A list of JobExecutionSummary objects with status IN_PROGRESS.

Type:

List[JobExecutionSummary]

queued_jobs

A list of JobExecutionSummary objects with status QUEUED.

Type:

List[JobExecutionSummary]

timestamp

The time when the message was sent.

Type:

datetime.datetime

class awsiot.iotjobs.GetPendingJobExecutionsSubscriptionRequest(*args, **kwargs)

Bases: ModeledClass

Data needed to subscribe to GetPendingJobExecutions responses.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:

thing_name (str) – Name of the IoT Thing that you want to subscribe to GetPendingJobExecutions response events for.

thing_name

Name of the IoT Thing that you want to subscribe to GetPendingJobExecutions response events for.

Type:

str

class awsiot.iotjobs.JobExecutionData(*args, **kwargs)

Bases: ModeledClass

Data about a job execution.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
  • execution_number (int) – A number that identifies a job execution on a device. It can be used later in commands that return or update job execution information.

  • job_document (Dict[str, Any]) – The content of the job document.

  • job_id (str) – The unique identifier you assigned to this job when it was created.

  • last_updated_at (datetime.datetime) – The time when the job execution started.

  • queued_at (datetime.datetime) – The time when the job execution was enqueued.

  • started_at (datetime.datetime) – The time when the job execution started.

  • status (str) – The status of the job execution. Can be one of: QUEUED, IN_PROGRESS, FAILED, SUCCEEDED, CANCELED, TIMED_OUT, REJECTED, or REMOVED.

  • status_details (Dict[str, str]) – A collection of name-value pairs that describe the status of the job execution.

  • thing_name (str) – The name of the thing that is executing the job.

  • version_number (int) – The version of the job execution. Job execution versions are incremented each time they are updated by a device.

execution_number

A number that identifies a job execution on a device. It can be used later in commands that return or update job execution information.

Type:

int

job_document

The content of the job document.

Type:

Dict[str, Any]

job_id

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

Type:

str

last_updated_at

The time when the job execution started.

Type:

datetime.datetime

queued_at

The time when the job execution was enqueued.

Type:

datetime.datetime

started_at

The time when the job execution started.

Type:

datetime.datetime

status

The status of the job execution. Can be one of: QUEUED, IN_PROGRESS, FAILED, SUCCEEDED, CANCELED, TIMED_OUT, REJECTED, or REMOVED.

Type:

str

status_details

A collection of name-value pairs that describe the status of the job execution.

Type:

Dict[str, str]

thing_name

The name of the thing that is executing the job.

Type:

str

version_number

The version of the job execution. Job execution versions are incremented each time they are updated by a device.

Type:

int

class awsiot.iotjobs.JobExecutionState(*args, **kwargs)

Bases: ModeledClass

Data about the state of a job execution.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
  • status (str) – The status of the job execution. Can be one of: QUEUED, IN_PROGRESS, FAILED, SUCCEEDED, CANCELED, TIMED_OUT, REJECTED, or REMOVED.

  • status_details (Dict[str, str]) – A collection of name-value pairs that describe the status of the job execution.

  • version_number (int) – The version of the job execution. Job execution versions are incremented each time they are updated by a device.

status

The status of the job execution. Can be one of: QUEUED, IN_PROGRESS, FAILED, SUCCEEDED, CANCELED, TIMED_OUT, REJECTED, or REMOVED.

Type:

str

status_details

A collection of name-value pairs that describe the status of the job execution.

Type:

Dict[str, str]

version_number

The version of the job execution. Job execution versions are incremented each time they are updated by a device.

Type:

int

class awsiot.iotjobs.JobExecutionSummary(*args, **kwargs)

Bases: ModeledClass

Contains a subset of information about a job execution.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
  • execution_number (int) – A number that identifies a job execution on a device.

  • job_id (str) – The unique identifier you assigned to this job when it was created.

  • last_updated_at (datetime.datetime) – The time when the job execution was last updated.

  • queued_at (datetime.datetime) – The time when the job execution was enqueued.

  • started_at (datetime.datetime) – The time when the job execution started.

  • version_number (int) – The version of the job execution. Job execution versions are incremented each time the AWS IoT Jobs service receives an update from a device.

execution_number

A number that identifies a job execution on a device.

Type:

int

job_id

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

Type:

str

last_updated_at

The time when the job execution was last updated.

Type:

datetime.datetime

queued_at

The time when the job execution was enqueued.

Type:

datetime.datetime

started_at

The time when the job execution started.

Type:

datetime.datetime

version_number

The version of the job execution. Job execution versions are incremented each time the AWS IoT Jobs service receives an update from a device.

Type:

int

class awsiot.iotjobs.JobExecutionsChangedEvent(*args, **kwargs)

Bases: ModeledClass

Sent whenever a job execution is added to or removed from the list of pending job executions for a thing.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
jobs

Map from JobStatus to a list of Jobs transitioning to that status.

Type:

Dict[str, List[JobExecutionSummary]]

timestamp

The time when the message was sent.

Type:

datetime.datetime

class awsiot.iotjobs.JobExecutionsChangedSubscriptionRequest(*args, **kwargs)

Bases: ModeledClass

Data needed to subscribe to JobExecutionsChanged events.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:

thing_name (str) – Name of the IoT Thing that you want to subscribe to JobExecutionsChanged events for.

thing_name

Name of the IoT Thing that you want to subscribe to JobExecutionsChanged events for.

Type:

str

class awsiot.iotjobs.NextJobExecutionChangedEvent(*args, **kwargs)

Bases: ModeledClass

Sent whenever there is a change to which job execution is next on the list of pending job executions for a thing, as defined for DescribeJobExecution with jobId $next. This message is not sent when the next job’s execution details change, only when the next job that would be returned by DescribeJobExecution with jobId $next has changed.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
execution

Contains data about a job execution.

Type:

JobExecutionData

timestamp

The time when the message was sent.

Type:

datetime.datetime

class awsiot.iotjobs.NextJobExecutionChangedSubscriptionRequest(*args, **kwargs)

Bases: ModeledClass

Data needed to subscribe to NextJobExecutionChanged events.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:

thing_name (str) – Name of the IoT Thing that you want to subscribe to NextJobExecutionChanged events for.

thing_name

Name of the IoT Thing that you want to subscribe to NextJobExecutionChanged events for.

Type:

str

class awsiot.iotjobs.RejectedError(*args, **kwargs)

Bases: ModeledClass

Response document containing details about a failed request.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
  • client_token (str) – Opaque token that can correlate this response to the original request.

  • code (str) – Indicates the type of error.

  • execution_state (JobExecutionState) – A JobExecutionState object. This field is included only when the code field has the value InvalidStateTransition or VersionMismatch.

  • message (str) – A text message that provides additional information.

  • timestamp (datetime.datetime) – The date and time the response was generated by AWS IoT.

client_token

Opaque token that can correlate this response to the original request.

Type:

str

code

Indicates the type of error.

Type:

str

execution_state

A JobExecutionState object. This field is included only when the code field has the value InvalidStateTransition or VersionMismatch.

Type:

JobExecutionState

message

A text message that provides additional information.

Type:

str

timestamp

The date and time the response was generated by AWS IoT.

Type:

datetime.datetime

class awsiot.iotjobs.StartNextJobExecutionResponse(*args, **kwargs)

Bases: ModeledClass

Response payload to a StartNextJobExecution request.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
  • client_token (str) – A client token used to correlate requests and responses.

  • execution (JobExecutionData) – Contains data about a job execution.

  • timestamp (datetime.datetime) – The time when the message was sent to the device.

client_token

A client token used to correlate requests and responses.

Type:

str

execution

Contains data about a job execution.

Type:

JobExecutionData

timestamp

The time when the message was sent to the device.

Type:

datetime.datetime

class awsiot.iotjobs.StartNextPendingJobExecutionRequest(*args, **kwargs)

Bases: ModeledClass

Data needed to make a StartNextPendingJobExecution request.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
  • client_token (str) – Optional. A client token used to correlate requests and responses. Enter an arbitrary value here and it is reflected in the response.

  • status_details (Dict[str, str]) – A collection of name-value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged.

  • step_timeout_in_minutes (int) – Specifies the amount of time this device has to finish execution of this job.

  • thing_name (str) – IoT Thing the request is relative to.

client_token

Optional. A client token used to correlate requests and responses. Enter an arbitrary value here and it is reflected in the response.

Type:

str

status_details

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

Type:

Dict[str, str]

step_timeout_in_minutes

Specifies the amount of time this device has to finish execution of this job.

Type:

int

thing_name

IoT Thing the request is relative to.

Type:

str

class awsiot.iotjobs.StartNextPendingJobExecutionSubscriptionRequest(*args, **kwargs)

Bases: ModeledClass

Data needed to subscribe to StartNextPendingJobExecution responses.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:

thing_name (str) – Name of the IoT Thing that you want to subscribe to StartNextPendingJobExecution response events for.

thing_name

Name of the IoT Thing that you want to subscribe to StartNextPendingJobExecution response events for.

Type:

str

class awsiot.iotjobs.UpdateJobExecutionRequest(*args, **kwargs)

Bases: ModeledClass

Data needed to make an UpdateJobExecution request.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
  • client_token (str) – A client token used to correlate requests and responses. Enter an arbitrary value here and it is reflected in the response.

  • execution_number (int) – Optional. A number that identifies a job execution on a device. If not specified, the latest job execution is used.

  • expected_version (int) – 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 the AWS IoT Jobs service does not match, the update is rejected with a VersionMismatch error, and an ErrorResponse that contains the current job execution status data is returned.

  • include_job_document (bool) – Optional. When included and set to true, the response contains the JobDocument. The default is false.

  • include_job_execution_state (bool) – Optional. When included and set to true, the response contains the JobExecutionState field. The default is false.

  • job_id (str) – The unique identifier assigned to this job when it was created.

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

  • status_details (Dict[str, str]) – A collection of name-value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged.

  • step_timeout_in_minutes (int) – 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 is set to TIMED_OUT. Setting or resetting this timeout has no effect on the job execution timeout that might have been specified when the job was created (by using CreateJob with the timeoutConfig).

  • thing_name (str) – The name of the thing associated with the device.

client_token

A client token used to correlate requests and responses. Enter an arbitrary value here and it is reflected in the response.

Type:

str

execution_number

Optional. A number that identifies a job execution on a device. If not specified, the latest job execution is used.

Type:

int

expected_version

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 the AWS IoT Jobs service does not match, the update is rejected with a VersionMismatch error, and an ErrorResponse that contains the current job execution status data is returned.

Type:

int

include_job_document

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

Type:

bool

include_job_execution_state

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

Type:

bool

job_id

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

Type:

str

status

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

Type:

str

status_details

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

Type:

Dict[str, str]

step_timeout_in_minutes

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 is set to TIMED_OUT. Setting or resetting this timeout has no effect on the job execution timeout that might have been specified when the job was created (by using CreateJob with the timeoutConfig).

Type:

int

thing_name

The name of the thing associated with the device.

Type:

str

class awsiot.iotjobs.UpdateJobExecutionResponse(*args, **kwargs)

Bases: ModeledClass

Response payload to an UpdateJobExecution request.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
  • client_token (str) – A client token used to correlate requests and responses.

  • execution_state (JobExecutionState) – Contains data about the state of a job execution.

  • job_document (Dict[str, Any]) – A UTF-8 encoded JSON document that contains information that your devices need to perform the job.

  • timestamp (datetime.datetime) – The time when the message was sent.

client_token

A client token used to correlate requests and responses.

Type:

str

execution_state

Contains data about the state of a job execution.

Type:

JobExecutionState

job_document

A UTF-8 encoded JSON document that contains information that your devices need to perform the job.

Type:

Dict[str, Any]

timestamp

The time when the message was sent.

Type:

datetime.datetime

class awsiot.iotjobs.UpdateJobExecutionSubscriptionRequest(*args, **kwargs)

Bases: ModeledClass

Data needed to subscribe to UpdateJobExecution responses.

All attributes are None by default, and may be set by keyword in the constructor.

Keyword Arguments:
  • job_id (str) – Job ID that you want to subscribe to UpdateJobExecution response events for.

  • thing_name (str) – Name of the IoT Thing that you want to subscribe to UpdateJobExecution response events for.

job_id

Job ID that you want to subscribe to UpdateJobExecution response events for.

Type:

str

thing_name

Name of the IoT Thing that you want to subscribe to UpdateJobExecution response events for.

Type:

str

class awsiot.iotjobs.JobStatus

Bases: object

The status of the job execution.

CANCELED = 'CANCELED'
FAILED = 'FAILED'
QUEUED = 'QUEUED'
IN_PROGRESS = 'IN_PROGRESS'
SUCCEEDED = 'SUCCEEDED'
TIMED_OUT = 'TIMED_OUT'
REJECTED = 'REJECTED'
REMOVED = 'REMOVED'
class awsiot.iotjobs.RejectedErrorCode

Bases: object

A value indicating the kind of error encountered while processing an AWS IoT Jobs request

INTERNAL_ERROR = 'InternalError'

There was an internal error during the processing of the request.

INVALID_JSON = 'InvalidJson'

The contents of the request could not be interpreted as valid UTF-8-encoded JSON.

INVALID_REQUEST = 'InvalidRequest'

The contents of the request were invalid. The message contains details about the error.

INVALID_STATE_TRANSITION = 'InvalidStateTransition'

An update attempted to change the job execution to a state that is invalid because of the job execution’s current state. In this case, the body of the error message also contains the executionState field.

RESOURCE_NOT_FOUND = 'ResourceNotFound'

The JobExecution specified by the request topic does not exist.

VERSION_MISMATCH = 'VersionMismatch'

The expected version specified in the request does not match the version of the job execution in the AWS IoT Jobs service. In this case, the body of the error message also contains the executionState field.

INVALID_TOPIC = 'InvalidTopic'

The request was sent to a topic in the AWS IoT Jobs namespace that does not map to any API.

REQUEST_THROTTLED = 'RequestThrottled'

The request was throttled.

TERMINAL_STATE_REACHED = 'TerminalStateReached'

Occurs when a command to describe a job is performed on a job that is in a terminal state.