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

Replace "Max spot instance requests per region" limit with vCPU-based limits #547

Merged
merged 2 commits into from
Aug 4, 2021

Conversation

TagadaPoe
Copy link
Contributor

@TagadaPoe TagadaPoe commented Jun 16, 2021

Summary

BREAKING CHANGE

As mentioned in issue #502, the limit "Max spot instance requests per region" was removed from AWS and replaced by the following limits, based on the number of vCPU:

  • All F Spot Instance Requests
  • All G Spot Instance Requests
  • All Inf Spot Instance Requests
  • All P Spot Instance Requests
  • All Standard (A, C, D, H, I, M, R, T, Z) Spot Instance Requests
  • All X Spot Instance Requests

As a result, the usage reported by awslimitchecker is not relevant anymore.

In order to fix this, this commit replaces the call to the EC2 API describe_spot_instance_requests() with a call to the CloudWatch API, since the usage of Spot requests vCPUs is now available as a metric in CloudWatch.

In addition, the applied limits are now retrieved from the Service Quotas service.

Pull Request Checklist

  • All pull requests should be against the develop branch, not master.
  • All pull requests must include the Contributor License Agreement (see below).
  • Whether or not your PR includes unit tests:
    • Please make sure you have run the exact code contained in the PR locally, and it functions as desired.
    • Please make sure the TravisCI build passes or, if not, you've corrected any obvious problems identified by the tests.
  • Code should conform to the Development Guidelines:
    • pep8 compliant with some exceptions (see pytest.ini)
    • 100% test coverage with pytest (with valid tests). If you have difficulty
      writing tests for the code, that's fine, just mention that in the summary and either
      ask for assistance, or clarify that you'd like someone else to handle the tests. PRs that
      include complete test coverage will usually be merged faster.
    • Complete, correctly-formatted documentation for all classes, functions and methods.
    • documentation has been rebuilt with tox -e docs
    • Connections to the AWS services should only be made by the class's
      connect() and connect_resource() methods, inherited from
      awslimitchecker.connectable.Connectable
    • All modules should have (and use) module-level loggers.
    • Commit messages should be meaningful, and reference the Issue number
      if you're working on a GitHub issue (i.e. "issue #x - "). Please
      refrain from using the "fixes #x" notation unless you are sure that the
      the issue is fixed in that commit.
    • Git history is fully intact; please do not squash or rewrite history.

Contributor License Agreement

By submitting this work for inclusion in awslimitchecker, I agree to the following terms:

  • The contribution included in this request (and any subsequent revisions or versions of it)
    is being made under the same license as the awslimitchecker project (the Affero GPL v3,
    or any subsequent version of that license if adopted by awslimitchecker).
  • My contribution may perpetually be included in and distributed with awslimitchecker; submitting
    this pull request grants a perpetual, global, unlimited license for it to be used and distributed
    under the terms of awslimitchecker's license.
  • I have the legal power and rights to agree to these terms.

@TagadaPoe TagadaPoe marked this pull request as draft June 16, 2021 08:26
@TagadaPoe TagadaPoe marked this pull request as ready for review June 16, 2021 09:30
@TagadaPoe TagadaPoe changed the base branch from master to develop June 16, 2021 09:40
@jantman
Copy link
Owner

jantman commented Jul 9, 2021

@TagadaPoe I'm going to try to get to these PRs today, sorry for the delay. Could you please update your PR to allow changes from maintainers? This needs to be rebased on develop, and the others will need to be rebased as I merge them in. Thanks!

@jantman
Copy link
Owner

jantman commented Jul 9, 2021

@TagadaPoe The code here looks good to me, but I'm a little confused by the default limits? In this PR I see the defaults as mostly 128 or 64, but at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-limits.html they seem to be much lower, i.e. 11 or 16 for many. Would you be so kind as to explain... I think I'm missing something here, or confused.

@TagadaPoe
Copy link
Contributor Author

@TagadaPoe I'm going to try to get to these PRs today, sorry for the delay. Could you please update your PR to allow changes from maintainers? This needs to be rebased on develop, and the others will need to be rebased as I merge them in. Thanks!

I cannot see the "Allow edits from maintainers" link, is this because the PR is already in the "jantman/awslimitchecker repository" ?

@TagadaPoe
Copy link
Contributor Author

@TagadaPoe The code here looks good to me, but I'm a little confused by the default limits? In this PR I see the defaults as mostly 128 or 64, but at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-limits.html they seem to be much lower, i.e. 11 or 16 for many. Would you be so kind as to explain... I think I'm missing something here, or confused.

I fixed that, I am not sure where I took those values from...

@codecov-commenter
Copy link

codecov-commenter commented Jul 12, 2021

Codecov Report

Merging #547 (bbeced3) into develop (a829ce2) will not change coverage.
The diff coverage is 100.00%.

❗ Current head bbeced3 differs from pull request most recent head cbe9040. Consider uploading reports for the commit cbe9040 to get more accurate results
Impacted file tree graph

@@            Coverage Diff            @@
##           develop      #547   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           42        42           
  Lines         3030      3025    -5     
  Branches       455       453    -2     
=========================================
- Hits          3030      3025    -5     
Impacted Files Coverage Δ
awslimitchecker/services/ec2.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a829ce2...cbe9040. Read the comment docs.

… limits

BREAKING CHANGE

As mentioned in issue jantman#502, the limit "Max spot instance requests per region" was removed from AWS and replaced by the following limits, based on the number of vCPU:
- All F Spot Instance Requests
- All G Spot Instance Requests
- All Inf Spot Instance Requests
- All P Spot Instance Requests
- All Standard (A, C, D, H, I, M, R, T, Z) Spot Instance Requests
- All X Spot Instance Requests

As a result, the usage reported by awslimitchecker is not relevant anymore.

In order to fix this, this commit replaces the call to the EC2 API describe_spot_instance_requests() with a call to the CloudWatch API, since the usage of Spot requests vCPUs is now available as a metric in CloudWatch.

In addition, the applied limits are now retrieved from the Service Quotas service.
@antonincms
Copy link

antonincms commented Jul 22, 2021

Hello @jantman, as said by @TagadaPoe we couldn't find the option to allow you to rebase our branch.
Maybe this is related to some parameters in our org or something else.

Anyway, I rebased all three branches, don't hesitate to ping me if you need rebasing or anything else.

@jantman jantman merged commit 1db57f6 into jantman:develop Aug 4, 2021
@jantman
Copy link
Owner

jantman commented Aug 4, 2021

Thank you so much for this, and apologies for the delay in merging it!

jantman added a commit that referenced this pull request Aug 4, 2021
@antonincms antonincms deleted the fix/spotrequests branch August 4, 2021 11:54
@jantman
Copy link
Owner

jantman commented Aug 4, 2021

This has been released in 12.0.0, which is now live on PyPI and Docker Hub. Thank you so much, and apologies for the delay!

derrix060 pushed a commit to derrix060/awslimitchecker that referenced this pull request Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants