3636
3737@app .command ()
3838def upload (
39- path : Path = typer .Argument (..., help = "Path to your source code" ),
40- entrypoint : str = typer .Argument (..., help = "Your program entrypoint" ),
41- channel : str = typer .Option (settings .DEFAULT_CHANNEL , help = help_strings .CHANNEL ),
42- memory : int = typer .Option (
43- settings .DEFAULT_VM_MEMORY , help = "Maximum memory allocation on vm in MiB"
44- ),
45- vcpus : int = typer .Option (
46- settings .DEFAULT_VM_VCPUS , help = "Number of virtual cpus to allocate."
47- ),
48- timeout_seconds : float = typer .Option (
49- settings .DEFAULT_VM_TIMEOUT ,
50- help = "If vm is not called after [timeout_seconds] it will shutdown" ,
51- ),
52- private_key : Optional [str ] = typer .Option (
53- settings .PRIVATE_KEY_STRING , help = help_strings .PRIVATE_KEY
54- ),
55- private_key_file : Optional [Path ] = typer .Option (
56- settings .PRIVATE_KEY_FILE , help = help_strings .PRIVATE_KEY_FILE
57- ),
58- print_messages : bool = typer .Option (False ),
59- print_code_message : bool = typer .Option (False ),
60- print_program_message : bool = typer .Option (False ),
61- runtime : str = typer .Option (
62- None ,
63- help = "Hash of the runtime to use for your program. Defaults to aleph debian with Python3.8 and node. You can also create your own runtime and pin it" ,
64- ),
65- beta : bool = typer .Option (False ),
66-
67- debug : bool = False ,
68- persistent : bool = False ,
69- persistent_volume : Optional [List [str ]] = typer .Option (
70- None ,
71- help = '''Takes 3 parameters
39+ path : Path = typer .Argument (..., help = "Path to your source code" ),
40+ entrypoint : str = typer .Argument (..., help = "Your program entrypoint" ),
41+ channel : str = typer .Option (settings .DEFAULT_CHANNEL , help = help_strings .CHANNEL ),
42+ memory : int = typer .Option (
43+ settings .DEFAULT_VM_MEMORY , help = "Maximum memory allocation on vm in MiB"
44+ ),
45+ vcpus : int = typer .Option (
46+ settings .DEFAULT_VM_VCPUS , help = "Number of virtual cpus to allocate."
47+ ),
48+ timeout_seconds : float = typer .Option (
49+ settings .DEFAULT_VM_TIMEOUT ,
50+ help = "If vm is not called after [timeout_seconds] it will shutdown" ,
51+ ),
52+ private_key : Optional [str ] = typer .Option (
53+ settings .PRIVATE_KEY_STRING , help = help_strings .PRIVATE_KEY
54+ ),
55+ private_key_file : Optional [Path ] = typer .Option (
56+ settings .PRIVATE_KEY_FILE , help = help_strings .PRIVATE_KEY_FILE
57+ ),
58+ print_messages : bool = typer .Option (False ),
59+ print_code_message : bool = typer .Option (False ),
60+ print_program_message : bool = typer .Option (False ),
61+ runtime : str = typer .Option (
62+ None ,
63+ help = "Hash of the runtime to use for your program. Defaults to aleph debian with Python3.8 and node. You can also create your own runtime and pin it" ,
64+ ),
65+ beta : bool = typer .Option (False ),
66+ debug : bool = False ,
67+ persistent : bool = False ,
68+ persistent_volume : Optional [List [str ]] = typer .Option (
69+ None ,
70+ help = """Takes 3 parameters
7271 A persistent volume is allocated on the host machine at any time
7372 eg: Use , to seperate the parameters and no spaces
7473 --persistent_volume persistence=host,name=my-volume,size=100 ./my-program main:app
75- ''' ),
76-
77- ephemeral_volume : Optional [List [str ]] = typer .Option (
78- None ,
79- help =
80- '''Takes 1 parameter Only
74+ """ ,
75+ ),
76+ ephemeral_volume : Optional [List [str ]] = typer .Option (
77+ None ,
78+ help = """Takes 1 parameter Only
8179 Ephemeral volumes can move and be removed by the host,Garbage collected basically, when the VM isn't running
8280 eg: Use , to seperate the parameters and no spaces
83- --ephemeral-volume size_mib=100 ./my-program main:app ''' ),
84-
85- immutable_volume : Optional [List [str ]] = typer .Option (
86- None ,
87- help =
88- '''Takes 3 parameters
81+ --ephemeral-volume size_mib=100 ./my-program main:app """ ,
82+ ),
83+ immutable_volume : Optional [List [str ]] = typer .Option (
84+ None ,
85+ help = """Takes 3 parameters
8986 Immutable volume is one whose contents do not change
9087 eg: Use , to seperate the parameters and no spaces
9188 --immutable-volume ref=25a393222692c2f73489dc6710ae87605a96742ceef7b91de4d7ec34bb688d94,use_latest=true,mount=/mnt/volume ./my-program main:app
92- '''
93- )
94-
89+ """ ,
90+ ),
9591):
9692 """Register a program to run on Aleph.im virtual machines from a zip archive."""
9793
@@ -111,15 +107,19 @@ def upload(
111107 account : AccountFromPrivateKey = _load_account (private_key , private_key_file )
112108
113109 runtime = (
114- runtime
115- or input (f"Ref of runtime ? [{ settings .DEFAULT_RUNTIME_ID } ] " )
116- or settings .DEFAULT_RUNTIME_ID
110+ runtime
111+ or input (f"Ref of runtime ? [{ settings .DEFAULT_RUNTIME_ID } ] " )
112+ or settings .DEFAULT_RUNTIME_ID
117113 )
118114
119115 volumes = []
120116
121117 # Check if the volumes are empty
122- if persistent_volume is None or ephemeral_volume is None or immutable_volume is None :
118+ if (
119+ persistent_volume is None
120+ or ephemeral_volume is None
121+ or immutable_volume is None
122+ ):
123123 for volume in prompt_for_volumes ():
124124 volumes .append (volume )
125125 typer .echo ("\n " )
@@ -211,12 +211,12 @@ def upload(
211211
212212@app .command ()
213213def update (
214- hash : str ,
215- path : Path ,
216- private_key : Optional [str ] = settings .PRIVATE_KEY_STRING ,
217- private_key_file : Optional [Path ] = settings .PRIVATE_KEY_FILE ,
218- print_message : bool = True ,
219- debug : bool = False ,
214+ hash : str ,
215+ path : Path ,
216+ private_key : Optional [str ] = settings .PRIVATE_KEY_STRING ,
217+ private_key_file : Optional [Path ] = settings .PRIVATE_KEY_FILE ,
218+ print_message : bool = True ,
219+ debug : bool = False ,
220220):
221221 """Update the code of an existing program"""
222222
@@ -274,10 +274,10 @@ def update(
274274
275275@app .command ()
276276def unpersist (
277- hash : str ,
278- private_key : Optional [str ] = settings .PRIVATE_KEY_STRING ,
279- private_key_file : Optional [Path ] = settings .PRIVATE_KEY_FILE ,
280- debug : bool = False ,
277+ hash : str ,
278+ private_key : Optional [str ] = settings .PRIVATE_KEY_STRING ,
279+ private_key_file : Optional [Path ] = settings .PRIVATE_KEY_FILE ,
280+ debug : bool = False ,
281281):
282282 """Stop a persistent virtual machine by making it non-persistent"""
283283
0 commit comments