Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge: dev #36

Merged
merged 4 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions higgsfield/internal/ci/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def decode_secrets(env: str):


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

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

app_config.set_git_origin_url(project_path)

setup = Setup(app_config, project_path)
setup = Setup(app_config, project_path, invoker_tag)

try:
setup.create_ssh_key_file()
Expand Down
22 changes: 18 additions & 4 deletions higgsfield/internal/ci/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@


docker_install_script = '''/bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/arpanetus/1c1210b9e432a04dcfb494725a407a70/raw/5d47baa19b7100261a2368a43ace610528e0dfa2/install.sh)"'''
invoker_install_script = """wget https://github.com/ml-doom/invoker/releases/download/latest/invoker-latest-linux-amd64.tar.gz && \
tar -xvf invoker-latest-linux-amd64.tar.gz && \

def invoker_install_script(tag: str) -> str:
return f"""wget https://github.com/ml-doom/invoker/releases/download/{tag}/invoker-{tag}-linux-amd64.tar.gz && \
tar -xvf invoker-{tag}-linux-amd64.tar.gz && \
sudo mv invoker /usr/bin/invoker && \
rm invoker-latest-linux-amd64.tar.gz"""
rm invoker-{tag}-linux-amd64.tar.gz"""


def deploy_key_script(key: str, project_name: str, deploy_key_string: str):
Expand All @@ -32,18 +34,21 @@ class Setup:
path: str
deploy_key: str
project_path: Path
invoker_tag: str

def __init__(
self,
app_config: AppConfig,
project_path: Path,
invoker_tag: str,
):
self.app_config = app_config

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

self.project_path = project_path
self.invoker_tag = invoker_tag

def create_ssh_key_file(self):
if self.app_config.key is None:
Expand Down Expand Up @@ -97,7 +102,7 @@ async def printer(thing):
print("\n\n\nINSTALLING INVOKER\n\n\n")
to_run = []
for conn in self.connections:
to_run.append(printer(await conn.run(invoker_install_script)))
to_run.append(printer(await conn.run(invoker_install_script(self.invoker_tag))))

await asyncio.gather(*to_run)

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

await asyncio.gather(*to_run)

# close connections
for conn in self.connections:
conn.close()


# re-establish connections
await self.establish_connections()


print("\n\n\nPULLING BASE DOCKER IMAGE\n\n\n")
to_run = []
Expand Down
2 changes: 1 addition & 1 deletion higgsfield/internal/experiment/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def as_github_action(self) -> str:
f"{indent}description: {remove_trailing_yaml(safe_dump(self.description))}"
)
to_join.append(f"{indent}required: {self.required}")
if self.default:
if self.default is not None:
d = self.default
if type(self.default) == str:
d = remove_trailing_yaml(safe_dump(self.default))
Expand Down