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 2021/02/12 15:10:32 UTC

[submarine] branch master updated: SUBMARINE-732. Wrap tensorboard logdir into an environment variable

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 7421ce2  SUBMARINE-732. Wrap tensorboard logdir into an environment variable
7421ce2 is described below

commit 7421ce25255b6a6ade901a3d1c7543de49c22b38
Author: ByronHsu <by...@gmail.com>
AuthorDate: Tue Feb 9 14:06:14 2021 +0800

    SUBMARINE-732. Wrap tensorboard logdir into an environment variable
    
    ### What is this PR for?
    It is inconvenient for users to manually specify the tensorboard logdir every time, so I wrap the real logdir path into an env variable (SUBMARINE_LOG_DIR).
    The usage is as the following:
    
    ```json
      "meta": {
        "name": "tensorflow-tensorboard-dist-mnist-13",
        "namespace": "default",
        "framework": "TensorFlow",
        "cmd": "python /var/tf_mnist/mnist_with_summaries.py --log_dir=$(SUBMARINE_LOG_DIR) --learning_rate=0.01 --batch_size=20",
        "envVars": {
          "ENV_1": "ENV1"
        }
      },
    ```
    
    ### What type of PR is it?
    [Improvement]
    
    ### Todos
    * [ ] - Tensorboard user doc
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/SUBMARINE-732
    
    ### How should this be tested?
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? Yes
    
    Author: ByronHsu <by...@gmail.com>
    
    Signed-off-by: Kevin <pi...@apache.org>
    
    Closes #506 from ByronHsu/TFBOARD_ENV and squashes the following commits:
    
    2722d3fe [ByronHsu] clarify env name
    f3542855 [ByronHsu] add prefix
    3a1ebb00 [ByronHsu] insert LOG_DIR env var into experiment spec
---
 .../org/apache/submarine/server/experiment/ExperimentManager.java   | 4 ++++
 .../main/java/org/apache/submarine/server/rest/RestConstants.java   | 6 ++++++
 2 files changed, 10 insertions(+)

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 039b17e..e8a6b97 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
@@ -105,6 +105,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);
+    spec.getMeta().getEnvVars().put(RestConstants.LOG_DIR_KEY, RestConstants.LOG_DIR_VALUE);
+    
     String lowerName = spec.getMeta().getName().toLowerCase();
     spec.getMeta().setName(lowerName);
 
@@ -113,6 +115,8 @@ public class ExperimentManager {
 
     spec.getMeta().getEnvVars().remove(RestConstants.JOB_ID);
     spec.getMeta().getEnvVars().remove(RestConstants.SUBMARINE_TRACKING_URI);
+    spec.getMeta().getEnvVars().remove(RestConstants.LOG_DIR_KEY);
+
     experiment.setSpec(spec);
 
     ExperimentEntity entity = buildEntityFromExperiment(experiment);
diff --git a/submarine-server/server-core/src/main/java/org/apache/submarine/server/rest/RestConstants.java b/submarine-server/server-core/src/main/java/org/apache/submarine/server/rest/RestConstants.java
index da66402..c5434c9 100644
--- a/submarine-server/server-core/src/main/java/org/apache/submarine/server/rest/RestConstants.java
+++ b/submarine-server/server-core/src/main/java/org/apache/submarine/server/rest/RestConstants.java
@@ -70,4 +70,10 @@ public class RestConstants {
 
   public static final String NOTEBOOK_ID = "id";
 
+  /**
+   * Tensorboard
+   */
+  public static final String LOG_DIR_KEY = "SUBMARINE_TENSORBOARD_LOG_DIR";
+  public static final String LOG_DIR_VALUE = "/logs/mylog";
+
 }


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