@@ -51,20 +51,36 @@ def create():
5151 pass
5252
5353
54+ @experiments .group (name = "createAndStart" )
55+ def create_and_start ():
56+ pass
57+
58+
5459def common_experiments_create_options (f ):
5560 options = [
5661 click .option (
57- "--projectHandle " ,
58- "projectHandle" ,
62+ "--name " ,
63+ required = True ,
5964 ),
6065 click .option (
61- "--projectId" ,
62- "projectId" ,
66+ "--ports" ,
6367 type = int ,
6468 ),
6569 click .option (
66- "--triggerEventId" ,
67- "triggerEventId" ,
70+ "--workspaceUrl" ,
71+ "workspaceUrl" ,
72+ ),
73+ click .option (
74+ "--workingDirectory" ,
75+ "workingDirectory" ,
76+ ),
77+ click .option (
78+ "--artifactDirectory" ,
79+ "artifactDirectory" ,
80+ ),
81+ click .option (
82+ "--clusterId" ,
83+ "clusterId" ,
6884 type = int ,
6985 ),
7086 click .option (
@@ -73,149 +89,168 @@ def common_experiments_create_options(f):
7389 type = json_string ,
7490 ),
7591 click .option (
76- "--clusterId " ,
77- "clusterId " ,
92+ "--triggerEventId " ,
93+ "triggerEventId " ,
7894 type = int ,
7995 ),
8096 click .option (
81- "--artifactDirectory" ,
82- "artifactDirectory" ,
97+ "--projectId" ,
98+ "projectId" ,
99+ type = int ,
83100 ),
84101 click .option (
85- "--workingDirectory " ,
86- "workingDirectory " ,
102+ "--projectHandle " ,
103+ "projectHandle " ,
87104 ),
105+ ]
106+ return functools .reduce (lambda x , opt : opt (x ), reversed (options ), f )
107+
108+
109+ def common_experiment_create_multi_node_options (f ):
110+ options = [
88111 click .option (
89- "--workspaceUrl" ,
90- "workspaceUrl" ,
112+ "--experimentTypeId" ,
113+ "experimentTypeId" ,
114+ type = ChoiceType (MULTI_NODE_EXPERIMENT_TYPES_MAP , case_sensitive = False ),
115+ required = True ,
91116 ),
92117 click .option (
93- "--ports" ,
118+ "--workerContainer" ,
119+ "workerContainer" ,
120+ required = True ,
121+ ),
122+ click .option (
123+ "--workerMachineType" ,
124+ "workerMachineType" ,
125+ required = True ,
126+ ),
127+ click .option (
128+ "--workerCommand" ,
129+ "workerCommand" ,
130+ required = True ,
131+ ),
132+ click .option (
133+ "--workerCount" ,
134+ "workerCount" ,
94135 type = int ,
136+ required = True ,
95137 ),
96138 click .option (
97- "--name" ,
139+ "--parameterServerContainer" ,
140+ "parameterServerContainer" ,
98141 required = True ,
99142 ),
143+ click .option (
144+ "--parameterServerMachineType" ,
145+ "parameterServerMachineType" ,
146+ required = True ,
147+ ),
148+ click .option (
149+ "--parameterServerCommand" ,
150+ "parameterServerCommand" ,
151+ required = True ,
152+ ),
153+ click .option (
154+ "--parameterServerCount" ,
155+ "parameterServerCount" ,
156+ type = int ,
157+ required = True ,
158+ ),
159+ click .option (
160+ "--projectHandler" ,
161+ "projectHandler" ,
162+ ),
163+ click .option (
164+ "--workerContainerUser" ,
165+ "workerContainerUser" ,
166+ ),
167+ click .option (
168+ "--workerRegistryUsername" ,
169+ "workerRegistryUsername" ,
170+ ),
171+ click .option (
172+ "--workerRegistryPassword" ,
173+ "workerRegistryPassword" ,
174+ ),
175+ click .option (
176+ "--parameterServerContainerUser" ,
177+ "parameterServerContainerUser" ,
178+ ),
179+ click .option (
180+ "--parameterServerRegistryContainerUser" ,
181+ "parameterServerRegistryContainerUser" ,
182+ ),
183+ click .option (
184+ "--parameterServerRegistryPassword" ,
185+ "parameterServerRegistryPassword" ,
186+ ),
187+ ]
188+ return functools .reduce (lambda x , opt : opt (x ), reversed (options ), f )
189+
100190
191+ def common_experiments_create_single_node_options (f ):
192+ options = [
193+ click .option (
194+ "--container" ,
195+ required = True ,
196+ ),
197+ click .option (
198+ "--machineType" ,
199+ "machineType" ,
200+ required = True ,
201+ ),
202+ click .option (
203+ "--command" ,
204+ required = True ,
205+ ),
206+ click .option (
207+ "--count" ,
208+ type = int ,
209+ ),
210+ click .option (
211+ "--containerUser" ,
212+ "containerUser" ,
213+ ),
214+ click .option (
215+ "--registryUsername" ,
216+ "registryUsername" ,
217+ ),
218+ click .option (
219+ "--registryPassword" ,
220+ "registryPassword" ,
221+ ),
101222 ]
102- return functools .reduce (lambda x , opt : opt (x ), options , f )
223+ return functools .reduce (lambda x , opt : opt (x ), reversed ( options ) , f )
103224
104225
105226@create .command (name = "multinode" )
106227@common_experiments_create_options
107- @click .option (
108- "--experimentTypeId" ,
109- "experimentTypeId" ,
110- type = ChoiceType (MULTI_NODE_EXPERIMENT_TYPES_MAP , case_sensitive = False ),
111- required = True ,
112- )
113- @click .option (
114- "--workerContainer" ,
115- "workerContainer" ,
116- required = True ,
117- )
118- @click .option (
119- "--workerMachineType" ,
120- "workerMachineType" ,
121- required = True ,
122- )
123- @click .option (
124- "--workerCommand" ,
125- "workerCommand" ,
126- required = True ,
127- )
128- @click .option (
129- "--workerCount" ,
130- "workerCount" ,
131- type = int ,
132- required = True ,
133- )
134- @click .option (
135- "--parameterServerContainer" ,
136- "parameterServerContainer" ,
137- required = True ,
138- )
139- @click .option (
140- "--parameterServerMachineType" ,
141- "parameterServerMachineType" ,
142- required = True ,
143- )
144- @click .option (
145- "--parameterServerCommand" ,
146- "parameterServerCommand" ,
147- required = True ,
148- )
149- @click .option (
150- "--parameterServerCount" ,
151- "parameterServerCount" ,
152- type = int ,
153- required = True ,
154- )
155- @click .option (
156- "--projectHandler" ,
157- "projectHandler" ,
158- )
159- @click .option (
160- "--workerContainerUser" ,
161- "workerContainerUser" ,
162- )
163- @click .option (
164- "--workerRegistryUsername" ,
165- "workerRegistryUsername" ,
166- )
167- @click .option (
168- "--workerRegistryPassword" ,
169- "workerRegistryPassword" ,
170- )
171- @click .option (
172- "--parameterServerContainerUser" ,
173- "parameterServerContainerUser" ,
174- )
175- @click .option (
176- "--parameterServerRegistryContainerUser" ,
177- "parameterServerRegistryContainerUser" ,
178- )
179- @click .option (
180- "--parameterServerRegistryPassword" ,
181- "parameterServerRegistryPassword" ,
182- )
228+ @common_experiment_create_multi_node_options
183229def multi_node (** kwargs ):
184230 del_if_value_is_none (kwargs )
185231 commands .create_experiments (kwargs )
186232
187233
188234@create .command (name = "singlenode" )
189235@common_experiments_create_options
190- @click .option (
191- "--container" ,
192- required = True ,
193- )
194- @click .option (
195- "--machineType" ,
196- "machineType" ,
197- required = True ,
198- )
199- @click .option (
200- "--command" ,
201- required = True ,
202- )
203- @click .option (
204- "--count" ,
205- type = int ,
206- )
207- @click .option (
208- "--containerUser" ,
209- "containerUser" ,
210- )
211- @click .option (
212- "--registryUsername" ,
213- "registryUsername" ,
214- )
215- @click .option (
216- "--registryPassword" ,
217- "registryPassword" ,
218- )
236+ @common_experiments_create_single_node_options
237+ def single_node (** kwargs ):
238+ kwargs ["experimentTypeId" ] = constants .EXPERIMENT_TYPE_SINGLE_NODE_ID
239+ del_if_value_is_none (kwargs )
240+ commands .create_experiments (kwargs )
241+
242+
243+ @create_and_start .command (name = "multinode" )
244+ @common_experiments_create_options
245+ @common_experiment_create_multi_node_options
246+ def multi_node (** kwargs ):
247+ del_if_value_is_none (kwargs )
248+ commands .create_experiments (kwargs )
249+
250+
251+ @create_and_start .command (name = "singlenode" )
252+ @common_experiments_create_options
253+ @common_experiments_create_single_node_options
219254def single_node (** kwargs ):
220255 kwargs ["experimentTypeId" ] = constants .EXPERIMENT_TYPE_SINGLE_NODE_ID
221256 del_if_value_is_none (kwargs )
0 commit comments