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

Batch.Client.describe_job_definitions parameter jobDefinitions doesn't work as described #2908

Closed
kurtwheeler opened this issue Jun 25, 2021 · 8 comments
Assignees
Labels
api-documentation service-api This issue is caused by the service API, not the SDK implementation.

Comments

@kurtwheeler
Copy link

kurtwheeler commented Jun 25, 2021

Describe the bug
The documentation for https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/batch.html#Batch.Client.describe_job_definitions says:

jobDefinitions (list) --
A list of up to 100 job definition names or full Amazon Resource Name (ARN) entries.

However it seems to only accept ARNs and providing job definition names doesn't work.

Steps to reproduce

job_definitions = batch.describe_job_definitions(jobDefinitions=["arn:aws:batch:us-east-1:589864003899:job-definition/kurt_dev_JANITOR:1199"], status="ACTIVE")

and

job_definitions = batch.describe_job_definitions(jobDefinitionName="kurt_dev_JANITOR", status="ACTIVE")

work but

job_definitions = batch.describe_job_definitions(jobDefinitions=["kurt_dev_JANITOR"], status="ACTIVE")

doesn't.

Expected behavior
As I am providing an exactly matching name for the job defintion, I would expect providing it in a list as the jobDefinitions parameter to work as well as it does when provided as the jobDefinitionName parameter since jobDefinitions says "A list of up to 100 job definition names or..."

@kurtwheeler kurtwheeler added the needs-triage This issue or PR still needs to be triaged. label Jun 25, 2021
@kdaily kdaily self-assigned this Jun 25, 2021
@kdaily kdaily added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Jun 25, 2021
@kdaily
Copy link
Member

kdaily commented Jun 25, 2021

Hi @kurtwheeler,

For some reason the job definition name must include the revision number. This is consistent whether providing an ARN or a job name. Try this, it should work:

job_definitions = batch.describe_job_definitions(jobDefinitions=["kurt_dev_JANITOR:1199"], status="ACTIVE")

Removing the revision from the ARN will return an empty list:

job_definitions = batch.describe_job_definitions(jobDefinitions=["arn:aws:batch:us-east-1:589864003899:job-definition/kurt_dev_JANITOR"], status="ACTIVE")

@kdaily kdaily added api-documentation service-api This issue is caused by the service API, not the SDK implementation. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Jun 25, 2021
@kdaily
Copy link
Member

kdaily commented Jun 25, 2021

I feel like this should be better documented, as the response comes back with a jobDefinitionName that does not include a revision number.

@kurtwheeler
Copy link
Author

I think it's further confusing because the jobDefinitionName parameter doesn't require a revision number.

It's a bit disappointing because my goal was actually to determine what revision numbers existed for those names, but perhaps it was an intentional API design decision to prevent 100 jobs with many revisions from ballooning into an enormous response.

Thanks for looking into this and responding so quickly!

@kdaily
Copy link
Member

kdaily commented Jun 28, 2021

I'll update here when I get a response from the AWS Batch team. In the meantime I don't see another solution to return all revisions for multiple job definitions in batch (pun intended).

V389609372

@kdaily
Copy link
Member

kdaily commented Jun 29, 2021

Hi @kurtwheeler,

I heard back from the Batch team. We're in agreement that the documentation could use clarification.

The current support when using the jobDefinitions parameter list is for revisions to be supplied. The only way currently to get all revisions for multiple job definitions is to request each one individually.

Since this is not an issue with the Python SDK, I'm going to close this issue and open up a tracking issue for the documentation update in the aws/aws-sdk repository, and will link them for reference.

If you can provide more details about your use case, I'd be happy to provide it to the Batch team for evidence for a feature like this.

@kdaily kdaily added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jun 29, 2021
@kurtwheeler
Copy link
Author

kurtwheeler commented Jun 29, 2021

Wow! Thanks for doing all that! I love to see that the documentation will be clarified.

The only way currently to get all revisions for multiple job definitions is to request each one individually.

I don't really think this is too big of an issue. It just is an extra request to make in an extra level of a loop but one I've already fixed in https://github.com/AlexsLemonade/refinebio/blob/fab031300fcadd670e27cd61ef2829f150082f04/infrastructure/deregister_batch_job_definitions.py

My use case is during my deployment. I use terraform to manage most of my AWS infrastructure, but I manage the job definitions using boto3. Because any given deploy could add, remove, or change any number of job definitions I deregister all of them, regenerate JSON specifications for them based on templates, and then register them.

@github-actions github-actions bot removed the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jun 29, 2021
@kdaily
Copy link
Member

kdaily commented Jul 1, 2021

Closing in lieu of aws/aws-sdk#94.

@kdaily kdaily closed this as completed Jul 1, 2021
@github-actions
Copy link

github-actions bot commented Jul 1, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-documentation service-api This issue is caused by the service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

2 participants