This is an automated email from the ASF dual-hosted git repository.

liuxun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 0e5c92b  SUBMARINE-641. Auto convert experiment name to lowercase
0e5c92b is described below

commit 0e5c92bd5426dc102751de393b82d21c0a467312
Author: Lisa <[email protected]>
AuthorDate: Mon Oct 5 14:21:37 2020 +0800

    SUBMARINE-641. Auto convert experiment name to lowercase
    
    ### What is this PR for?
    Auto convert experiment name to lowercase cause k8s don't support name 
contains uppercase characters
    
    contain no more than 253 characters
    contain only lowercase alphanumeric characters, '-' or '.'
    start with an alphanumeric character
    end with an alphanumeric character
    https://kubernetes.io/docs/concepts/overview/working-with-objects/names/
    
    ### What type of PR is it?
    [Improvement]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/projects/SUBMARINE/issues/SUBMARINE-641
    
    ### How should this be tested?
    https://travis-ci.org/github/aeioulisa/submarine/builds/731539436
    * First time? Setup Travis CI as described on 
https://submarine.apache.org/contribution/contributions.html#continuous-integration
    * Strongly recommended: add automated unit tests for any new or changed 
behavior
    * Outline any manual steps to test the PR here.
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Lisa <[email protected]>
    
    Closes #422 from aeioulisa/SUBMARINE-641 and squashes the following commits:
    
    1471934 [Lisa] Merge branch 'SUBMARINE-641' of 
https://github.com/aeioulisa/submarine into SUBMARINE-641
    0711363 [Lisa] Auto convert experiment name to lowercase
    7100d22 [Lisa] Auto convert experiment name to lowercase
    e0c5930 [Lisa] Auto convert experiment name to lowercase
---
 .../submarine/server/experiment/ExperimentManager.java   | 16 +++++++++++++---
 .../submarine/server/notebook/NotebookManager.java       |  2 ++
 .../experiment-customized-form.component.ts              |  3 ++-
 .../app/pages/workbench/notebook/notebook.component.ts   |  3 +--
 4 files changed, 18 insertions(+), 6 deletions(-)

diff --git 
a/submarine-server/server-core/src/main/java/org/apache/submarine/server/experiment/ExperimentManager.java
 
b/submarine-server/server-core/src/main/java/org/apache/submarine/server/experiment/ExperimentManager.java
index 28950ce..6e38429 100644
--- 
a/submarine-server/server-core/src/main/java/org/apache/submarine/server/experiment/ExperimentManager.java
+++ 
b/submarine-server/server-core/src/main/java/org/apache/submarine/server/experiment/ExperimentManager.java
@@ -53,8 +53,8 @@ public class ExperimentManager {
 
   /**
    * Used to cache the specs by the experiment id.
-   *  key: the string of experiment id
-   *  value: Experiment object
+   * key: the string of experiment id
+   * value: Experiment object
    */
   private final ConcurrentMap<String, Experiment> cachedExperimentMap = new 
ConcurrentHashMap<>();
 
@@ -62,6 +62,7 @@ public class ExperimentManager {
 
   /**
    * Get the singleton instance
+   *
    * @return object
    */
   public static ExperimentManager getInstance() {
@@ -81,6 +82,7 @@ public class ExperimentManager {
 
   /**
    * Create experiment
+   *
    * @param spec spec
    * @return object
    * @throws SubmarineRuntimeException the service error
@@ -94,6 +96,8 @@ public class ExperimentManager {
     String url = getSQLAlchemyURL();
     spec.getMeta().getEnvVars().put(RestConstants.JOB_ID, id.toString());
     spec.getMeta().getEnvVars().put(RestConstants.SUBMARINE_TRACKING_URI, url);
+    String lowerName = spec.getMeta().getName().toLowerCase();
+    spec.getMeta().setName(lowerName);
 
     Experiment experiment = submitter.createExperiment(spec);
     experiment.setExperimentId(id);
@@ -121,6 +125,7 @@ public class ExperimentManager {
 
   /**
    * Get experiment
+   *
    * @param id experiment id
    * @return object
    * @throws SubmarineRuntimeException the service error
@@ -136,6 +141,7 @@ public class ExperimentManager {
 
   /**
    * List experiments
+   *
    * @param status status, if null will return all experiments
    * @return list
    * @throws SubmarineRuntimeException the service error
@@ -158,7 +164,8 @@ public class ExperimentManager {
 
   /**
    * Patch the experiment
-   * @param id experiment id
+   *
+   * @param id   experiment id
    * @param spec spec
    * @return object
    * @throws SubmarineRuntimeException the service error
@@ -175,6 +182,7 @@ public class ExperimentManager {
 
   /**
    * Delete experiment
+   *
    * @param id experiment id
    * @return object
    * @throws SubmarineRuntimeException the service error
@@ -190,6 +198,7 @@ public class ExperimentManager {
 
   /**
    * List experiment logs
+   *
    * @param status status, if null will return all experiment logs
    * @return log list
    * @throws SubmarineRuntimeException the service error
@@ -212,6 +221,7 @@ public class ExperimentManager {
 
   /**
    * Get experiment log
+   *
    * @param id experiment id
    * @return object
    * @throws SubmarineRuntimeException the service error
diff --git 
a/submarine-server/server-core/src/main/java/org/apache/submarine/server/notebook/NotebookManager.java
 
b/submarine-server/server-core/src/main/java/org/apache/submarine/server/notebook/NotebookManager.java
index 1e78022..bb932d0 100644
--- 
a/submarine-server/server-core/src/main/java/org/apache/submarine/server/notebook/NotebookManager.java
+++ 
b/submarine-server/server-core/src/main/java/org/apache/submarine/server/notebook/NotebookManager.java
@@ -79,6 +79,8 @@ public class NotebookManager {
    */
   public Notebook createNotebook(NotebookSpec spec) throws 
SubmarineRuntimeException {
     checkNotebookSpec(spec);
+    String lowerName = spec.getMeta().getName().toLowerCase();
+    spec.getMeta().setName(lowerName);
     Notebook notebook = submitter.createNotebook(spec);
     notebook.setNotebookId(generateNotebookId());
     notebook.setSpec(spec);
diff --git 
a/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-customized-form/experiment-customized-form.component.ts
 
b/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-customized-form/experiment-customized-form.component.ts
index 048cedd..54c2711 100644
--- 
a/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-customized-form/experiment-customized-form.component.ts
+++ 
b/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-customized-form/experiment-customized-form.component.ts
@@ -314,9 +314,10 @@ export class ExperimentCustomizedFormComponent implements 
OnInit, OnDestroy {
    * Construct spec for new experiment creation
    */
   constructSpec(): ExperimentSpec {
+
     // Construct the spec
     const meta: ExperimentMeta = {
-      name: this.experimentName.value,
+      name: this.experimentName.value.toLowerCase(),
       namespace: this.namespace.value,
       framework: this.framework === 'Standalone' ? 'Tensorflow' : 
this.framework,
       cmd: this.cmd.value,
diff --git 
a/submarine-workbench/workbench-web-ng/src/app/pages/workbench/notebook/notebook.component.ts
 
b/submarine-workbench/workbench-web-ng/src/app/pages/workbench/notebook/notebook.component.ts
index 8c65912..8e0ff71 100644
--- 
a/submarine-workbench/workbench-web-ng/src/app/pages/workbench/notebook/notebook.component.ts
+++ 
b/submarine-workbench/workbench-web-ng/src/app/pages/workbench/notebook/notebook.component.ts
@@ -233,11 +233,10 @@ export class NotebookComponent implements OnInit {
         this.notebookForm.get('memoryNum').value
       }${this.notebookForm.get('unit').value}`;
     }
-
     // Develope submmit spec
     const newNotebookSpec = {
       meta: {
-        name: this.notebookForm.get('notebookName').value,
+        name: this.notebookForm.get('notebookName').value.toLowerCase(),
         namespace: 'default'
       },
       environment: {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to