Skip to content
This repository was archived by the owner on Aug 11, 2020. It is now read-only.

Commit 476252a

Browse files
BartoszCkikossak
authored andcommitted
Showing logs for experiments createAndStart by default
1 parent 7e3e629 commit 476252a

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

paperspace/cli/experiments.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,6 @@ 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-
245238
@create_experiment.command(name="multinode", help="Create multi node experiment")
246239
@common_experiments_create_options
247240
@common_experiment_create_multi_node_options
@@ -266,7 +259,14 @@ def create_single_node(api_key, **kwargs):
266259
@create_and_start_experiment.command(name="multinode", help="Create and start new multi node experiment")
267260
@common_experiments_create_options
268261
@common_experiment_create_multi_node_options
269-
@show_logs_option
262+
@click.option(
263+
"--no-logs",
264+
"show_logs",
265+
is_flag=True,
266+
flag_value=False,
267+
default=True,
268+
help="Don't show logs. Only create, start and exit",
269+
)
270270
@click.pass_context
271271
def create_and_start_multi_node(ctx, api_key, show_logs, **kwargs):
272272
del_if_value_is_none(kwargs)
@@ -280,7 +280,14 @@ def create_and_start_multi_node(ctx, api_key, show_logs, **kwargs):
280280
@create_and_start_experiment.command(name="singlenode", help="Create and start new single node experiment")
281281
@common_experiments_create_options
282282
@common_experiments_create_single_node_options
283-
@show_logs_option
283+
@click.option(
284+
"--no-logs",
285+
"show_logs",
286+
is_flag=True,
287+
flag_value=False,
288+
default=True,
289+
help="Don't show logs. Only create, start and exit",
290+
)
284291
@click.pass_context
285292
def create_and_start_single_node(ctx, api_key, show_logs, **kwargs):
286293
kwargs["experimentTypeId"] = constants.ExperimentType.SINGLE_NODE
@@ -295,7 +302,12 @@ def create_and_start_single_node(ctx, api_key, show_logs, **kwargs):
295302
@experiments.command("start", help="Start experiment")
296303
@click.argument("experiment-id")
297304
@api_key_option
298-
@show_logs_option
305+
@click.option(
306+
"--logs",
307+
"show_logs",
308+
is_flag=True,
309+
help="Show logs",
310+
)
299311
@click.pass_context
300312
def start_experiment(ctx, experiment_id, show_logs, api_key):
301313
experiments_api = client.API(config.CONFIG_EXPERIMENTS_HOST, api_key=api_key)

tests/functional/test_experiments.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ class TestExperimentsCreateAndStartSingleNode(TestExperimentsCreateSingleNode):
263263
"--machineType", "testType",
264264
"--command", "testCommand",
265265
"--workspaceUrl", "some-workspace",
266+
"--no-logs",
266267
]
267268
FULL_OPTIONS_COMMAND = [
268269
"experiments", "createAndStart", "singlenode",
@@ -282,6 +283,7 @@ class TestExperimentsCreateAndStartSingleNode(TestExperimentsCreateSingleNode):
282283
"--registryUsername", "userName",
283284
"--registryPassword", "passwd",
284285
"--apiKey", "some_key",
286+
"--no-logs",
285287
]
286288
EXPECTED_STDOUT = "New experiment created and started with ID: sadkfhlskdjh\n"
287289

@@ -303,6 +305,7 @@ class TestExperimentsCreateAndStartMultiNode(TestExperimentsCreateMultiNode):
303305
"--parameterServerCount", 2,
304306
"--workerContainerUser", "usr",
305307
"--workspaceUrl", "some-workspace",
308+
"--no-logs",
306309
]
307310
FULL_OPTIONS_COMMAND = [
308311
"experiments", "createAndStart", "multinode",
@@ -331,6 +334,7 @@ class TestExperimentsCreateAndStartMultiNode(TestExperimentsCreateMultiNode):
331334
"--parameterServerRegistryContainerUser", "psrcus",
332335
"--parameterServerRegistryPassword", "psrpass",
333336
"--apiKey", "some_key",
337+
"--no-logs",
334338
]
335339
EXPECTED_STDOUT = "New experiment created and started with ID: sadkfhlskdjh\n"
336340

tests/test_click_commands.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ def test_should_execute_create_experiment_command_when_cli_create_and_start_sing
126126
"--machineType testType " \
127127
"--command testCommand " \
128128
"--workspaceUrl wUrl " \
129-
"--apiKey some_key"
129+
"--apiKey some_key " \
130+
"--no-logs"
130131
expected_kwargs = {"name": u"exp1",
131132
"projectHandle": u"testHandle",
132133
"container": u"testContainer",
@@ -160,7 +161,8 @@ def test_should_execute_create_experiment_command_when_cli_create_and_start_mult
160161
"--parameterServerMachineType testParameterServerMachineType " \
161162
"--parameterServerCommand testParameterServerCommand " \
162163
"--parameterServerCount 3 " \
163-
"--workspaceUrl wUrl"
164+
"--workspaceUrl wUrl " \
165+
"--no-logs"
164166
expected_kwargs = {"name": u"exp1",
165167
"projectHandle": u"testHandle",
166168
"experimentTypeId": constants.ExperimentType.MPI_MULTI_NODE,

0 commit comments

Comments
 (0)