You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by pi...@apache.org on 2022/01/03 03:46:05 UTC

[submarine] branch master updated: SUBMARINE-1172. Fix end to end tests

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

pingsutw 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 63f7e2c  SUBMARINE-1172. Fix end to end tests
63f7e2c is described below

commit 63f7e2cbbe001a91e352f3e8858cbf8bab5dede3
Author: Kevin Su <pi...@apache.org>
AuthorDate: Mon Jan 3 03:25:23 2022 +0800

    SUBMARINE-1172. Fix end to end tests
    
    Signed-off-by: Kevin Su <pingsutwapache.org>
    
    ### What is this PR for?
    <!-- A few sentences describing the overall goals of the pull request's commits.
    First time? Check out the contributing guide - https://submarine.apache.org/contribution/contributions.html
    -->
    - Fixed end to end tests https://github.com/apache/submarine/runs/4650012261?check_suite_focus=true and https://github.com/apache/submarine/runs/4650012261?check_suite_focus=true
    - Fixed issues on sonarcloud
    
    ### What type of PR is it?
    [Bug Fix]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    <!-- * Open an issue on Jira https://issues.apache.org/jira/browse/SUBMARINE/
    * Put link here, and add [SUBMARINE-*Jira number*] in PR title, eg. `SUBMARINE-23. PR title`
    -->
    https://issues.apache.org/jira/browse/SUBMARINE-1172
    ### How should this be tested?
    <!--
    * 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.
    -->
    pass all CIs
    ### Screenshots (if appropriate)
    ![image](https://user-images.githubusercontent.com/37936015/147887116-f09c14da-c407-4c59-bf49-931201a2d8a2.png)
    
    ### Questions:
    * Do the license files need updating? No
    * Are there breaking changes for older versions? No
    * Does this need new documentation? No
    
    Author: Kevin Su <pi...@apache.org>
    
    Signed-off-by: Kevin <pi...@apache.org>
    
    Closes #858 from pingsutw/sonar2 and squashes the following commits:
    
    233b4a56 [Kevin Su] SUBMARINE-1172. Fix end to end tests
---
 submarine-cloud-v2/pkg/controller/controller.go         | 14 +++++++-------
 .../org/apache/submarine/server/SubmarineServer.java    | 17 ++++++-----------
 .../org/apache/submarine/server/model/ModelManager.java | 13 +++++--------
 .../workbench/database/utils/MybatisGenerator.java      |  2 +-
 4 files changed, 19 insertions(+), 27 deletions(-)

diff --git a/submarine-cloud-v2/pkg/controller/controller.go b/submarine-cloud-v2/pkg/controller/controller.go
index 08c7eb1..9825f7a 100644
--- a/submarine-cloud-v2/pkg/controller/controller.go
+++ b/submarine-cloud-v2/pkg/controller/controller.go
@@ -423,37 +423,37 @@ func (c *Controller) validateSubmarine(submarine *v1alpha1.Submarine) error {
 func (c *Controller) createSubmarine(submarine *v1alpha1.Submarine) error {
 	var err error
 	err = c.createSubmarineServer(submarine)
-	if err != nil {
+	if err != nil && !errors.IsAlreadyExists(err) {
 		return err
 	}
 
 	err = c.createSubmarineDatabase(submarine)
-	if err != nil {
+	if err != nil && !errors.IsAlreadyExists(err) {
 		return err
 	}
 
 	err = c.createIngress(submarine)
-	if err != nil {
+	if err != nil && !errors.IsAlreadyExists(err) {
 		return err
 	}
 
 	err = c.createSubmarineServerRBAC(submarine)
-	if err != nil {
+	if err != nil && !errors.IsAlreadyExists(err) {
 		return err
 	}
 
 	err = c.createSubmarineTensorboard(submarine)
-	if err != nil {
+	if err != nil && !errors.IsAlreadyExists(err) {
 		return err
 	}
 
 	err = c.createSubmarineMlflow(submarine)
-	if err != nil {
+	if err != nil && !errors.IsAlreadyExists(err) {
 		return err
 	}
 
 	err = c.createSubmarineMinio(submarine)
-	if err != nil {
+	if err != nil && !errors.IsAlreadyExists(err) {
 		return err
 	}
 
diff --git a/submarine-server/server-core/src/main/java/org/apache/submarine/server/SubmarineServer.java b/submarine-server/server-core/src/main/java/org/apache/submarine/server/SubmarineServer.java
index 5fb12c4..f8958f1 100644
--- a/submarine-server/server-core/src/main/java/org/apache/submarine/server/SubmarineServer.java
+++ b/submarine-server/server-core/src/main/java/org/apache/submarine/server/SubmarineServer.java
@@ -67,7 +67,7 @@ import java.io.InputStreamReader;
 public class SubmarineServer extends ResourceConfig {
   private static final Logger LOG = LoggerFactory.getLogger(SubmarineServer.class);
 
-  private static final long serverTimeStamp = System.currentTimeMillis();
+  private static final long SERVERTIMESTAMP = System.currentTimeMillis();
 
   public static Server jettyWebServer;
   public static ServiceLocator sharedServiceLocator;
@@ -75,11 +75,10 @@ public class SubmarineServer extends ResourceConfig {
   private static final SubmarineConfiguration conf = SubmarineConfiguration.getInstance();
 
   public static long getServerTimeStamp() {
-    return serverTimeStamp;
+    return SERVERTIMESTAMP;
   }
 
-  public static void main(String[] args) throws InterruptedException,
-      IOException {
+  public static void main(String[] args) throws InterruptedException {
     PropertyConfigurator.configure(ClassLoader.getSystemResource("log4j.properties"));
 
     LOG.info("Submarine server Host: " + conf.getServerAddress());
@@ -235,7 +234,6 @@ public class SubmarineServer extends ResourceConfig {
     // Set some timeout options to make debugging easier.
     int timeout = 1000 * 30;
     connector.setIdleTimeout(timeout);
-    // connector.setSoLingerTime(-1);
     connector.setHost(conf.getServerAddress());
     if (conf.useSsl()) {
       connector.setPort(conf.getServerSslPort());
@@ -328,12 +326,7 @@ public class SubmarineServer extends ResourceConfig {
 
       // If index.html does not exist, throw ServletException
       if (!(indexFile.isFile() && indexFile.exists())) {
-        try {
-          throw new Exception("Can't found index html!");
-        } catch (Exception e) {
-          LOG.error(e.getMessage(), e);
-          throw new ServletException("Can't found index html!");
-        }
+        throw new ServletException("Can't found index html!");
       }
 
       StringBuilder sbIndexBuf = new StringBuilder();
@@ -344,6 +337,8 @@ public class SubmarineServer extends ResourceConfig {
         while ((lineTxt = bufferedReader.readLine()) != null) {
           sbIndexBuf.append(lineTxt);
         }
+      } catch (IOException e) {
+        LOG.error(e.getMessage(), e);
       }
 
       response.getWriter().print(sbIndexBuf.toString());
diff --git a/submarine-server/server-core/src/main/java/org/apache/submarine/server/model/ModelManager.java b/submarine-server/server-core/src/main/java/org/apache/submarine/server/model/ModelManager.java
index 09bc136..3d20ba1 100644
--- a/submarine-server/server-core/src/main/java/org/apache/submarine/server/model/ModelManager.java
+++ b/submarine-server/server-core/src/main/java/org/apache/submarine/server/model/ModelManager.java
@@ -55,9 +55,7 @@ public class ModelManager {
   public static ModelManager getInstance() {
     if (manager == null) {
       synchronized (ModelManager.class) {
-        if (manager == null) {
-          manager = new ModelManager(SubmitterManager.loadSubmitter(), new ModelVersionService());
-        }
+        manager = new ModelManager(SubmitterManager.loadSubmitter(), new ModelVersionService());
       }
     }
     return manager;
@@ -70,12 +68,11 @@ public class ModelManager {
     setServeInfo(spec);
 
 
-    LOG.info("Create " + spec.getModelType() + " model serve");
+    LOG.info("Create {} + model serve", spec.getModelType());
 
     submitter.createServe(spec);
 
-    ServeResponse serveResponse = getServeResponse(spec);
-    return serveResponse;
+    return getServeResponse();
   }
 
   /**
@@ -84,7 +81,7 @@ public class ModelManager {
   public void deleteServe(ServeSpec spec) throws SubmarineRuntimeException {
     setServeInfo(spec);
 
-    LOG.info("Delete " + spec.getModelType() + " model serve");
+    LOG.info("Delete {} model serve", spec.getModelType());
 
     submitter.deleteServe(spec);
   }
@@ -115,7 +112,7 @@ public class ModelManager {
     spec.setModelType(modelVersion.getModelType());
   }
 
-  private ServeResponse getServeResponse(ServeSpec spec){
+  private ServeResponse getServeResponse(){
     return new ServeResponse();
   }
 }
diff --git a/submarine-server/server-core/src/main/java/org/apache/submarine/server/workbench/database/utils/MybatisGenerator.java b/submarine-server/server-core/src/main/java/org/apache/submarine/server/workbench/database/utils/MybatisGenerator.java
index ef98f3a..5636ce4 100644
--- a/submarine-server/server-core/src/main/java/org/apache/submarine/server/workbench/database/utils/MybatisGenerator.java
+++ b/submarine-server/server-core/src/main/java/org/apache/submarine/server/workbench/database/utils/MybatisGenerator.java
@@ -66,7 +66,7 @@ public class MybatisGenerator {
       LOG.error(e.getMessage(), e);
     } catch (InterruptedException e) {
       LOG.error(e.getMessage(), e);
-      throw new RuntimeException(e);
+      Thread.currentThread().interrupt();
     }
   }
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org