-
Notifications
You must be signed in to change notification settings - Fork 610
Description
Search before asking
- I searched the issues and found no similar issues.
KubeRay Component
ray-operator
What happened + What you expected to happen
I created a RayJob with the following YAML:
apiVersion: ray.io/v1
kind: RayJob
metadata:
name: rayjob-bug
spec:
entrypoint: echo aaa ; python /home/ray/samples/sample_code.py test1 -arg1 '(select a from t1)'
When the entrypoint contains a semicolon (;), the command is not properly escaped, which causes the RayJob to fail after submission with the following error:
python: can't open file '/home/ray/samples/sample_code.py': [Errno 2] No such file or directory
The semicolon seems to be treated as a shell command separator, causing echo aaa and python ... to be interpreted as two separate shell commands, and not passed correctly into the job container.
I expected the full entrypoint to be executed as a single shell command, like:
echo aaa ; python /home/ray/samples/sample_code.py test1 -arg1 '(select a from t1)'
When I manually escape the semicolon as:
entrypoint: echo aaa \; python /home/ray/samples/sample_code.py test1 -arg1 '(select a from t1)'
the job works as expected.
Should the RayJob operator automatically shell-escape the entrypoint content to prevent such issues?
Or should users always be responsible for manually quoting or escaping complex shell commands?
Let me know if this is intended behavior or a candidate for improvement.
Reproduction script
apiVersion: ray.io/v1
kind: RayJob
metadata:
name: rayjob-bug
spec:
entrypoint: echo aaa ; python /home/ray/samples/sample_code.py test1 -arg1 '(select a from t1)'
runtimeEnv:
envVars:
PYTHONUNBUFFERED: "1"
rayClusterSpec:
rayVersion: "2.9.3"
headGroupSpec:
serviceType: ClusterIP
template:
spec:
containers:
- name: ray-head
image: rayproject/ray:2.9.3
command: ["/bin/bash", "-c", "--"]
args: ["trap : TERM INT; sleep infinity & wait"]
workerGroupSpecs: []
Expected behavior: should execute both echo aaa and the python ... line
Actual behavior: fails with python: can't open file ... because ; was treated as a separator.
Reproducible YAML Example (Works with escaped semicolon)
entrypoint: echo aaa \; python /home/ray/samples/sample_code.py test1 -arg1 '(select a from t1)'
kubectl apply -f rayjob-bug.yaml
kubectl get rayjobs.ray.io -w
kubectl logs -l job-name=rayjob-bug
Anything else
No response
Are you willing to submit a PR?
- Yes I am willing to submit a PR!