<#3177 Adds @task(resources)> Pull request opened ...
# flyte-github
c
#3177 Adds @task(resources) Pull request opened by thomasjpfan ## Tracking issue Related to flyteorg/flyte#6142 ## Why are the changes needed? Setting request and limits is directly is very verbose. With this PR we can do this: @task(resources=Resources(cpu=(1, 2), mem="1Gi")) def my_task(): ... The above will set the cpu request to 1, cpu limit to 2 and the memory request to 1Gi. Note this has basically the same API as modal: https://modal.com/docs/guide/resources ## What changes were proposed in this pull request? This PR adds support for tuples and list and
Resources
. Which means
Resources
is extended to define both the request and limits. This PR also adds checks to make sure functions that expected resources to be singular raise an error. Also, we also raise an error if
limits
or
requests
is used together with
resources
in
@task
. ## How was this patch tested? Unit tests were added to this PR. ### Summary by Bito This PR enhances Flyte's resource management by adding support for tuple/list specifications and refactoring the resource specification API for more intuitive usage. It updates resource configuration examples across Flytekit components to consistently use '1Gi' format for memory specifications instead of integers. The changes enforce stricter validation, streamline assertions, and ensure proper parameter usage for better API usability. Unit tests added: True Estimated effort to review (1-5, lower is better): 3 flyteorg/flytekit