Skip to content

Commit

Permalink
Execute setup when --detach-setup and no run section
Browse files Browse the repository at this point in the history
  • Loading branch information
Michaelvll committed Dec 3, 2024
1 parent 23f9821 commit 3818b1b
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions sky/backends/cloud_vm_ray_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ def add_prologue(self, job_id: int) -> None:
)
def get_or_fail(futures, pg) -> List[int]:
\"\"\"Wait for tasks, if any fails, cancel all unready.\"\"\"
if not futures:
return []
returncodes = [1] * len(futures)
# Wait for 1 task to be ready.
ready = []
Expand Down Expand Up @@ -3460,15 +3462,23 @@ def _execute(
Returns:
Job id if the task is submitted to the cluster, None otherwise.
"""
if task.run is None:
if task.run is None and self._setup_cmd is None:
logger.info('Run commands not specified or empty.')
return None
# Check the task resources vs the cluster resources. Since `sky exec`
# will not run the provision and _check_existing_cluster
# We need to check ports here since sky.exec shouldn't change resources
valid_resource = self.check_resources_fit_cluster(handle,
task,
check_ports=True)
if task.run is None:
# If the task has no run command, we still need to execute the
# generated ray driver program to run the setup command in detached
# mode.
# In this case, we don't need to check the resources.
valid_resource = sky.Resources()
else:
# Check the task resources vs the cluster resources. Since
# `sky exec` will not run the provision and _check_existing_cluster
# We need to check ports here since sky.exec shouldn't change
# resources.
valid_resource = self.check_resources_fit_cluster(handle,
task,
check_ports=True)
task_copy = copy.copy(task)
# Handle multiple resources exec case.
task_copy.set_resources(valid_resource)
Expand Down

0 comments on commit 3818b1b

Please sign in to comment.