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

[Core feature] list support for partials (map_task) #4325

Open
2 tasks done
klekass opened this issue Oct 30, 2023 · 1 comment
Open
2 tasks done

[Core feature] list support for partials (map_task) #4325

klekass opened this issue Oct 30, 2023 · 1 comment
Assignees
Labels
backlogged For internal use. Reserved for contributor team workflow. enhancement New feature or request flytekit FlyteKit Python related issue

Comments

@klekass
Copy link

klekass commented Oct 30, 2023

Motivation: Why do you think this is important?

Currently partial functions with lists bound to an argument do not work in conjunction with map_tasks. See the following example:

@task
def demo_task(strings: List[str], num: int) -> str:
    return f"{num}".join(strings)

@workflow
def demo_wf(strings: List[str], nums: List[int]) -> None:
    map_task(functools.partial(demo_task, strings=strings))(num=nums)

This example works only if the length of strings is equal to the length of nums. This limitation seems arbitrary to the user and should either not be supported at all or support lists of different sizes aswell. This feature request aims for the latter.

Goal: What should the final outcome look like, ideally?

Given the example:

@task
def demo_task(strings: List[str], num: int) -> str:
    return f"{num}".join(strings)

@workflow
def demo_wf(strings: List[str], nums: List[int]) -> None:
    map_task(functools.partial(demo_task, strings=strings))(num=nums)

Input: ["a", "b", "c"], [1, 2]
Output: ["a1b1c", "a2b2c"]

Describe alternatives you've considered

As an alternative, the old pattern of input/output preparation tasks can be used, which the partial task aimed to eliminate.

Propose: Link/Inline OR Additional context

No response

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@klekass klekass added enhancement New feature or request untriaged This issues has not yet been looked at by the Maintainers labels Oct 30, 2023
@eapolinario eapolinario added backlogged For internal use. Reserved for contributor team workflow. flytekit FlyteKit Python related issue and removed untriaged This issues has not yet been looked at by the Maintainers labels Nov 2, 2023
@eapolinario eapolinario self-assigned this Nov 2, 2023
@eapolinario
Copy link
Contributor

We don't expose which arguments are partials in flyteidl (so the backend cannot know which ones are already evaluated).

@pvditt pvditt assigned pvditt and unassigned eapolinario Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlogged For internal use. Reserved for contributor team workflow. enhancement New feature or request flytekit FlyteKit Python related issue
Projects
None yet
Development

No branches or pull requests

3 participants