You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow RayJobs to connect to existing RayClusters with different names #362
Is your feature request related to a problem? Please describe. The documentation for launching RayJobs shows the steps to first deploy a RayCluster with a given name (demo-slurm-ray). This spins up a RayCluster using the executor of choice. It then creates a RayJob with a new name (ie. demo-slurm-job). The RayJob code checks if there is a RayCluster with the same name as the RayJob and will run it in the existing cluster if so. Otherwise, if the cluster with the same name as the job doesn't exist, it will create a new ephemeral cluster specifically for that job.
There doesn't appear to be a way in the code to link a RayJob with an existing cluster, so users are forced to use the same name for their RayJob as the name of their RayCluster which isn't ideal as all jobs would have the same name.
Describe the solution you'd like
There should be a way to specify the existing RayCluster name if it doesn't already exist. For example, maybe there is a new cluster_name parameter to the RayJob base class which allows users to specify which cluster to try and connect to if it exists.
Describe alternatives you've considered
The RayJob could have another dependency on the RayCluster class so submitting jobs is one of the methods from within RayCluster, but that doesn't feel like a good solution.
Additional context
Add any other context or screenshots about the feature request here.
@roclark two findings from reading this path, the second one worse than the feature gap you filed. RayJob does already carry a cluster_name field (nemo_run/run/ray/job.py:48), but __post_init__ only forwards it to the backend when the executor is a LeptonExecutor, so on Slurm it is silently ignored and SlurmRayJob derives everything, its cluster_dir and the SlurmRayCluster(name=...) it creates, from the job name. That part is a straightforward plumb. The bigger issue is what happens when the names do line up: SlurmRayCluster.create builds the sbatch script including your job command, then checks whether a cluster of that name is already PENDING, RUNNING or CONFIGURING, and if so logs "Skipping creation" and returns None without ever submitting the command. SlurmRayJob.start then sets job_id = None and calls status(), which finds the pre-existing cluster's job id and prints a normal-looking status banner. So attaching to a live cluster does not run your job, it no-ops and looks like it worked. Making this work properly means submitting into a running cluster (a ray job submit against the head node) rather than baking the command into the cluster's sbatch script, which I cannot validate without a Slurm cluster and a live Ray head. Happy to write it if a maintainer confirms that shape is wanted, and the name plumbing is easy either way.
Opened #641 for the SlurmRayJob side of this (the name plumbing I flagged above). Also found and fixed something worse while tracing it: when a job with a cluster_name pointed at an already-running cluster, the command was silently never submitted; create() now raises instead of dropping it.
Didn't attempt the actual "submit into the already-running cluster" step (ray job submit against a live head node) since I don't have a Slurm + Ray setup to validate it, so for now pointing cluster_name at a busy cluster is a clear error rather than a no-op. Left that as a documented follow-up in the PR.
Activity
CodersAcademy006 commentedon Aug 19, 2026
@roclark two findings from reading this path, the second one worse than the feature gap you filed.
RayJobdoes already carry acluster_namefield (nemo_run/run/ray/job.py:48), but__post_init__only forwards it to the backend when the executor is aLeptonExecutor, so on Slurm it is silently ignored andSlurmRayJobderives everything, itscluster_dirand theSlurmRayCluster(name=...)it creates, from the job name. That part is a straightforward plumb. The bigger issue is what happens when the names do line up:SlurmRayCluster.createbuilds the sbatch script including your job command, then checks whether a cluster of that name is already PENDING, RUNNING or CONFIGURING, and if so logs "Skipping creation" and returnsNonewithout ever submitting the command.SlurmRayJob.startthen setsjob_id = Noneand callsstatus(), which finds the pre-existing cluster's job id and prints a normal-looking status banner. So attaching to a live cluster does not run your job, it no-ops and looks like it worked. Making this work properly means submitting into a running cluster (aray job submitagainst the head node) rather than baking the command into the cluster's sbatch script, which I cannot validate without a Slurm cluster and a live Ray head. Happy to write it if a maintainer confirms that shape is wanted, and the name plumbing is easy either way.CodersAcademy006 commentedon Oct 5, 2026
Opened #641 for the SlurmRayJob side of this (the name plumbing I flagged above). Also found and fixed something worse while tracing it: when a job with a cluster_name pointed at an already-running cluster, the command was silently never submitted; create() now raises instead of dropping it.
Didn't attempt the actual "submit into the already-running cluster" step (ray job submit against a live head node) since I don't have a Slurm + Ray setup to validate it, so for now pointing cluster_name at a busy cluster is a clear error rather than a no-op. Left that as a documented follow-up in the PR.