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

Commit 3265ca9

Browse files
committed
Add help messages for experiments
1 parent 1c68c12 commit 3265ca9

File tree

1 file changed

+48
-15
lines changed

1 file changed

+48
-15
lines changed

paperspace/cli.py

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,18 @@ def cli():
8484
pass
8585

8686

87-
@cli.group("experiments")
87+
@cli.group("experiments", help="Manage experiments")
8888
def experiments():
8989
pass
9090

9191

92-
@experiments.group()
93-
def create():
92+
@experiments.group("create", help="Create new experiment")
93+
def create_experiment():
9494
pass
9595

9696

97-
@experiments.group(name="createAndStart")
98-
def create_and_start():
97+
@experiments.group(name="createAndStart", help="Create and start new experiment")
98+
def create_and_start_experiment():
9999
pass
100100

101101

@@ -104,56 +104,68 @@ def common_experiments_create_options(f):
104104
click.option(
105105
"--name",
106106
required=True,
107+
help="Name of new experiment",
107108
),
108109
click.option(
109110
"--ports",
110111
type=int,
112+
help="Port to use in new experiment",
111113
),
112114
click.option(
113115
"--workspaceUrl",
114116
"workspaceUrl",
115117
required=True,
118+
help="Project git repository url",
116119
),
117120
click.option(
118121
"--workingDirectory",
119122
"workingDirectory",
123+
help="Working directory for the experiment",
120124
),
121125
click.option(
122126
"--artifactDirectory",
123127
"artifactDirectory",
128+
help="Artifacts directory",
124129
),
125130
click.option(
126131
"--clusterId",
127132
"clusterId",
128133
type=int,
134+
help="Cluster ID",
129135
),
130136
click.option(
131137
"--experimentEnv",
132138
"experimentEnv",
133139
type=json_string,
140+
help="Environment variables in a JSON",
134141
),
135142
click.option(
136143
"--triggerEventId",
137144
"triggerEventId",
138145
type=int,
146+
help="Trigger event ID",
139147
),
140148
click.option(
141149
"--projectId",
142150
"projectId",
143151
type=int,
152+
help="Project ID",
144153
),
145154
click.option(
146155
"--projectHandle",
147156
"projectHandle",
148157
required=True,
158+
help="Project handle",
149159
),
150160
click.option(
151161
"--modelType",
152162
"modelType",
163+
help="Model type",
153164
),
154165
click.option(
155166
"--modelPath",
156167
"modelPath",
168+
help="Model path",
157169
),
158170
api_key_option
159171
]
@@ -167,72 +179,87 @@ def common_experiment_create_multi_node_options(f):
167179
"experimentTypeId",
168180
type=ChoiceType(MULTI_NODE_EXPERIMENT_TYPES_MAP, case_sensitive=False),
169181
required=True,
182+
help="Experiment Type ID",
170183
),
171184
click.option(
172185
"--workerContainer",
173186
"workerContainer",
174187
required=True,
188+
help="Worker container",
175189
),
176190
click.option(
177191
"--workerMachineType",
178192
"workerMachineType",
179193
required=True,
194+
help="Worker machine type",
180195
),
181196
click.option(
182197
"--workerCommand",
183198
"workerCommand",
184199
required=True,
200+
help="Worker command",
185201
),
186202
click.option(
187203
"--workerCount",
188204
"workerCount",
189205
type=int,
190206
required=True,
207+
help="Worker count",
191208
),
192209
click.option(
193210
"--parameterServerContainer",
194211
"parameterServerContainer",
195212
required=True,
213+
help="Parameter server container",
196214
),
197215
click.option(
198216
"--parameterServerMachineType",
199217
"parameterServerMachineType",
200218
required=True,
219+
help="Parameter server machine type",
201220
),
202221
click.option(
203222
"--parameterServerCommand",
204223
"parameterServerCommand",
205224
required=True,
225+
help="Parameter server command",
206226
),
207227
click.option(
208228
"--parameterServerCount",
209229
"parameterServerCount",
210230
type=int,
211231
required=True,
232+
help="Parameter server count",
212233
),
213234
click.option(
214235
"--workerContainerUser",
215236
"workerContainerUser",
237+
help="Worker container user",
216238
),
217239
click.option(
218240
"--workerRegistryUsername",
219241
"workerRegistryUsername",
242+
help="Worker registry username",
220243
),
221244
click.option(
222245
"--workerRegistryPassword",
223246
"workerRegistryPassword",
247+
help="Worker registry password",
224248
),
225249
click.option(
226250
"--parameterServerContainerUser",
227251
"parameterServerContainerUser",
252+
help="Parameter server container user",
228253
),
229254
click.option(
230255
"--parameterServerRegistryContainerUser",
231256
"parameterServerRegistryContainerUser",
257+
help="Parameter server registry container user",
232258
),
233259
click.option(
234260
"--parameterServerRegistryPassword",
235261
"parameterServerRegistryPassword",
262+
help="Parameter server registry password",
236263
),
237264
]
238265
return functools.reduce(lambda x, opt: opt(x), reversed(options), f)
@@ -243,33 +270,39 @@ def common_experiments_create_single_node_options(f):
243270
click.option(
244271
"--container",
245272
required=True,
273+
help="Container",
246274
),
247275
click.option(
248276
"--machineType",
249277
"machineType",
250278
required=True,
279+
help="Machine type",
251280
),
252281
click.option(
253282
"--command",
254283
required=True,
284+
help="Command",
255285
),
256286
click.option(
257287
"--containerUser",
258288
"containerUser",
289+
help="Container user",
259290
),
260291
click.option(
261292
"--registryUsername",
262293
"registryUsername",
294+
help="Registry username",
263295
),
264296
click.option(
265297
"--registryPassword",
266298
"registryPassword",
299+
help="Registry password",
267300
),
268301
]
269302
return functools.reduce(lambda x, opt: opt(x), reversed(options), f)
270303

271304

272-
@create.command(name="multinode")
305+
@create_experiment.command(name="multinode", help="Create multi node experiment")
273306
@common_experiments_create_options
274307
@common_experiment_create_multi_node_options
275308
def create_multi_node(api_key, **kwargs):
@@ -278,7 +311,7 @@ def create_multi_node(api_key, **kwargs):
278311
experiments_commands.create_experiment(kwargs, api=experiments_api)
279312

280313

281-
@create.command(name="singlenode")
314+
@create_experiment.command(name="singlenode", help="Create single node experiment")
282315
@common_experiments_create_options
283316
@common_experiments_create_single_node_options
284317
def create_single_node(api_key, **kwargs):
@@ -288,7 +321,7 @@ def create_single_node(api_key, **kwargs):
288321
experiments_commands.create_experiment(kwargs, api=experiments_api)
289322

290323

291-
@create_and_start.command(name="multinode")
324+
@create_and_start_experiment.command(name="multinode", help="Create and start new multi node experiment")
292325
@common_experiments_create_options
293326
@common_experiment_create_multi_node_options
294327
def create_and_start_multi_node(api_key, **kwargs):
@@ -297,7 +330,7 @@ def create_and_start_multi_node(api_key, **kwargs):
297330
experiments_commands.create_and_start_experiment(kwargs, api=experiments_api)
298331

299332

300-
@create_and_start.command(name="singlenode")
333+
@create_and_start_experiment.command(name="singlenode", help="Create and start new single node experiment")
301334
@common_experiments_create_options
302335
@common_experiments_create_single_node_options
303336
def create_and_start_single_node(api_key, **kwargs):
@@ -307,23 +340,23 @@ def create_and_start_single_node(api_key, **kwargs):
307340
experiments_commands.create_and_start_experiment(kwargs, api=experiments_api)
308341

309342

310-
@experiments.command()
343+
@experiments.command("start", help="Start experiment")
311344
@click.argument("experiment-handle")
312345
@api_key_option
313-
def start(experiment_handle, api_key):
346+
def start_experiment(experiment_handle, api_key):
314347
experiments_api = client.API(config.CONFIG_EXPERIMENTS_HOST, api_key=api_key)
315348
experiments_commands.start_experiment(experiment_handle, api=experiments_api)
316349

317350

318-
@experiments.command()
351+
@experiments.command("stop", help="Stop experiment")
319352
@click.argument("experiment-handle")
320353
@api_key_option
321-
def stop(experiment_handle, api_key):
354+
def stop_experiment(experiment_handle, api_key):
322355
experiments_api = client.API(config.CONFIG_EXPERIMENTS_HOST, api_key=api_key)
323356
experiments_commands.stop_experiment(experiment_handle, api=experiments_api)
324357

325358

326-
@experiments.command("list")
359+
@experiments.command("list", help="List experiments")
327360
@click.option("--projectHandle", "-p", "project_handles", multiple=True)
328361
@api_key_option
329362
def list_experiments(project_handles, api_key):
@@ -332,7 +365,7 @@ def list_experiments(project_handles, api_key):
332365
command.execute(project_handles)
333366

334367

335-
@experiments.command("details")
368+
@experiments.command("details", help="Show detail of an experiment")
336369
@click.argument("experiment-handle")
337370
@api_key_option
338371
def get_experiment_details(experiment_handle, api_key):

0 commit comments

Comments
 (0)