flytekit icon indicating copy to clipboard operation
flytekit copied to clipboard

Run command in pyflyte-fast-execute in the same process

Open thomasjpfan opened this issue 1 year ago • 8 comments

Why are the changes needed?

With this PR, pyflyte-fast-execute does not run the command in another process, which saves ~7 seconds.

What changes were proposed in this pull request?

With this PR, pyflyte-fast-execute will run pyflyte-map-execute and pyflyte-execute in the same process, which improves startup time. There is a FLYTE_FAST_EXECUTE_CMD_IN_NEW_PROCESS env var that triggers the previous behavior.

How was this patch tested?

I ran:

from flytekit import task


@task(container_image="localhost:30000/flytekit:0.1.3")
def hello(name: str) -> str:
    return f"Hello! {name}"

With pyflyte run --remote wf.py hello --name flyte, it took 8s:

SCR-20250103-nocr

With pyflyte run --remote --env FLYTE_FAST_EXECUTE_CMD_IN_NEW_PROCESS=1 wf.py hello --name flyte, which took 15 s:

SCR-20250103-noxh

Summary by Bito

This PR includes multiple changes: (1) pyflyte-fast-execute optimization with in-process command execution for ~7 second startup time gains, (2) new Environment class for task configurations, (3) VLLM integration and Optuna plugin, (4) improved package management with uv.lock and poetry.lock support, and (5) dependency updates including jinja2 upgrade to 3.1.5 and modified version constraints for grpcio packages.

Unit tests added: True

Estimated effort to review (1-5, lower is better): 5

thomasjpfan avatar Jan 03 '25 20:01 thomasjpfan