Skip to content

Commit 0182a25

Browse files
committed
changes to restart function
- allow setting tag to restart function
1 parent 26c4ee7 commit 0182a25

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

scripts/launch-nodes/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,17 @@ Once the configuration file is ready, make the python script executable and run
8888

8989
```bash
9090
chmod +x manage_subspace.py
91-
python manage_subspace.py --config nodes.toml --release_version gemini-3h-2024-sep-17 --subspace_dir /home/ubuntu/subspace/subspace \
92-
--pot_external_entropy random_value --network gemini-3h --plot_size 10G --cache-percentage 15
91+
python manage_subspace.py --config nodes.toml --release_version docker-tag --subspace_dir /home/ubuntu/subspace/subspace \
92+
--pot_external_entropy random_value --network gemini-3h --plot_size 10G --cache_percentage 15
9393
9494
# prune images
95-
python manage_subspace.py --config nodes.toml --release_version gemini-3h-2024-sep-17 --subspace_dir /home/ubuntu/subspace/subspace --prune
95+
python manage_subspace.py --config nodes.toml --subspace_dir /home/ubuntu/subspace/subspace --prune
9696
9797
# restart stack
98-
python manage_subspace.py --config nodes.toml --release_version gemini-3h-2024-sep-17 --subspace_dir /home/ubuntu/subspace/subspace --restart
98+
python manage_subspace.py --config nodes.toml --subspace_dir /home/ubuntu/subspace/subspace --restart
9999
100+
# restart stack with new docker tag
101+
python manage_subspace.py --config nodes.toml --release_version docker-tag --subspace_dir /home/ubuntu/subspace/subspace --restart
100102
```
101103

102104
### Command Line Options

scripts/launch-nodes/manage_subspace.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,19 @@ def docker_compose_down(client, subspace_dir):
8989
logger.error(f"Failed to run sudo docker compose down -v: {e}")
9090
raise
9191

92-
def docker_compose_restart(client, subspace_dir):
92+
def docker_compose_restart(client, subspace_dir, docker_tag=None):
9393
"""Run sudo docker compose restart in the subspace directory."""
9494
try:
95-
command = f'cd {subspace_dir} && sudo docker compose restart'
95+
# Modify .env file if a new DOCKER_TAG is provided
96+
if docker_tag:
97+
logger.info(f"Updating DOCKER_TAG to {docker_tag} in {subspace_dir}/.env")
98+
modify_env_file(client, subspace_dir, release_version=docker_tag)
99+
100+
# Restart the containers
101+
restart_cmd = f'cd {subspace_dir} && sudo docker compose restart'
96102
logger.info(f"Running sudo docker compose restart in {subspace_dir}")
97-
run_command(client, command)
103+
run_command(client, restart_cmd)
104+
98105
except Exception as e:
99106
logger.error(f"Failed to run sudo docker compose restart: {e}")
100107
raise

0 commit comments

Comments
 (0)