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

Fix: restartPolicy and limits #50

Merged
merged 3 commits into from
Aug 29, 2024
Merged

Conversation

lvarin
Copy link
Contributor

@lvarin lvarin commented Aug 28, 2024

  • If restart_policy but restartPolicy does not, uses the former to populate the later
  • If limits is empty, uses requests so limits == requests

Summary by Sourcery

Fix issues with task specification by ensuring 'restartPolicy' is set from 'restart_policy' when missing, and aligning 'limits' with 'requests' in container resources when 'limits' is not specified.

Bug Fixes:

  • Ensure 'restartPolicy' is populated from 'restart_policy' if the former is missing.
  • Set 'limits' to equal 'requests' in container resources if 'limits' is empty and 'requests' is not.

- If restart_policy but restartPolicy does not, uses the former to populate the later
- If limits is empty, uses requests so limits == requests
Copy link

sourcery-ai bot commented Aug 28, 2024

Reviewer's Guide by Sourcery

This pull request addresses two issues in the taskmaster.py file: it adds logic to use 'restart_policy' to populate 'restartPolicy' if the latter is missing, and it sets resource limits equal to requests when limits are not specified.

File-Level Changes

Change Details Files
Add fallback for missing 'restartPolicy'
  • Check if 'restartPolicy' is missing from the spec
  • Use 'restart_policy' to populate 'restartPolicy' if available
src/tesk_core/taskmaster.py
Set resource limits equal to requests when limits are not specified
  • Iterate through containers in the spec
  • Check if limits are None and requests are not None
  • Set limits equal to requests when limits are missing
src/tesk_core/taskmaster.py

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @lvarin - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding brief comments to explain the purpose of each change. This would help future maintainers understand the rationale behind these modifications.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@lvarin lvarin force-pushed the restartPolicy-limits-workaround branch from 705548b to c17fe8b Compare August 29, 2024 05:56
Copy link
Member

@trispera trispera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@trispera trispera merged commit f3ac7c2 into master Aug 29, 2024
10 checks passed
@trispera trispera deleted the restartPolicy-limits-workaround branch August 29, 2024 08:10
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.

2 participants