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

Warn user when overriding requests but not limits #2151

Merged
merged 2 commits into from
Jan 31, 2024

Conversation

fg91
Copy link
Member

@fg91 fg91 commented Jan 30, 2024

Why are the changes needed?

@task(
    requests=Resources(
        cpu="3",
        mem="3Gi",
    ),
)
def foo():
    ...



@workflow
def my_wf():
    foo().with_overrides(
        requests=Resources(
            cpu="5",
            mem="5Gi",
        ),
    )

As a user, I would expect that the resulting task pod has 5 vCPUs and 5Gi or RAM. Turns out, the task pod has 3 each!

This behaviour is very unintuitive, the reason being as follows:

  • When one doesn't explicitly set limits on a task, the requests are taken as limits as well.
  • When one only overrides the requests, the requests are clamped to the old limits in the backend.

What changes were proposed in this pull request?

In this PR I add a warning so that at least users are warned to set limit as well.

How was this patch tested?

Running the above workflow with pyflyte -v run --remote ... results in the following new log line:

Requests overridden on node n0 (<FlyteLiteral name: "foo" retries { }>) without specifying limits. Requests are clamped to original limits.

The fact that -v is required to see this warning unfortunately limits its usefulness. Maybe this warrants a discussion whether this behaviour should be changed.

Copy link

codecov bot commented Jan 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1789db9) 50.76% compared to head (5abeeef) 85.80%.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2151       +/-   ##
===========================================
+ Coverage   50.76%   85.80%   +35.03%     
===========================================
  Files         176      313      +137     
  Lines       17116    23581     +6465     
  Branches     3530     3531        +1     
===========================================
+ Hits         8689    20233    +11544     
+ Misses       8000     2738     -5262     
- Partials      427      610      +183     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Fabio Grätz <[email protected]>
Copy link
Member

@pingsutw pingsutw left a comment

Choose a reason for hiding this comment

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

Thank you

@fg91 fg91 merged commit f89ed36 into master Jan 31, 2024
84 checks passed
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.

3 participants