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] Reuse same literals in the dynamic task #6032

Open
2 tasks done
pingsutw opened this issue Nov 19, 2024 · 1 comment
Open
2 tasks done

[Core feature] Reuse same literals in the dynamic task #6032

pingsutw opened this issue Nov 19, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request flytekit FlyteKit Python related issue good first issue Good for newcomers

Comments

@pingsutw
Copy link
Member

Motivation: Why do you think this is important?

Running this workflow will upload the input df of conc_prediction 15x with different filenames to the connected blob storage. Each instance of predict_wf gets his own version of input.

@task()
def load_model(name: str) -> pd.DataFrame:
    return pd.DataFrame({name: [1, 2, 3, 4, 5]})


@task()
def predict_df(model: pd.DataFrame, n: int):
    print(model)
    print(n)


@workflow
def predict_wf(n: int, model: pd.DataFrame):
    predict_df(model=model, n=n)


@dynamic()
def conc_prediction(input: pd.DataFrame):
    for n in range(1, 15):
        predict_wf(model=input, n=n)


@workflow
def wf():
    output = load_model(name="foo")
    conc_prediction(input=output)

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

We should only serialize the Pandas dataframe and upload it once. Each predict_wf should reuse the same input (parquet file).

We could probably add a local cache for the dynamic workflow. If the Python value has already been serialized, we can just load the literal from the cache

Describe alternatives you've considered

NA

Propose: Link/Inline OR Additional context

NA

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

  • Yes

Have you read the Code of Conduct?

  • Yes
@pingsutw pingsutw added enhancement New feature or request untriaged This issues has not yet been looked at by the Maintainers labels Nov 19, 2024
@pingsutw pingsutw added flytekit FlyteKit Python related issue good first issue Good for newcomers and removed untriaged This issues has not yet been looked at by the Maintainers labels Nov 19, 2024
@davidlin20dev
Copy link
Contributor

#take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request flytekit FlyteKit Python related issue good first issue Good for newcomers
Projects
Status: No status
Development

No branches or pull requests

2 participants