Skip to content

Warn user when overriding requests but not limits#2151

Merged
fg91 merged 2 commits into
masterfrom
fg91/warn-request-overrides
Jan 31, 2024
Merged

Warn user when overriding requests but not limits#2151
fg91 merged 2 commits into
masterfrom
fg91/warn-request-overrides

Conversation

@fg91

@fg91 fg91 commented Jan 30, 2024

Copy link
Copy Markdown
Member

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.

Signed-off-by: Fabio Grätz <fabiogratz@googlemail.com>
@codecov

codecov Bot commented Jan 30, 2024

Copy link
Copy Markdown

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 <fabiogratz@googlemail.com>

@pingsutw pingsutw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you

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