2018/10/08 - AWS IoT - 5 updated api methods
Changes We are releasing job execution timeout functionalities to customers. Customer now can set job execution timeout on the job level when creating a job.
{'timeoutConfig': {'inProgressTimeoutInMinutes': 'long'}}
Creates a job.
See also: AWS API Documentation
Request Syntax
client.create_job( jobId='string', targets=[ 'string', ], documentSource='string', document='string', description='string', presignedUrlConfig={ 'roleArn': 'string', 'expiresInSec': 123 }, targetSelection='CONTINUOUS'|'SNAPSHOT', jobExecutionsRolloutConfig={ 'maximumPerMinute': 123 }, timeoutConfig={ 'inProgressTimeoutInMinutes': 123 } )
string
[REQUIRED]
A job identifier which must be unique for your AWS account. We recommend using a UUID. Alpha-numeric characters, "-" and "_" are valid for use here.
list
[REQUIRED]
A list of things and thing groups to which the job should be sent.
(string) --
string
An S3 link to the job document.
string
The job document.
string
A short text description of the job.
dict
Configuration information for pre-signed S3 URLs.
roleArn (string) --
The ARN of an IAM role that grants grants permission to download files from the S3 bucket where the job data/updates are stored. The role must also grant permission for IoT to download the files.
expiresInSec (integer) --
How long (in seconds) pre-signed URLs are valid. Valid values are 60 - 3600, the default value is 3600 seconds. Pre-signed URLs are generated when Jobs receives an MQTT request for the job document.
string
Specifies whether the job will continue to run (CONTINUOUS), or will be complete after all those things specified as targets have completed the job (SNAPSHOT). If continuous, the job may also be run on a thing when a change is detected in a target. For example, a job will run on a thing when the thing is added to a target group, even after the job was completed by all things originally in the group.
dict
Allows you to create a staged rollout of the job.
maximumPerMinute (integer) --
The maximum number of things that will be notified of a pending job, per minute. This parameter allows you to create a staged rollout.
dict
Specifies the amount of time each device has to finish its execution of the job. The timer is started when the job execution status is set to IN_PROGRESS . If the job execution status is not set to another terminal state before the time expires, it will be automatically set to TIMED_OUT .
inProgressTimeoutInMinutes (integer) --
Specifies the amount of time, in minutes, this device has to finish execution of this job. A timer is started, or restarted, whenever this job's execution status is specified as IN_PROGRESS with this field populated. If the job execution status is not set to a terminal state before the timer expires, or before another job execution status update is sent with this field populated, the status will be automatically set to TIMED_OUT . Note that setting/resetting this timer has no effect on the job execution timeout timer which may have been specified when the job was created (CreateJobExecution using the field timeoutConfig ).
dict
Response Syntax
{ 'jobArn': 'string', 'jobId': 'string', 'description': 'string' }
Response Structure
(dict) --
jobArn (string) --
The job ARN.
jobId (string) --
The unique identifier you assigned to this job.
description (string) --
The job description.
{'job': {'jobProcessDetails': {'numberOfTimedOutThings': 'integer'}, 'timeoutConfig': {'inProgressTimeoutInMinutes': 'long'}}}
Describes a job.
See also: AWS API Documentation
Request Syntax
client.describe_job( jobId='string' )
string
[REQUIRED]
The unique identifier you assigned to this job when it was created.
dict
Response Syntax
{ 'documentSource': 'string', 'job': { 'jobArn': 'string', 'jobId': 'string', 'targetSelection': 'CONTINUOUS'|'SNAPSHOT', 'status': 'IN_PROGRESS'|'CANCELED'|'COMPLETED'|'DELETION_IN_PROGRESS', 'forceCanceled': True|False, 'comment': 'string', 'targets': [ 'string', ], 'description': 'string', 'presignedUrlConfig': { 'roleArn': 'string', 'expiresInSec': 123 }, 'jobExecutionsRolloutConfig': { 'maximumPerMinute': 123 }, 'createdAt': datetime(2015, 1, 1), 'lastUpdatedAt': datetime(2015, 1, 1), 'completedAt': datetime(2015, 1, 1), 'jobProcessDetails': { 'processingTargets': [ 'string', ], 'numberOfCanceledThings': 123, 'numberOfSucceededThings': 123, 'numberOfFailedThings': 123, 'numberOfRejectedThings': 123, 'numberOfQueuedThings': 123, 'numberOfInProgressThings': 123, 'numberOfRemovedThings': 123, 'numberOfTimedOutThings': 123 }, 'timeoutConfig': { 'inProgressTimeoutInMinutes': 123 } } }
Response Structure
(dict) --
documentSource (string) --
An S3 link to the job document.
job (dict) --
Information about the job.
jobArn (string) --
An ARN identifying the job with format "arn:aws:iot:region:account:job/jobId".
jobId (string) --
The unique identifier you assigned to this job when it was created.
targetSelection (string) --
Specifies whether the job will continue to run (CONTINUOUS), or will be complete after all those things specified as targets have completed the job (SNAPSHOT). If continuous, the job may also be run on a thing when a change is detected in a target. For example, a job will run on a device when the thing representing the device is added to a target group, even after the job was completed by all things originally in the group.
status (string) --
The status of the job, one of IN_PROGRESS , CANCELED , DELETION_IN_PROGRESS or COMPLETED .
forceCanceled (boolean) --
Will be true if the job was canceled with the optional force parameter set to true .
comment (string) --
If the job was updated, describes the reason for the update.
targets (list) --
A list of IoT things and thing groups to which the job should be sent.
(string) --
description (string) --
A short text description of the job.
presignedUrlConfig (dict) --
Configuration for pre-signed S3 URLs.
roleArn (string) --
The ARN of an IAM role that grants grants permission to download files from the S3 bucket where the job data/updates are stored. The role must also grant permission for IoT to download the files.
expiresInSec (integer) --
How long (in seconds) pre-signed URLs are valid. Valid values are 60 - 3600, the default value is 3600 seconds. Pre-signed URLs are generated when Jobs receives an MQTT request for the job document.
jobExecutionsRolloutConfig (dict) --
Allows you to create a staged rollout of a job.
maximumPerMinute (integer) --
The maximum number of things that will be notified of a pending job, per minute. This parameter allows you to create a staged rollout.
createdAt (datetime) --
The time, in milliseconds since the epoch, when the job was created.
lastUpdatedAt (datetime) --
The time, in milliseconds since the epoch, when the job was last updated.
completedAt (datetime) --
The time, in milliseconds since the epoch, when the job was completed.
jobProcessDetails (dict) --
Details about the job process.
processingTargets (list) --
The target devices to which the job execution is being rolled out. This value will be null after the job execution has finished rolling out to all the target devices.
(string) --
numberOfCanceledThings (integer) --
The number of things that cancelled the job.
numberOfSucceededThings (integer) --
The number of things which successfully completed the job.
numberOfFailedThings (integer) --
The number of things that failed executing the job.
numberOfRejectedThings (integer) --
The number of things that rejected the job.
numberOfQueuedThings (integer) --
The number of things that are awaiting execution of the job.
numberOfInProgressThings (integer) --
The number of things currently executing the job.
numberOfRemovedThings (integer) --
The number of things that are no longer scheduled to execute the job because they have been deleted or have been removed from the group that was a target of the job.
numberOfTimedOutThings (integer) --
The number of things whose job execution status is TIMED_OUT .
timeoutConfig (dict) --
Specifies the amount of time each device has to finish its execution of the job. A timer is started when the job execution status is set to IN_PROGRESS . If the job execution status is not set to another terminal state before the timer expires, it will be automatically set to TIMED_OUT .
inProgressTimeoutInMinutes (integer) --
Specifies the amount of time, in minutes, this device has to finish execution of this job. A timer is started, or restarted, whenever this job's execution status is specified as IN_PROGRESS with this field populated. If the job execution status is not set to a terminal state before the timer expires, or before another job execution status update is sent with this field populated, the status will be automatically set to TIMED_OUT . Note that setting/resetting this timer has no effect on the job execution timeout timer which may have been specified when the job was created (CreateJobExecution using the field timeoutConfig ).
{'execution': {'approximateSecondsBeforeTimedOut': 'long', 'status': ['TIMED_OUT']}}
Describes a job execution.
See also: AWS API Documentation
Request Syntax
client.describe_job_execution( jobId='string', thingName='string', executionNumber=123 )
string
[REQUIRED]
The unique identifier you assigned to this job when it was created.
string
[REQUIRED]
The name of the thing on which the job execution is running.
integer
A string (consisting of the digits "0" through "9" which is used to specify a particular job execution on a particular device.
dict
Response Syntax
{ 'execution': { 'jobId': 'string', 'status': 'QUEUED'|'IN_PROGRESS'|'SUCCEEDED'|'FAILED'|'TIMED_OUT'|'REJECTED'|'REMOVED'|'CANCELED', 'forceCanceled': True|False, 'statusDetails': { 'detailsMap': { 'string': 'string' } }, 'thingArn': 'string', 'queuedAt': datetime(2015, 1, 1), 'startedAt': datetime(2015, 1, 1), 'lastUpdatedAt': datetime(2015, 1, 1), 'executionNumber': 123, 'versionNumber': 123, 'approximateSecondsBeforeTimedOut': 123 } }
Response Structure
(dict) --
execution (dict) --
Information about the job execution.
jobId (string) --
The unique identifier you assigned to the job when it was created.
status (string) --
The status of the job execution (IN_PROGRESS, QUEUED, FAILED, SUCCEEDED, TIMED_OUT, CANCELED, or REJECTED).
forceCanceled (boolean) --
Will be true if the job execution was canceled with the optional force parameter set to true .
statusDetails (dict) --
A collection of name/value pairs that describe the status of the job execution.
detailsMap (dict) --
The job execution status.
(string) --
(string) --
thingArn (string) --
The ARN of the thing on which the job execution is running.
queuedAt (datetime) --
The time, in milliseconds since the epoch, when the job execution was queued.
startedAt (datetime) --
The time, in milliseconds since the epoch, when the job execution started.
lastUpdatedAt (datetime) --
The time, in milliseconds since the epoch, when the job execution was last updated.
executionNumber (integer) --
A string (consisting of the digits "0" through "9") which identifies this particular job execution on this particular device. It can be used in commands which return or update job execution information.
versionNumber (integer) --
The version of the job execution. Job execution versions are incremented each time they are updated by a device.
approximateSecondsBeforeTimedOut (integer) --
The estimated number of seconds that remain before the job execution status will be changed to TIMED_OUT .
{'status': ['TIMED_OUT']}Response
{'executionSummaries': {'jobExecutionSummary': {'status': ['TIMED_OUT']}}}
Lists the job executions for a job.
See also: AWS API Documentation
Request Syntax
client.list_job_executions_for_job( jobId='string', status='QUEUED'|'IN_PROGRESS'|'SUCCEEDED'|'FAILED'|'TIMED_OUT'|'REJECTED'|'REMOVED'|'CANCELED', maxResults=123, nextToken='string' )
string
[REQUIRED]
The unique identifier you assigned to this job when it was created.
string
The status of the job.
integer
The maximum number of results to be returned per request.
string
The token to retrieve the next set of results.
dict
Response Syntax
{ 'executionSummaries': [ { 'thingArn': 'string', 'jobExecutionSummary': { 'status': 'QUEUED'|'IN_PROGRESS'|'SUCCEEDED'|'FAILED'|'TIMED_OUT'|'REJECTED'|'REMOVED'|'CANCELED', 'queuedAt': datetime(2015, 1, 1), 'startedAt': datetime(2015, 1, 1), 'lastUpdatedAt': datetime(2015, 1, 1), 'executionNumber': 123 } }, ], 'nextToken': 'string' }
Response Structure
(dict) --
executionSummaries (list) --
A list of job execution summaries.
(dict) --
Contains a summary of information about job executions for a specific job.
thingArn (string) --
The ARN of the thing on which the job execution is running.
jobExecutionSummary (dict) --
Contains a subset of information about a job execution.
status (string) --
The status of the job execution.
queuedAt (datetime) --
The time, in milliseconds since the epoch, when the job execution was queued.
startedAt (datetime) --
The time, in milliseconds since the epoch, when the job execution started.
lastUpdatedAt (datetime) --
The time, in milliseconds since the epoch, when the job execution was last updated.
executionNumber (integer) --
A string (consisting of the digits "0" through "9") which identifies this particular job execution on this particular device. It can be used later in commands which return or update job execution information.
nextToken (string) --
The token for the next set of results, or null if there are no additional results.
{'status': ['TIMED_OUT']}Response
{'executionSummaries': {'jobExecutionSummary': {'status': ['TIMED_OUT']}}}
Lists the job executions for the specified thing.
See also: AWS API Documentation
Request Syntax
client.list_job_executions_for_thing( thingName='string', status='QUEUED'|'IN_PROGRESS'|'SUCCEEDED'|'FAILED'|'TIMED_OUT'|'REJECTED'|'REMOVED'|'CANCELED', maxResults=123, nextToken='string' )
string
[REQUIRED]
The thing name.
string
An optional filter that lets you search for jobs that have the specified status.
integer
The maximum number of results to be returned per request.
string
The token to retrieve the next set of results.
dict
Response Syntax
{ 'executionSummaries': [ { 'jobId': 'string', 'jobExecutionSummary': { 'status': 'QUEUED'|'IN_PROGRESS'|'SUCCEEDED'|'FAILED'|'TIMED_OUT'|'REJECTED'|'REMOVED'|'CANCELED', 'queuedAt': datetime(2015, 1, 1), 'startedAt': datetime(2015, 1, 1), 'lastUpdatedAt': datetime(2015, 1, 1), 'executionNumber': 123 } }, ], 'nextToken': 'string' }
Response Structure
(dict) --
executionSummaries (list) --
A list of job execution summaries.
(dict) --
The job execution summary for a thing.
jobId (string) --
The unique identifier you assigned to this job when it was created.
jobExecutionSummary (dict) --
Contains a subset of information about a job execution.
status (string) --
The status of the job execution.
queuedAt (datetime) --
The time, in milliseconds since the epoch, when the job execution was queued.
startedAt (datetime) --
The time, in milliseconds since the epoch, when the job execution started.
lastUpdatedAt (datetime) --
The time, in milliseconds since the epoch, when the job execution was last updated.
executionNumber (integer) --
A string (consisting of the digits "0" through "9") which identifies this particular job execution on this particular device. It can be used later in commands which return or update job execution information.
nextToken (string) --
The token for the next set of results, or null if there are no additional results.