1111
1212
1313docker_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
2022def 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 \n INSTALLING 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 \n PULLING BASE DOCKER IMAGE\n \n \n " )
116130 to_run = []
0 commit comments