list_jobs
(**kwargs)¶Lists jobs.
Requires permission to access the ListJobs action.
See also: AWS API Documentation
Request Syntax
response = client.list_jobs(
status='IN_PROGRESS'|'CANCELED'|'COMPLETED'|'DELETION_IN_PROGRESS'|'SCHEDULED',
targetSelection='CONTINUOUS'|'SNAPSHOT',
maxResults=123,
nextToken='string',
thingGroupName='string',
thingGroupId='string',
namespaceId='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.
Note
We recommend that you use continuous jobs instead of snapshot jobs for dynamic thing group targets. By using continuous jobs, devices that join the group receive the job execution even after the job has been created.
The namespace used to indicate that a job is a customer-managed job.
When you specify a value for this parameter, Amazon Web Services IoT Core sends jobs notifications to MQTT topics that contain the value in the following format.
$aws/things/THING_NAME/jobs/JOB_ID/notify-namespace-NAMESPACE_ID/
Note
The namespaceId
feature is in public preview.
dict
Response Syntax
{
'jobs': [
{
'jobArn': 'string',
'jobId': 'string',
'thingGroupId': 'string',
'targetSelection': 'CONTINUOUS'|'SNAPSHOT',
'status': 'IN_PROGRESS'|'CANCELED'|'COMPLETED'|'DELETION_IN_PROGRESS'|'SCHEDULED',
'createdAt': datetime(2015, 1, 1),
'lastUpdatedAt': datetime(2015, 1, 1),
'completedAt': datetime(2015, 1, 1),
'isConcurrent': True|False
},
],
'nextToken': 'string'
}
Response Structure
(dict) --
jobs (list) --
A list of jobs.
(dict) --
The job summary.
jobArn (string) --
The job ARN.
jobId (string) --
The unique identifier you assigned to this job when it was created.
thingGroupId (string) --
The ID of the thing group.
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 thing when the thing is added to a target group, even after the job was completed by all things originally in the group.
Note
We recommend that you use continuous jobs instead of snapshot jobs for dynamic thing group targets. By using continuous jobs, devices that join the group receive the job execution even after the job has been created.
status (string) --
The job summary status.
createdAt (datetime) --
The time, in seconds since the epoch, when the job was created.
lastUpdatedAt (datetime) --
The time, in seconds since the epoch, when the job was last updated.
completedAt (datetime) --
The time, in seconds since the epoch, when the job completed.
isConcurrent (boolean) --
Indicates whether a job is concurrent. Will be true when a job is rolling out new job executions or canceling previously created executions, otherwise false.
nextToken (string) --
The token for the next set of results, or null if there are no additional results.
Exceptions
IoT.Client.exceptions.InvalidRequestException
IoT.Client.exceptions.ResourceNotFoundException
IoT.Client.exceptions.ThrottlingException
IoT.Client.exceptions.ServiceUnavailableException