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

Remove storage as a task resource option #4658

Conversation

Future-Outlier
Copy link
Member

@Future-Outlier Future-Outlier commented Jan 2, 2024

Tracking issue

Fixes #3955

Why are the changes needed?

Make the storage unused in the task resource option, so that users will not be confused about why they can define the storage but it didn't work.

What changes were proposed in this pull request?

  1. Delete storage variable
    search strings here
  • Resources_STORAGE
  • v1.ResourceStorage
  • TaskResourceSpec
  • tolStorage
    Search variable like this.
    image
  1. Left flytek8s/copilot.go as the same, I am not sure about how it works, so I left it the same.

How was this patch tested?

  1. run flytekit task with specified resource
  2. use kubectl describe nodeId to check if the Resources as expected

Success Scenario

from flytekit import task, Resources

@task(
        requests=Resources(cpu="2", ephemeral_storage="200Mi", mem="200Mi"),
)
def test_storage() -> None:
    import time
    print("@@@ I am sleeping for 10 seconds")
    time.sleep(10)
    return
pyflyte run --remote remove_resource_storage.py test_storage
kubectl describe pod ff436fac5f4d74583b75-f4wb3a3y-0 -n flytesnacks-development

The output is below.

    Limits:
      cpu:                2
      ephemeral-storage:  200Mi
      memory:             200Mi
    Requests:
      cpu:                2
      ephemeral-storage:  200Mi
      memory:             200Mi

image

Failure Scenario

from flytekit import task, Resources

@task(
        requests=Resources(cpu="2", storage="200Mi"),
)
def test_storage() -> None:
    import time
    print("@@@ I am sleeping for 10 seconds")
    time.sleep(10)
    return
pyflyte run --remote remove_resource_storage.py test_storage

image

Related PRs

flyteorg/flytekit#2078

Docs link

Signed-off-by: Future Outlier <[email protected]>
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request housekeeping Issues that help maintain flyte and keep it tech-debt free labels Jan 2, 2024
@Future-Outlier Future-Outlier marked this pull request as draft January 2, 2024 04:18
Copy link

codecov bot commented Jan 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (abef3f5) 58.54% compared to head (c92cbc2) 58.57%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4658      +/-   ##
==========================================
+ Coverage   58.54%   58.57%   +0.02%     
==========================================
  Files         625      624       -1     
  Lines       53669    53595      -74     
==========================================
- Hits        31423    31393      -30     
+ Misses      19731    19688      -43     
+ Partials     2515     2514       -1     
Flag Coverage Δ
unittests 58.57% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Signed-off-by: Future Outlier <[email protected]>
@Future-Outlier Future-Outlier changed the title [WIP] Remove storage as a task resource option Remove storage as a task resource option Jan 2, 2024
@Future-Outlier Future-Outlier marked this pull request as ready for review January 2, 2024 08:22
@Future-Outlier
Copy link
Member Author

@katrogan Please take a look, thanks a lot!

@katrogan
Copy link
Contributor

katrogan commented Jan 2, 2024

this is fantastic! cc @eapolinario for flytekit owners review

@Future-Outlier
Copy link
Member Author

Hi, @katrogan can we merge it?
thank you!

katrogan
katrogan previously approved these changes Jan 26, 2024
Copy link
Contributor

@katrogan katrogan left a comment

Choose a reason for hiding this comment

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

LGTM can we remove storage from here

if len(spec.Storage) > 0 {
result.Storage = parseQuantityNoError(ctx, "project", "storage", spec.Storage)
}
, and
if !taskResources.Defaults.Storage.IsZero() {
requests.Storage = taskResources.Defaults.Storage
}
and here too https://github.com/flyteorg/flyte/blob/master/flyteadmin/pkg/runtime/interfaces/task_resource_configuration.go#L9 to avoid any confusion?

cc @eapolinario

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 26, 2024
@Future-Outlier
Copy link
Member Author

LGTM can we remove storage from here

if len(spec.Storage) > 0 {
result.Storage = parseQuantityNoError(ctx, "project", "storage", spec.Storage)
}

, and

if !taskResources.Defaults.Storage.IsZero() {
requests.Storage = taskResources.Defaults.Storage
}

and here too https://github.com/flyteorg/flyte/blob/master/flyteadmin/pkg/runtime/interfaces/task_resource_configuration.go#L9 to avoid any confusion?
cc @eapolinario

I think the copilot will not be affected by it right?

@katrogan
Copy link
Contributor

hey @Future-Outlier what do you mean by "I think the copilot will not be affected by it right?" Sorry not entirely following!

@Future-Outlier
Copy link
Member Author

hey @Future-Outlier what do you mean by "I think the copilot will not be affected by it right?" Sorry not entirely following!

I was initially concerned that removing the Resource field in these three places might impact Copilot's service creation due to its use of Resource.
(However, after checking, Copilot is not affected!)

@Future-Outlier
Copy link
Member Author

LGTM can we remove storage from here

if len(spec.Storage) > 0 {
result.Storage = parseQuantityNoError(ctx, "project", "storage", spec.Storage)
}

, and

if !taskResources.Defaults.Storage.IsZero() {
requests.Storage = taskResources.Defaults.Storage
}

and here too https://github.com/flyteorg/flyte/blob/master/flyteadmin/pkg/runtime/interfaces/task_resource_configuration.go#L9 to avoid any confusion?
cc @eapolinario

Just remove all of them, thanks a lot!
8d5c0db

Copy link
Contributor

@katrogan katrogan 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 so much for verifying and refactoring all the tests!

@Future-Outlier Future-Outlier merged commit 00d0a81 into flyteorg:master Jan 30, 2024
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request housekeeping Issues that help maintain flyte and keep it tech-debt free lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Housekeeping] Remove storage as a task resource option
2 participants