Skip to content

Commit

Permalink
saved modified cluster config with user's hashed token (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlewitt1 committed May 11, 2024
1 parent 76d805e commit 2ea74ff
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions runhouse/resources/hardware/on_demand_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,12 +424,6 @@ def up(self):
use_spot=self.use_spot,
)
)
if Path("~/.rh/config.yaml").expanduser().exists():
task.set_file_mounts(
{
"~/.rh/config.yaml": "~/.rh/config.yaml",
}
)
sky.launch(
task,
cluster_name=self.name,
Expand All @@ -440,6 +434,19 @@ def up(self):
self._update_from_sky_status()
self.restart_server()

# Save a limited version of the local ~/.rh config to the cluster with the user's hashed token
user_config = yaml.safe_dump(
{
"token": rns_client.cluster_token(
rns_client.token, rns_client.username
),
"username": rns_client.username,
"default_folder": rns_client.default_folder,
}
)
self.run([f"echo '{user_config}' > ~/.rh/config.yaml"])
logger.debug("Saved user config to cluster")

return self

def keep_warm(self, autostop_mins: int = -1):
Expand Down

0 comments on commit 2ea74ff

Please sign in to comment.