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

Commit 50baea2

Browse files
committed
Merge branch 'master' of github.com:Paperspace/paperspace-python into fix-paren-and-quotes-autocomplete-readme-PS-10221
2 parents f069db3 + 85cba20 commit 50baea2

File tree

2 files changed

+75
-2
lines changed

2 files changed

+75
-2
lines changed

paperspace/cli/hyperparameters.py

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,19 @@
33
import click
44

55
from paperspace import client, config
6-
from paperspace.cli import common
6+
from paperspace.cli import common, cli_types
77
from paperspace.cli.cli import cli
88
from paperspace.cli.common import ClickGroup
99
from paperspace.commands import hyperparameters as hyperparameters_commands
1010

1111

12+
def add_use_docker_file_flag_if_used(ctx, param, value):
13+
if value:
14+
ctx.params["useDockerFile"] = True
15+
16+
return value
17+
18+
1219
@cli.group(["hyperparameters", "hyperparameter"], help="Manage hyperparameters", cls=ClickGroup)
1320
def hyperparameters_group():
1421
pass
@@ -20,49 +27,115 @@ def common_hyperparameter_create_options(f):
2027
"--name",
2128
"name",
2229
required=True,
30+
help="Job name",
2331
),
2432
click.option(
2533
"--projectId",
2634
"projectHandle",
2735
required=True,
36+
help="Project ID",
2837
),
2938
click.option(
3039
"--tuningCommand",
3140
"tuningCommand",
3241
required=True,
42+
help="Tuning command",
3343
),
3444
click.option(
3545
"--workerContainer",
3646
"workerContainer",
3747
required=True,
48+
help="Worker Docker image",
3849
),
3950
click.option(
4051
"--workerMachineType",
4152
"workerMachineType",
4253
required=True,
54+
help="Worker machine type",
4355
),
4456
click.option(
4557
"--workerCommand",
4658
"workerCommand",
4759
required=True,
60+
help="Worker command",
4861
),
4962
click.option(
5063
"--workerCount",
5164
"workerCount",
5265
required=True,
5366
type=int,
67+
help="Worker count",
68+
),
69+
click.option(
70+
"--isPreemptible",
71+
"isPreemptible",
72+
type=bool,
73+
is_flag=True,
74+
help="Flag: isPreemptible",
75+
),
76+
click.option(
77+
"--ports",
78+
"ports",
79+
help="Port to use in new job",
80+
),
81+
click.option(
82+
"--workspaceUrl",
83+
"workspaceUrl",
84+
help="Project git repository url",
85+
),
86+
click.option(
87+
"--artifactDirectory",
88+
"artifactDirectory",
89+
help="Artifacts directory",
90+
),
91+
click.option(
92+
"--clusterId",
93+
"clusterId",
94+
type=int,
95+
help="Cluster ID",
96+
),
97+
click.option(
98+
"--experimentEnv",
99+
"experimentEnv",
100+
type=cli_types.json_string,
101+
help="Environment variables in a JSON",
102+
),
103+
click.option(
104+
"--triggerEventId",
105+
"triggerEventId",
106+
type=int,
107+
help="Trigger event ID",
108+
),
109+
click.option(
110+
"--modelType",
111+
"modelType",
112+
help="Model type",
113+
),
114+
click.option(
115+
"--modelPath",
116+
"modelPath",
117+
help="Model path",
118+
),
119+
click.option(
120+
"--dockerfilePath",
121+
"dockerfilePath",
122+
callback=add_use_docker_file_flag_if_used,
123+
help="Path to Dockerfile",
54124
),
55125
click.option(
56126
"--serverRegistryUsername",
57127
"hyperparameterServerRegistryUsername",
128+
help="Hyperparameter server registry username",
58129
),
59130
click.option(
60131
"--serverRegistryPassword",
61132
"hyperparameterServerRegistryPassword",
133+
help="Hyperparameter server registry password",
62134
),
63135
click.option(
64136
"--serverContainerUser",
65137
"hyperparameterServerContainerUser",
138+
help="Hyperparameter server container user",
66139
),
67140
]
68141
return functools.reduce(lambda x, opt: opt(x), reversed(options), f)

paperspace/cli/validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ def validate_email(ctx, param, value):
1515
and not re.match(r"[^@]+@[^@]+\.[^@]+", value):
1616
raise click.BadParameter("Bad email address format")
1717

18-
return value
18+
return value

0 commit comments

Comments
 (0)