33
44import click
55
6- from gradient import client , config , constants
6+ from gradient import client , config , constants , utils
77from gradient .cli .cli import cli
88from gradient .cli .cli_types import json_string , ChoiceType
9- from gradient .cli .common import api_key_option , del_if_value_is_none , ClickGroup
9+ from gradient .cli .common import api_key_option , del_if_value_is_none , ClickGroup , deprecated
1010from gradient .commands import experiments as experiments_commands
1111
1212MULTI_NODE_EXPERIMENT_TYPES_MAP = collections .OrderedDict (
@@ -235,27 +235,35 @@ def common_experiments_create_single_node_options(f):
235235 return functools .reduce (lambda x , opt : opt (x ), reversed (options ), f )
236236
237237
238+ @deprecated ("DeprecatedWarning: \n WARNING: --workspaceUrl and --workspaceArchive "
239+ "options will not be included in version 0.6.0" )
238240@create_experiment .command (name = "multinode" , help = "Create multi node experiment" )
239241@common_experiments_create_options
240242@common_experiment_create_multi_node_options
241243def create_multi_node (api_key , ** kwargs ):
244+ utils .validate_workspace_input (kwargs )
242245 del_if_value_is_none (kwargs )
243246 experiments_api = client .API (config .CONFIG_EXPERIMENTS_HOST , api_key = api_key )
244247 command = experiments_commands .CreateExperimentCommand (api = experiments_api )
245248 command .execute (kwargs )
246249
247250
251+ @deprecated ("DeprecatedWarning: \n WARNING: --workspaceUrl and --workspaceArchive "
252+ "options will not be included in version 0.6.0" )
248253@create_experiment .command (name = "singlenode" , help = "Create single node experiment" )
249254@common_experiments_create_options
250255@common_experiments_create_single_node_options
251256def create_single_node (api_key , ** kwargs ):
257+ utils .validate_workspace_input (kwargs )
252258 kwargs ["experimentTypeId" ] = constants .ExperimentType .SINGLE_NODE
253259 del_if_value_is_none (kwargs )
254260 experiments_api = client .API (config .CONFIG_EXPERIMENTS_HOST , api_key = api_key )
255261 command = experiments_commands .CreateExperimentCommand (api = experiments_api )
256262 command .execute (kwargs )
257263
258264
265+ @deprecated ("DeprecatedWarning: \n WARNING: --workspaceUrl and --workspaceArchive "
266+ "options will not be included in version 0.6.0" )
259267@create_and_start_experiment .command (name = "multinode" , help = "Create and start new multi node experiment" )
260268@common_experiments_create_options
261269@common_experiment_create_multi_node_options
@@ -269,6 +277,7 @@ def create_single_node(api_key, **kwargs):
269277)
270278@click .pass_context
271279def create_and_start_multi_node (ctx , api_key , show_logs , ** kwargs ):
280+ utils .validate_workspace_input (kwargs )
272281 del_if_value_is_none (kwargs )
273282 experiments_api = client .API (config .CONFIG_EXPERIMENTS_HOST , api_key = api_key )
274283 command = experiments_commands .CreateAndStartExperimentCommand (api = experiments_api )
@@ -277,6 +286,8 @@ def create_and_start_multi_node(ctx, api_key, show_logs, **kwargs):
277286 ctx .invoke (list_logs , experiment_id = experiment ["handle" ], line = 0 , limit = 100 , follow = True , api_key = api_key )
278287
279288
289+ @deprecated ("DeprecatedWarning: \n WARNING: --workspaceUrl and --workspaceArchive "
290+ "options will not be included in version 0.6.0" )
280291@create_and_start_experiment .command (name = "singlenode" , help = "Create and start new single node experiment" )
281292@common_experiments_create_options
282293@common_experiments_create_single_node_options
@@ -290,6 +301,7 @@ def create_and_start_multi_node(ctx, api_key, show_logs, **kwargs):
290301)
291302@click .pass_context
292303def create_and_start_single_node (ctx , api_key , show_logs , ** kwargs ):
304+ utils .validate_workspace_input (kwargs )
293305 kwargs ["experimentTypeId" ] = constants .ExperimentType .SINGLE_NODE
294306 del_if_value_is_none (kwargs )
295307 experiments_api = client .API (config .CONFIG_EXPERIMENTS_HOST , api_key = api_key )
0 commit comments