You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@submarine.apache.org by GitBox <gi...@apache.org> on 2020/08/24 15:55:42 UTC

[GitHub] [submarine] JohnTing commented on a change in pull request #382: SUBMARINE-558. Define Swagger API for pre-defined template submission

JohnTing commented on a change in pull request #382:
URL: https://github.com/apache/submarine/pull/382#discussion_r475718360



##########
File path: submarine-server/server-core/src/main/java/org/apache/submarine/server/experimenttemplate/ExperimentTemplateManager.java
##########
@@ -276,19 +280,56 @@ private ExperimentTemplate getExperimentTemplateDetails(String name) throws Subm
     return tpl;
   }
 
-  private ExperimentTemplateSpec parameterMapping(String spec) {
 
+  /**
+   * Create ExperimentTemplate
+   * 
+   * @param SubmittedParam experimentTemplate spec
+   * @return Experiment experiment
+   * @throws SubmarineRuntimeException the service error
+   */
+  public Experiment submitExperimentTemplate(ExperimentTemplateSubmit SubmittedParam) 
+        throws SubmarineRuntimeException {
+
+    if (SubmittedParam == null) {
+      throw new SubmarineRuntimeException(Status.BAD_REQUEST.getStatusCode(), 
+            "Invalid ExperimentTemplateSubmit spec.");
+    }
+
+    ExperimentTemplate experimentTemplate = getExperimentTemplate(SubmittedParam.getName());
+    Map<String, String> sparam = SubmittedParam.getParams();
+
+    for (ExperimentTemplateParamSpec tpaam: experimentTemplate.getExperimentTemplateSpec().getParameters()) {

Review comment:
       This change needs to make the following json format 
   
   ```json
   "experimentTemplateSpec": {
       "name": "tf-mnist-test",
       "author": "author",
       "description": "This is a template to run tf-mnist\n",
       "parameters": [
           {
               "name": "training.learning_rate",
               "required": "true",
               "description": " mnist learning_rate ",
               "value": "0.01"
           },
           {
               "name": "training.batch_size",
               "required": "false",
               "description": "This is batch size of training",
               "value": "150"
           }
       ],
   }
   ```
   into this
   
   ```json
   "experimentTemplateSpec": {
       "name": "tf-mnist-test",
       "author": "author",
       "description": "This is a template to run tf-mnist\n",
       "experimentTemplateParamSpec": [
           {
               "name": "training.learning_rate",
               "required": "true",
               "description": " mnist learning_rate ",
               "value": "0.01"
           },
           {
               "name": "training.batch_size",
               "required": "false",
               "description": "This is batch size of training",
               "value": "150"
           }
       ],
   }
   ```
   
   I am not sure if it is appropriate.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org