@@ -235,6 +235,13 @@ def common_experiments_create_single_node_options(f):
235235 return functools .reduce (lambda x , opt : opt (x ), reversed (options ), f )
236236
237237
238+ show_logs_option = click .option (
239+ "--logs/--no-logs" ,
240+ "show_logs" ,
241+ default = False ,
242+ )
243+
244+
238245@create_experiment .command (name = "multinode" , help = "Create multi node experiment" )
239246@common_experiments_create_options
240247@common_experiment_create_multi_node_options
@@ -259,38 +266,42 @@ def create_single_node(api_key, **kwargs):
259266@create_and_start_experiment .command (name = "multinode" , help = "Create and start new multi node experiment" )
260267@common_experiments_create_options
261268@common_experiment_create_multi_node_options
269+ @show_logs_option
262270@click .pass_context
263- def create_and_start_multi_node (ctx , api_key , ** kwargs ):
271+ def create_and_start_multi_node (ctx , api_key , show_logs , ** kwargs ):
264272 del_if_value_is_none (kwargs )
265273 experiments_api = client .API (config .CONFIG_EXPERIMENTS_HOST , api_key = api_key )
266274 command = experiments_commands .CreateAndStartExperimentCommand (api = experiments_api )
267275 experiment = command .execute (kwargs )
268- if experiment is not None :
276+ if experiment is not None and show_logs is True :
269277 ctx .invoke (list_logs , experiment_id = experiment ["handle" ], line = 0 , limit = 100 , follow = True , api_key = api_key )
270278
271279
272280@create_and_start_experiment .command (name = "singlenode" , help = "Create and start new single node experiment" )
273281@common_experiments_create_options
274282@common_experiments_create_single_node_options
283+ @show_logs_option
275284@click .pass_context
276- def create_and_start_single_node (ctx , api_key , ** kwargs ):
285+ def create_and_start_single_node (ctx , api_key , show_logs , ** kwargs ):
277286 kwargs ["experimentTypeId" ] = constants .ExperimentType .SINGLE_NODE
278287 del_if_value_is_none (kwargs )
279288 experiments_api = client .API (config .CONFIG_EXPERIMENTS_HOST , api_key = api_key )
280289 command = experiments_commands .CreateAndStartExperimentCommand (api = experiments_api )
281290 experiment = command .execute (kwargs )
282- if experiment is not None :
291+ if experiment is not None and show_logs is True :
283292 ctx .invoke (list_logs , experiment_id = experiment ["handle" ], line = 0 , limit = 100 , follow = True , api_key = api_key )
284293
285294
286295@experiments .command ("start" , help = "Start experiment" )
287296@click .argument ("experiment-id" )
288297@api_key_option
298+ @show_logs_option
289299@click .pass_context
290- def start_experiment (ctx , experiment_id , api_key ):
300+ def start_experiment (ctx , experiment_id , show_logs , api_key ):
291301 experiments_api = client .API (config .CONFIG_EXPERIMENTS_HOST , api_key = api_key )
292302 experiments_commands .start_experiment (experiment_id , api = experiments_api )
293- ctx .invoke (list_logs , experiment_id = experiment_id , line = 0 , limit = 100 , follow = True , api_key = api_key )
303+ if show_logs is True :
304+ ctx .invoke (list_logs , experiment_id = experiment_id , line = 0 , limit = 100 , follow = True , api_key = api_key )
294305
295306
296307@experiments .command ("stop" , help = "Stop experiment" )
0 commit comments