Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws iot list-jobs doesn't return SCHEDULED jobs when passing --thing-group-name #8924

Closed
IskanderNovena opened this issue Sep 16, 2024 · 4 comments
Assignees
Labels
bug This issue is a bug. iot p2 This is a standard priority issue service-api This issue is due to a problem in a service API, not the SDK implementation.

Comments

@IskanderNovena
Copy link

IskanderNovena commented Sep 16, 2024

Describe the bug

When running aws iot list-jobs, all jobs are listed.
When targeting a specific thing group, by passing the parameter --thing-group-name, scheduled jobs are NOT listed.

Expected Behavior

I expect the aws iot list-jobs --thing-group-name THINGGROUP to include ALL jobs targeted at the specified Thing group.

Current Behavior

Currently it seems like only active (as in currently running/IN_PROGRESS) jobs are returned when specifying --thing-group-name

Reproduction Steps

I've created a Thing Group THINGGROUP and created two jobs targeted at that group:
A continuous scheduled job, and a snapshot job.

❯ aws iot list-jobs | grep THINGGROUP
            "jobArn": "arn:aws:iot:AWS_REGION:098765432123:job/THINGGROUP-testing-hotfix",
            "jobId": "THINGGROUP-testing-hotfix",
            "jobArn": "arn:aws:iot:AWS_REGION:098765432123:job/THINGGROUP-testing-scheduled",
            "jobId": "THINGGROUP-testing-scheduled",


❯ aws iot list-jobs --thing-group-name THINGGROUP
{
    "jobs": [
        {
            "jobArn": "arn:aws:iot:AWS_REGION:098765432123:job/THINGGROUP-testing-hotfix",
            "jobId": "THINGGROUP-testing-hotfix",
            "thingGroupId": "8f7f92c6-46c0-46ef-b7d8-282f4a18d0d6",
            "targetSelection": "SNAPSHOT",
            "status": "IN_PROGRESS",
            "createdAt": "2024-09-16T17:38:06.627000+02:00",
            "lastUpdatedAt": "2024-09-16T17:38:12.756000+02:00",
            "isConcurrent": false
        }
    ]
}

❯ aws iot describe-job --job-id THINGGROUP-testing-scheduled
{
    "job": {
        "jobArn": "arn:aws:iot:AWS_REGION:098765432123:job/THINGGROUP-testing-scheduled",
        "jobId": "THINGGROUP-testing-scheduled",
        "targetSelection": "CONTINUOUS",
        "status": "SCHEDULED",
        "targets": [
            "arn:aws:iot:AWS_REGION:098765432123:thinggroup/THINGGROUP"
        ],
        "description": "A managed job template for rebooting the device.",
        "presignedUrlConfig": {},
        "jobExecutionsRolloutConfig": {
            "maximumPerMinute": 1000
        },
        "createdAt": "2024-09-16T17:36:41.141000+02:00",
        "lastUpdatedAt": "2024-09-16T17:36:41.141000+02:00",
        "jobProcessDetails": {
            "numberOfCanceledThings": 0,
            "numberOfSucceededThings": 0,
            "numberOfFailedThings": 0,
            "numberOfRejectedThings": 0,
            "numberOfQueuedThings": 0,
            "numberOfInProgressThings": 0,
            "numberOfRemovedThings": 0,
            "numberOfTimedOutThings": 0
        },
        "timeoutConfig": {},
        "jobTemplateArn": "arn:aws:iot:AWS_REGION::jobtemplate/AWS-Reboot:1.0",
        "documentParameters": {
            "pathToHandler": "default",
            "runAsUser": "root"
        },
        "schedulingConfig": {
            "startTime": "2024-09-17T22:00",
            "maintenanceWindows": [
                {
                    "startTime": "cron(0 2 ? * WED *)",
                    "durationInMinutes": 120
                }
            ]
        },
        "scheduledJobRollouts": [
            {
                "startTime": "2024-09-18T02:00"
            },
            {
                "startTime": "2024-09-25T02:00"
            },
            {
                "startTime": "2024-10-02T02:00"
            },
            {
                "startTime": "2024-10-09T02:00"
            },
            {
                "startTime": "2024-10-16T02:00"
            },
            {
                "startTime": "2024-10-23T02:00"
            },
            {
                "startTime": "2024-10-30T02:00"
            }
        ]
    }
}

❯ aws iot describe-job --job-id THINGGROUP-testing-hotfix
{
    "job": {
        "jobArn": "arn:aws:iot:AWS_REGION:098765432123:job/THINGGROUP-testing-hotfix",
        "jobId": "THINGGROUP-testing-hotfix",
        "targetSelection": "SNAPSHOT",
        "status": "IN_PROGRESS",
        "targets": [
            "arn:aws:iot:AWS_REGION:098765432123:thinggroup/THINGGROUP"
        ],
        "description": "A managed job template for rebooting the device.",
        "presignedUrlConfig": {},
        "jobExecutionsRolloutConfig": {
            "maximumPerMinute": 1000
        },
        "createdAt": "2024-09-16T17:38:06.627000+02:00",
        "lastUpdatedAt": "2024-09-16T17:38:12.756000+02:00",
        "jobProcessDetails": {
            "numberOfCanceledThings": 0,
            "numberOfSucceededThings": 0,
            "numberOfFailedThings": 0,
            "numberOfRejectedThings": 0,
            "numberOfQueuedThings": 1,
            "numberOfInProgressThings": 0,
            "numberOfRemovedThings": 0,
            "numberOfTimedOutThings": 0
        },
        "timeoutConfig": {},
        "jobTemplateArn": "arn:aws:iot:AWS_REGION::jobtemplate/AWS-Reboot:1.0",
        "documentParameters": {
            "pathToHandler": "default",
            "runAsUser": "root"
        },
        "isConcurrent": false,
        "schedulingConfig": {}
    }
}

Possible Solution

No response

Additional Information/Context

Using Boto3 gives the same results when passing a Thing group name. So it might be an API issue and not specifically an AWS CLI issue.

CLI version used

aws-cli/2.17.51 Python/3.11.9 Darwin/23.6.0 exe/x86_64

Environment details (OS name and version, etc.)

Darwin laptop 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64

@IskanderNovena IskanderNovena added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 16, 2024
@tim-finnigan tim-finnigan self-assigned this Sep 18, 2024
@tim-finnigan tim-finnigan added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Sep 18, 2024
@tim-finnigan
Copy link
Contributor

Thanks for reaching out. I could reproduce this behavior, and agree that it appears to be an issue with the API rather than directly with the CLI. I'm going to reach out to the IoT team regarding this issue, as they maintain the ListJobs API. And if this behavior is expected, then I think the reasons why should be clarified in the documentation.

@tim-finnigan tim-finnigan changed the title was not list-jobs doesn't list scheduled jobs when passing thing-group-name aws iot list-jobs doesn't return SCHEDULED jobs when passing --thing-group-name Sep 18, 2024
@tim-finnigan tim-finnigan added service-api This issue is due to a problem in a service API, not the SDK implementation. iot p2 This is a standard priority issue and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. needs-triage This issue or PR still needs to be triaged. labels Sep 18, 2024
@tim-finnigan
Copy link
Contributor

Quick update: the service team confirmed the issue and is working on a fix.

@tim-finnigan
Copy link
Contributor

A fix was merged and is pending a code push by the IoT team. I'll close this as there's no action to be taken on the AWS CLI side. You can refer to the CHANGELOG for tracking updates going forward.

Copy link

github-actions bot commented Nov 4, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. iot p2 This is a standard priority issue service-api This issue is due to a problem in a service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

2 participants