Skip to content

Commit

Permalink
Properly override allowed cluster factory arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
carolineechen committed Dec 11, 2024
1 parent 5987483 commit 6e73be4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions runhouse/resources/hardware/cluster_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ def cluster(
# If the the user changed the image and wants to restart the server to apply the new
# changes, we need to update the image in the cluster object
c.image = image or c.image
if kwargs.get("autostop_mins") and c.autostop_mins != kwargs.get(
"autostop_mins"
):
c.autostop_mins = kwargs.get("autostop_mins")
if launcher:
c.launcher = launcher
if den_auth:
c.save()
return c
Expand Down Expand Up @@ -443,6 +449,9 @@ def ondemand_cluster(
# If the the user changed the image and wants to restart the server to apply the new
# changes, we need to update the image in the cluster object
c.image = image or c.image
if autostop_mins and autostop_mins != c.autostop_mins:
c.autostop_mins = autostop_mins
c.launcher = launcher or c.launcher
if den_auth:
c.save()
return c
Expand Down
3 changes: 3 additions & 0 deletions runhouse/resources/hardware/on_demand_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ def autostop_mins(self):
@autostop_mins.setter
def autostop_mins(self, mins):
self._autostop_mins = mins
if not self.is_up():
return

if self.on_this_cluster():
obj_store.set_cluster_config_value("autostop_mins", mins)
else:
Expand Down

0 comments on commit 6e73be4

Please sign in to comment.