<#4026 [BUG] Failed to run rayjob in the sandbox> ...
# flyte-github
a
#4026 [BUG] Failed to run rayjob in the sandbox Issue created by pingsutw Describe the bug I can't run the Ray task in the sandbox, but it works if I run the same task in the EKS cluster.
Copy code
import typing

from flytekit import ImageSpec, Resources, task, workflow

custom_image = ImageSpec(
    registry="pingsutw",
    packages=["flytekitplugins-ray"],
)

if custom_image.is_container():
    import ray
    from flytekitplugins.ray import HeadNodeConfig, RayJobConfig, WorkerNodeConfig

@ray.remote
def f1(x):
    return x * x

@ray.remote
def f2(x):
    return x%2

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"
)

@task(cache=True, cache_version="0.2",
    task_config=ray_config,
    requests=Resources(mem="1Gi", cpu="1"),
    container_image=custom_image,
)
def ray_task(n: int) -> int:
    futures = [f2.remote(f1.remote(i)) for i in range(n)]
    return sum(ray.get(futures))


@workflow
def ray_workflow(n: int) -> int:
    return ray_task(n=n)


if __name__ == '__main__':
    ray_workflow(n=10)

```### 

### Expected behavior

Should be able to run a ray task in the sandbox

### Additional context to reproduce

_No response_

### Screenshots

```bash
(artifact) ➜  flyteidl git:(trigger) kgp -n flytesnacks-development
NAME                                                      READY   STATUS      RESTARTS   AGE
f0383f80a4dd84a7c84c-n0-3                                 0/1     Completed   0          64m
a42x4dp5xpgphrvhc6jb-n0-0-raycluster-lwh8r-head-pnbdl     1/1     Running     0          4m29s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-2fzxq   0/1     Error       0          4m29s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-k8dbr   0/1     Error       0          3m54s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-vh5j5   0/1     Error       0          3m37s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-phdqn   0/1     Error       0          3m19s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-7wrl2   0/1     Error       0          3m1s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-bcnxb   0/1     Error       0          2m44s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-tf7xg   0/1     Error       0          2m26s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-mvchf   0/1     Error       0          2m9s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-hsnls   0/1     Error       0          111s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-g4jc8   0/1     Error       0          94s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-44nkj   0/1     Error       0          77s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-snv59   0/1     Error       0          59s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-6p5dj   0/1     Error       0          41s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-2tzfd   0/1     Error       0          24s
gphrvhc6jb-n0-0-raycluster-lwh8r-worker-ray-group-lkw82   1/1     Running     0          7s
Copy code
export KUBERAY_VERSION=v0.5.2
kubectl create -k "<http://github.com/ray-project/kuberay/ray-operator/config/default?ref=${KUBERAY_VERSION}|github.com/ray-project/kuberay/ray-operator/config/default?ref=${KUBERAY_VERSION}>"
Are you sure this issue hasn't been raised already? ☑︎ Yes Have you read the Code of Conduct? ☑︎ Yes flyteorg/flyte