cuddly-jelly-27016
02/18/2025, 7:42 PM.python_history from the Ray runtime environment.
How was this patch tested?
import typing
from flytekit import ImageSpec, Resources, task, workflow
ray_plugins = f"git+https://github.com/flyteorg/flytekit.git@c6e6051e8a3b76c854921d73d52a030f367b5923#subdirectory=plugins/flytekit-ray"
custom_image = ImageSpec(
registry="ghcr.io/flyteorg",
packages=[ray_plugins, "mypy"],
# kuberay operator needs wget for readiness probe.
apt_packages=["wget", "git"],
)
import ray
from flytekitplugins.ray import HeadNodeConfig, RayJobConfig, WorkerNodeConfig
@ray.remote
def f(x):
return x * x
ray_config = RayJobConfig(
head_node_config=HeadNodeConfig(ray_start_params={"log-color": "True"}),
worker_node_config=[WorkerNodeConfig(group_name="ray-group", replicas=1)],
runtime_env={"pip": ["numpy", "pandas"]}, # or runtime_env="./requirements.txt"
enable_autoscaling=True,
shutdown_after_job_finishes=True,
ttl_seconds_after_finished=3600,
)
@task(
task_config=ray_config,
requests=Resources(mem="2Gi", cpu="2"),
container_image=custom_image,
)
def ray_task(n: int) -> typing.List[int]:
futures = [f.remote(i) for i in range(n)]
return ray.get(futures)
@workflow
def ray_workflow(n: int) -> typing.List[int]:
return ray_task(n=n)
Setup process
Screenshots
Check all the applicable boxes
• I updated the documentation accordingly.
• All new and existing tests passed.
• All commits are signed-off.
Related PRs
NA
Docs link
NA
Summary by Bito
Fixed a critical bug in Ray plugin for Flytekit where tasks were failing due to permission issues with .python_history file. The fix involves adding .python_history to the excluded files list in Ray runtime environment configuration, preventing RuntimeEnvSetupError during cluster uploads.
Unit tests added: False
Estimated effort to review (1-5, lower is better): 1
flyteorg/flytekitcuddly-jelly-27016
02/19/2025, 8:31 PM