Skip to content

Commit 5d4bba7

Browse files
authored
Merge pull request #36 from higgsfield-ai/dev
merge: dev
2 parents a338bba + 2be35af commit 5d4bba7

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

higgsfield/internal/ci/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ def decode_secrets(env: str):
5454

5555

5656
@click.command("setup-nodes")
57-
def setup_nodes():
57+
@click.option('--invoker_tag', default="v0.0.1", help="Tag of the invoker binary to use")
58+
def setup_nodes(invoker_tag: str = "v0.0.1"):
5859
wd = wd_path()
5960
app_config = AppConfig.from_path(wd)
6061

@@ -74,7 +75,7 @@ def setup_nodes():
7475

7576
app_config.set_git_origin_url(project_path)
7677

77-
setup = Setup(app_config, project_path)
78+
setup = Setup(app_config, project_path, invoker_tag)
7879

7980
try:
8081
setup.create_ssh_key_file()

higgsfield/internal/ci/setup.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111

1212

1313
docker_install_script = '''/bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/arpanetus/1c1210b9e432a04dcfb494725a407a70/raw/5d47baa19b7100261a2368a43ace610528e0dfa2/install.sh)"'''
14-
invoker_install_script = """wget https://github.com/ml-doom/invoker/releases/download/latest/invoker-latest-linux-amd64.tar.gz && \
15-
tar -xvf invoker-latest-linux-amd64.tar.gz && \
14+
15+
def invoker_install_script(tag: str) -> str:
16+
return f"""wget https://github.com/ml-doom/invoker/releases/download/{tag}/invoker-{tag}-linux-amd64.tar.gz && \
17+
tar -xvf invoker-{tag}-linux-amd64.tar.gz && \
1618
sudo mv invoker /usr/bin/invoker && \
17-
rm invoker-latest-linux-amd64.tar.gz"""
19+
rm invoker-{tag}-linux-amd64.tar.gz"""
1820

1921

2022
def deploy_key_script(key: str, project_name: str, deploy_key_string: str):
@@ -32,18 +34,21 @@ class Setup:
3234
path: str
3335
deploy_key: str
3436
project_path: Path
37+
invoker_tag: str
3538

3639
def __init__(
3740
self,
3841
app_config: AppConfig,
3942
project_path: Path,
43+
invoker_tag: str,
4044
):
4145
self.app_config = app_config
4246

4347
if reason := self.app_config.is_valid() is not None:
4448
raise ValueError(reason)
4549

4650
self.project_path = project_path
51+
self.invoker_tag = invoker_tag
4752

4853
def create_ssh_key_file(self):
4954
if self.app_config.key is None:
@@ -97,7 +102,7 @@ async def printer(thing):
97102
print("\n\n\nINSTALLING INVOKER\n\n\n")
98103
to_run = []
99104
for conn in self.connections:
100-
to_run.append(printer(await conn.run(invoker_install_script)))
105+
to_run.append(printer(await conn.run(invoker_install_script(self.invoker_tag))))
101106

102107
await asyncio.gather(*to_run)
103108

@@ -111,6 +116,15 @@ async def printer(thing):
111116
to_run.append(printer(await conn.run(dk_script)))
112117

113118
await asyncio.gather(*to_run)
119+
120+
# close connections
121+
for conn in self.connections:
122+
conn.close()
123+
124+
125+
# re-establish connections
126+
await self.establish_connections()
127+
114128

115129
print("\n\n\nPULLING BASE DOCKER IMAGE\n\n\n")
116130
to_run = []

higgsfield/internal/experiment/params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def as_github_action(self) -> str:
103103
f"{indent}description: {remove_trailing_yaml(safe_dump(self.description))}"
104104
)
105105
to_join.append(f"{indent}required: {self.required}")
106-
if self.default:
106+
if self.default is not None:
107107
d = self.default
108108
if type(self.default) == str:
109109
d = remove_trailing_yaml(safe_dump(self.default))

0 commit comments

Comments
 (0)