Flytekit Ray Plugin

raw JSON →
1.16.19 verified Fri May 01 auth: no python

This package provides Ray integration for Flyte workflows, enabling distributed execution on Ray clusters. Current version: 1.16.19. Released approximately monthly alongside flytekit core.

pip install flytekitplugins-ray
error ModuleNotFoundError: No module named 'flytekitplugins.ray'
cause The flytekitplugins-ray package is not installed.
fix
Run 'pip install flytekitplugins-ray'
error ImportError: cannot import name 'Ray' from 'flytekitplugins.ray'
cause The plugin version is too old (pre-1.12) or the import path has changed.
fix
Upgrade the package: 'pip install --upgrade flytekitplugins-ray'. If still fails, use 'from flytekitplugins.ray import RayExecutor' (old API).
error RAY_DASHBOARD_ADDRESS environment variable is set but incorrect
cause Ray cluster address misconfiguration when using RayJobConfig.
fix
Set correct address via RayJobConfig(address='auto') or proper cluster endpoint.
breaking In flytekit >=1.12, the Ray plugin API changed: use 'Ray' task_config instead of the old 'RayExecutor'.
fix Replace 'from flytekitplugins.ray import RayExecutor' with 'from flytekitplugins.ray import Ray' and adjust usage.
gotcha Ray initialization inside the task may conflict with the Flyte-managed Ray cluster. Avoid calling ray.init() in tasks that use RayJobConfig.
fix Do not call ray.init() if you are using RayJobConfig; Flyte handles cluster startup automatically.
deprecated The 'RayJobConfig' worker_groups parameter is being replaced by 'worker_group_spec' in future versions.
fix Use 'worker_group_spec' instead of 'worker_groups' when available, or check for deprecation warnings.

Basic Flyte task configured to run on Ray.

from flytekit import task, workflow
from flytekitplugins.ray import Ray, RayJobConfig

@task(task_config=Ray(job_config=RayJobConfig(worker_groups=[...])))
def my_ray_task() -> str:
    import ray
    ray.init()
    return "Ray task completed"

@workflow
def wf() -> str:
    return my_ray_task()

if __name__ == "__main__":
    print(wf())