@@ -190,10 +190,22 @@ def quickstart():
190
190
type = bool ,
191
191
default = True ,
192
192
)
193
+ fork_observer_query_interval = 20
194
+ if fork_observer :
195
+ fork_observer_query_interval = click .prompt (
196
+ click .style (
197
+ "\n How often would you like fork-observer to query node status (seconds)?" ,
198
+ fg = "blue" ,
199
+ bold = True ,
200
+ ),
201
+ type = int ,
202
+ default = 20 ,
203
+ )
193
204
194
205
click .secho ("\n Creating project structure..." , fg = "yellow" , bold = True )
195
206
project_path = Path (os .path .expanduser (proj_answers ["project_path" ]))
196
207
create_warnet_project (project_path )
208
+
197
209
click .secho ("\n Generating custom network..." , fg = "yellow" , bold = True )
198
210
custom_network_path = project_path / "networks" / answers ["network_name" ]
199
211
custom_graph (
@@ -202,10 +214,17 @@ def quickstart():
202
214
answers ["version" ],
203
215
custom_network_path ,
204
216
fork_observer ,
217
+ fork_observer_query_interval ,
205
218
)
206
219
click .secho ("\n Setup completed successfully!" , fg = "green" , bold = True )
207
- click .echo ("\n Run the following command to deploy this network:" )
220
+
221
+ click .echo (
222
+ f"\n Edit the network files found in { custom_network_path } before deployment if you want to customise the network."
223
+ )
224
+
225
+ click .echo ("\n When you're ready, run the following command to deploy this network:" )
208
226
click .echo (f"warnet deploy { custom_network_path } " )
227
+
209
228
except Exception as e :
210
229
click .echo (f"{ e } \n \n " )
211
230
click .secho (f"An error occurred while running the quick start script:\n \n { e } \n \n " , fg = "red" )
@@ -368,7 +387,12 @@ def logs(pod_name: str, follow: bool):
368
387
369
388
370
389
def custom_graph (
371
- num_nodes : int , num_connections : int , version : str , datadir : Path , fork_observer : bool
390
+ num_nodes : int ,
391
+ num_connections : int ,
392
+ version : str ,
393
+ datadir : Path ,
394
+ fork_observer : bool ,
395
+ fork_obs_query_interval : int ,
372
396
):
373
397
datadir .mkdir (parents = False , exist_ok = False )
374
398
# Generate network.yaml
@@ -400,7 +424,10 @@ def custom_graph(
400
424
nodes .append (node )
401
425
402
426
network_yaml_data = {"nodes" : nodes }
403
- network_yaml_data ["fork_observer" ] = fork_observer
427
+ network_yaml_data ["fork_observer" ] = {
428
+ "enabled" : fork_observer ,
429
+ "configQueryInterval" : fork_obs_query_interval ,
430
+ }
404
431
405
432
with open (os .path .join (datadir , "network.yaml" ), "w" ) as f :
406
433
yaml .dump (network_yaml_data , f , default_flow_style = False )
0 commit comments