flyte icon indicating copy to clipboard operation
flyte copied to clipboard

[BUG] Flyte v2 bug: RayJob name exceeds KubeRay's 47-char limit for nested (sub-action) Ray tasks

Open evan-sadler opened this issue 5 months ago • 2 comments

I ran into an issue with ray task nested inside a regular task. Claude says it found the bug in the source code and "fixed" it, so wanted to surface since it could be real.

Claude description

Flyte v2 bug: RayJob name exceeds KubeRay's 47-char limit for nested (sub-action) Ray tasks

TL;DR

When a Ray task runs as a sub-action (i.e. it is launched from a parent workflow/driver task rather than being the root action), Flyte's backend names the KubeRay RayJob object {run}-{action}-{attempt}. With the default auto-generated run name (20 chars) and a sub-action name (a fixed 25-char hash), the assembled name is 48 chars, which KubeRay rejects:

The RayJob metadata is invalid flyte/rqfn7vfrdp9j84q86stm-a0d7xyznuli5is847rvhzlkly-0: RayJob name should be no more than 47 characters

This causes the task to hang forever.

Environment

Flyte SDK flyte 2.5.4
Ray plugin flyteplugins-ray 2.5.4
Cluster sandbox-uc1 (org sandbox-uc1-flyte, project flytesnacks, domain development)
Ray operator KubeRay (RayJob CRD)
Repro workflow src/orthlyml/mlops/flyte/examples/ray_example.py

Code

``python
@ray_env.task
def ray_square_task(n: int = 10) -> list[int]:
    """Pure Ray compute: square ``0..n-1`` on the Ray cluster and return the results."""
    futures = [_square.remote(i) for i in range(n)]
    return ray.get(futures)


@env.task
def sum_list(values: list[int]) -> int:
    """Sum ``values`` (plus 1, just to make the reduce non-trivial)."""
    return sum(values) + 1


@env.task
def ray_workflow(n: int = 10) -> int:
    """Driver/entrypoint: square ``0..n-1`` on Ray, then reduce once."""
    squares = ray_square_task(n=n)
    return sum_list(values=squares)

evan-sadler avatar Jun 30 '26 21:06 evan-sadler

It seems likely that this is a real issue: KubeRay enforces a 47-character limit on RayJob names, and Flyte v2 composes RayJob names as {run}-{action}-{attempt}. For nested (sub-action) Ray tasks, the action name can be a 25-character hash, so with a 20-character run name and other delimiters, the total can exceed 47 characters, causing KubeRay to reject the job and the Flyte task to hang indefinitely. This behavior is described in your report and matches the RayJob naming logic and KubeRay's documented constraints (source, source).

My understanding is that this bug is not explicitly fixed in the latest Flyte or Ray plugin releases, and the workaround would be to ensure that the combined run and action names do not exceed the 47-character limit when launching Ray tasks as sub-actions. Would you like more detail on possible workarounds or how to track this issue upstream?

Sources:


This is an AI-generated response and your feedback is appreciated! Please leave a 👍 if this is helpful and 👎 if it is not.

Mention @herald to ask follow-up questions. See runllm.com for more!

runllm avatar Jun 30 '26 21:06 runllm

Yes, it's a valid issue. I don't think truncated the name directly is a good choice. Let me discuss with the team

machichima avatar Jul 16 '26 04:07 machichima