[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-14 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265849340
 
 

 ##
 File path: scripts/docker/submarine/submarine-interpreter-cpu-1.0.0/Dockerfile
 ##
 @@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM zeppelin-tensorflow_1.10-hadoop_3.1.2-cpu:1.0.0
 
 Review comment:
   hmm, it looks to be uncommon to put version number in image name? 
https://hub.docker.com/u/apache?page=2
   
   other than that I don't have any good/useful suggestion. perhaps the latest 
you have is fine
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-13 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265410906
 
 

 ##
 File path: 
submarine/src/main/java/org/apache/zeppelin/submarine/commons/SubmarineConstants.java
 ##
 @@ -0,0 +1,119 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.submarine.commons;
+
+/*
+ * NOTE: use lowercase + "_" for the option name
+ */
+public class SubmarineConstants {
+  // Docker container Environmental variable at `submarine-job-run-tf.jinja`
+  // and `/bin/interpreter.sh`
+  public static final String DOCKER_HADOOP_HDFS_HOME = 
"DOCKER_HADOOP_HDFS_HOME";
+  public static final String DOCKER_JAVA_HOME= "DOCKER_JAVA_HOME";
+  public static final String DOCKER_CONTAINER_TIME_ZONE = 
"DOCKER_CONTAINER_TIME_ZONE";
+  public static final String INTERPRETER_LAUNCH_MODE = 
"INTERPRETER_LAUNCH_MODE";
+
+  // interpreter.sh Environmental variable
+  public static final String SUBMARINE_HADOOP_HOME  = "SUBMARINE_HADOOP_HOME";
+  public static final String HADOOP_YARN_SUBMARINE_JAR  = 
"HADOOP_YARN_SUBMARINE_JAR";
+  public static final String SUBMARINE_INTERPRETER_DOCKER_IMAGE
+  = "SUBMARINE_INTERPRETER_DOCKER_IMAGE";
+
+  public static final String ZEPPELIN_SUBMARINE_AUTH_TYPE = 
"zeppelin.submarine.auth.type";
+  public static final String SUBMARINE_HADOOP_CONF_DIR  = 
"SUBMARINE_HADOOP_CONF_DIR";
+  public static final String SUBMARINE_HADOOP_KEYTAB= 
"SUBMARINE_HADOOP_KEYTAB";
+  public static final String SUBMARINE_HADOOP_PRINCIPAL = 
"SUBMARINE_HADOOP_PRINCIPAL";
+  public static final String SUBMARINE_HADOOP_KRB5_CONF = 
"submarine.hadoop.krb5.conf";
+
+  public static final String JOB_NAME = "JOB_NAME";
+  public static final String CLEAN_CHECKPOINT = "CLEAN_CHECKPOINT";
+  public static final String INPUT_PATH = "INPUT_PATH";
+  public static final String CHECKPOINT_PATH = "CHECKPOINT_PATH";
+  public static final String PS_LAUNCH_CMD = "PS_LAUNCH_CMD";
+  public static final String WORKER_LAUNCH_CMD = "WORKER_LAUNCH_CMD";
+  public static final String MACHINELEARING_DISTRIBUTED_ENABLE
+  = "machinelearing.distributed.enable";
 
 Review comment:
   `machinelearing` -> `machinelearning`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-13 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265410868
 
 

 ##
 File path: 
submarine/src/main/java/org/apache/zeppelin/submarine/commons/SubmarineConstants.java
 ##
 @@ -0,0 +1,119 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.submarine.commons;
+
+/*
+ * NOTE: use lowercase + "_" for the option name
+ */
+public class SubmarineConstants {
+  // Docker container Environmental variable at `submarine-job-run-tf.jinja`
+  // and `/bin/interpreter.sh`
+  public static final String DOCKER_HADOOP_HDFS_HOME = 
"DOCKER_HADOOP_HDFS_HOME";
+  public static final String DOCKER_JAVA_HOME= "DOCKER_JAVA_HOME";
+  public static final String DOCKER_CONTAINER_TIME_ZONE = 
"DOCKER_CONTAINER_TIME_ZONE";
+  public static final String INTERPRETER_LAUNCH_MODE = 
"INTERPRETER_LAUNCH_MODE";
+
+  // interpreter.sh Environmental variable
+  public static final String SUBMARINE_HADOOP_HOME  = "SUBMARINE_HADOOP_HOME";
+  public static final String HADOOP_YARN_SUBMARINE_JAR  = 
"HADOOP_YARN_SUBMARINE_JAR";
+  public static final String SUBMARINE_INTERPRETER_DOCKER_IMAGE
+  = "SUBMARINE_INTERPRETER_DOCKER_IMAGE";
+
+  public static final String ZEPPELIN_SUBMARINE_AUTH_TYPE = 
"zeppelin.submarine.auth.type";
+  public static final String SUBMARINE_HADOOP_CONF_DIR  = 
"SUBMARINE_HADOOP_CONF_DIR";
+  public static final String SUBMARINE_HADOOP_KEYTAB= 
"SUBMARINE_HADOOP_KEYTAB";
+  public static final String SUBMARINE_HADOOP_PRINCIPAL = 
"SUBMARINE_HADOOP_PRINCIPAL";
+  public static final String SUBMARINE_HADOOP_KRB5_CONF = 
"submarine.hadoop.krb5.conf";
+
+  public static final String JOB_NAME = "JOB_NAME";
+  public static final String CLEAN_CHECKPOINT = "CLEAN_CHECKPOINT";
+  public static final String INPUT_PATH = "INPUT_PATH";
+  public static final String CHECKPOINT_PATH = "CHECKPOINT_PATH";
+  public static final String PS_LAUNCH_CMD = "PS_LAUNCH_CMD";
+  public static final String WORKER_LAUNCH_CMD = "WORKER_LAUNCH_CMD";
+  public static final String MACHINELEARING_DISTRIBUTED_ENABLE
+  = "machinelearing.distributed.enable";
+
+  public static final String ZEPPELIN_INTERPRETER_RPC_PORTRANGE
+  = "zeppelin.interpreter.rpc.portRange";
 
 Review comment:
   if this only affects submarine, suggest calling it `submarine.rpc.portRange` 
or `submarine.interpreter.rpc.portRange`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-13 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265410534
 
 

 ##
 File path: 
submarine/src/main/java/org/apache/zeppelin/submarine/SubmarineInterpreter.java
 ##
 @@ -0,0 +1,275 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.submarine;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.zeppelin.display.ui.OptionInput.ParamOption;
+import org.apache.zeppelin.interpreter.Interpreter;
+import org.apache.zeppelin.interpreter.InterpreterContext;
+import org.apache.zeppelin.interpreter.InterpreterResult;
+import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
+import org.apache.zeppelin.scheduler.Scheduler;
+import org.apache.zeppelin.scheduler.SchedulerFactory;
+import org.apache.zeppelin.submarine.commons.SubmarineCommand;
+import org.apache.zeppelin.submarine.commons.SubmarineConstants;
+import org.apache.zeppelin.submarine.job.SubmarineJob;
+import org.apache.zeppelin.submarine.commons.SubmarineUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.List;
+import java.util.Properties;
+
+import static 
org.apache.zeppelin.submarine.commons.SubmarineCommand.CLEAN_RUNTIME_CACHE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.CHECKPOINT_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.CLEAN_CHECKPOINT;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_CLEAN;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_JOB_RUN;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_JOB_SHOW;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_TYPE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_USAGE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.INPUT_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.MACHINELEARING_DISTRIBUTED_ENABLE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.OPERATION_TYPE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.PS_LAUNCH_CMD;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.SUBMARINE_ALGORITHM_HDFS_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.TF_CHECKPOINT_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.USERNAME_SYMBOL;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.WORKER_LAUNCH_CMD;
+import static org.apache.zeppelin.submarine.commons.SubmarineUtils.unifyKey;
+
+/**
+ * SubmarineInterpreter of Hadoop Submarine implementation.
+ * Support for Hadoop Submarine cli. All the commands documented here
+ * 
https://github.com/apache/hadoop/tree/trunk/hadoop-submarine/hadoop-submarine-core
+ * /src/site/markdown/QuickStart.md is supported.
+ */
+public class SubmarineInterpreter extends Interpreter {
+  private Logger LOGGER = LoggerFactory.getLogger(SubmarineInterpreter.class);
+
+  // Number of submarines executed in parallel for each interpreter instance
+  protected int concurrentExecutedMax = 1;
+
+  private boolean needUpdateConfig = true;
+  private String currentReplName = "";
+
+  SubmarineContext submarineContext = null;
+
+  public SubmarineInterpreter(Properties properties) {
+super(properties);
+
+String concurrentMax = 
getProperty(SubmarineConstants.SUBMARINE_CONCURRENT_MAX, "1");
+concurrentExecutedMax = Integer.parseInt(concurrentMax);
+
+submarineContext = SubmarineContext.getInstance();
+  }
+
+  @Override
+  public void open() {
+LOGGER.info("SubmarineInterpreter open()");
+  }
+
+  @Override
+  public void close() {
+submarineContext.stopAllSubmarineJob();
+  }
+
+  private void setParagraphConfig(InterpreterContext context) {
+String replName = context.getReplName();
+if (StringUtils.equals(currentReplName, replName)) {
+  currentReplName = context.getReplName();
+  needUpdateConfig = true;
+}
+if (needUpdateConfig) {
+  needUpdateConfig = false;
+  if (currentReplName.equals("submarine") || currentReplName.isEmpty()) {
+context.getConfig().put("editorHide", true);
+context.getConfig().put("title", 

[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-13 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265410447
 
 

 ##
 File path: 
submarine/src/main/java/org/apache/zeppelin/submarine/SubmarineInterpreter.java
 ##
 @@ -0,0 +1,275 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.submarine;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.zeppelin.display.ui.OptionInput.ParamOption;
+import org.apache.zeppelin.interpreter.Interpreter;
+import org.apache.zeppelin.interpreter.InterpreterContext;
+import org.apache.zeppelin.interpreter.InterpreterResult;
+import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
+import org.apache.zeppelin.scheduler.Scheduler;
+import org.apache.zeppelin.scheduler.SchedulerFactory;
+import org.apache.zeppelin.submarine.commons.SubmarineCommand;
+import org.apache.zeppelin.submarine.commons.SubmarineConstants;
+import org.apache.zeppelin.submarine.job.SubmarineJob;
+import org.apache.zeppelin.submarine.commons.SubmarineUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.List;
+import java.util.Properties;
+
+import static 
org.apache.zeppelin.submarine.commons.SubmarineCommand.CLEAN_RUNTIME_CACHE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.CHECKPOINT_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.CLEAN_CHECKPOINT;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_CLEAN;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_JOB_RUN;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_JOB_SHOW;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_TYPE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_USAGE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.INPUT_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.MACHINELEARING_DISTRIBUTED_ENABLE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.OPERATION_TYPE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.PS_LAUNCH_CMD;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.SUBMARINE_ALGORITHM_HDFS_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.TF_CHECKPOINT_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.USERNAME_SYMBOL;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.WORKER_LAUNCH_CMD;
+import static org.apache.zeppelin.submarine.commons.SubmarineUtils.unifyKey;
+
+/**
+ * SubmarineInterpreter of Hadoop Submarine implementation.
+ * Support for Hadoop Submarine cli. All the commands documented here
+ * 
https://github.com/apache/hadoop/tree/trunk/hadoop-submarine/hadoop-submarine-core
+ * /src/site/markdown/QuickStart.md is supported.
+ */
+public class SubmarineInterpreter extends Interpreter {
+  private Logger LOGGER = LoggerFactory.getLogger(SubmarineInterpreter.class);
+
+  // Number of submarines executed in parallel for each interpreter instance
+  protected int concurrentExecutedMax = 1;
+
+  private boolean needUpdateConfig = true;
+  private String currentReplName = "";
+
+  SubmarineContext submarineContext = null;
+
+  public SubmarineInterpreter(Properties properties) {
+super(properties);
+
+String concurrentMax = 
getProperty(SubmarineConstants.SUBMARINE_CONCURRENT_MAX, "1");
+concurrentExecutedMax = Integer.parseInt(concurrentMax);
+
+submarineContext = SubmarineContext.getInstance();
+  }
+
+  @Override
+  public void open() {
+LOGGER.info("SubmarineInterpreter open()");
+  }
+
+  @Override
+  public void close() {
+submarineContext.stopAllSubmarineJob();
+  }
+
+  private void setParagraphConfig(InterpreterContext context) {
+String replName = context.getReplName();
+if (StringUtils.equals(currentReplName, replName)) {
+  currentReplName = context.getReplName();
+  needUpdateConfig = true;
+}
+if (needUpdateConfig) {
+  needUpdateConfig = false;
+  if (currentReplName.equals("submarine") || currentReplName.isEmpty()) {
 
 Review comment:
   I mean like install any interpreter with a different name `--name` in
   

[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-13 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265409462
 
 

 ##
 File path: scripts/docker/submarine/submarine-interpreter-cpu-1.0.0/Dockerfile
 ##
 @@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM zeppelin-tensorflow_1.10-hadoop_3.1.2-cpu:1.0.0
 
 Review comment:
   why is cpu at the end? maybe it should be 
`zeppelin-cpu-tensorflow_1.10-hadoop_3.1.2`?
   
   also any reason for tensorflow 1.10 vs the latest 1.13? 
https://github.com/tensorflow/tensorflow/releases/tag/v1.13.1
   
   it looks like we need 3 point version number for tensorflow too, 1.10.0?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-13 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265409462
 
 

 ##
 File path: scripts/docker/submarine/submarine-interpreter-cpu-1.0.0/Dockerfile
 ##
 @@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM zeppelin-tensorflow_1.10-hadoop_3.1.2-cpu:1.0.0
 
 Review comment:
   why is cpu at the end? maybe it should be 
`zeppelin-cpu-tensorflow_1.10-hadoop_3.1.2`?
   
   also any reason for tensorflow 1.10 vs the latest 1.13? 
https://github.com/tensorflow/tensorflow/releases/tag/v1.13.1


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-13 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265409266
 
 

 ##
 File path: scripts/docker/submarine/submarine-interpreter-cpu-1.0.0/Dockerfile
 ##
 @@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM zeppelin-tensorflow_1.10-hadoop_3.1.2-cpu:1.0.0
 
 Review comment:
   if we are not releasing / publishing this docker image as a part of the 
Apache Zeppelin release, I think this is ok, otherwise a different naming will 
need to be used


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-13 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265409051
 
 

 ##
 File path: 
scripts/docker/submarine/tensorflow_1.10-hadoop_3.1.2-gpu-1.0.0/Dockerfile
 ##
 @@ -0,0 +1,71 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
+
+# Pick up some TF dependencies
+RUN apt-get update && apt-get install -y --allow-downgrades 
--no-install-recommends \
+  --allow-change-held-packages --allow-unauthenticated \
+  build-essential libfreetype6-dev libpng12-dev \
+  libzmq3-dev pkg-config python python-dev \
+  rsync software-properties-common curl unzip wget grep sed vim \
+iputils-ping net-tools gdb python2.7-dbg tzdata \
+cuda-cublas-9-0 cuda-cufft-9-0 cuda-curand-9-0 cuda-cusolver-9-0 \
+  cuda-cusparse-9-0 libcudnn7=7.0.5.15-1+cuda9.0 && \
+  apt-get clean && \
+  rm -rf /var/lib/apt/lists/*
+
+RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install 
-yq krb5-user libpam-krb5 && apt-get clean
+
+RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
+  python get-pip.py && \
+  rm get-pip.py
+
+RUN echo "Install python related packages" && \
+  apt-get -y update && \
+  apt-get install -y gfortran && \
+  # numerical/algebra packages
+  apt-get install -y libblas-dev libatlas-dev liblapack-dev && \
+  # font, image for matplotlib
+  apt-get install -y libpng-dev libxft-dev && \
+  # for tkinter
+  apt-get install -y python-tk libxml2-dev libxslt-dev zlib1g-dev
+
+RUN pip --no-cache-dir install Pillow h5py ipykernel jupyter matplotlib numpy 
pandas scipy sklearn && \
+  python -m ipykernel.kernelspec
+
+# Set the locale
+# disable bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
+RUN apt-get clean && apt-get update && apt-get install -y locales
+RUN locale-gen en_US.UTF-8
+
+# Install TensorFlow GPU version.
+ENV TENSORFLOW_VERSION="1.10.0"
+RUN pip --no-cache-dir install \
+  
http://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-${TENSORFLOW_VERSION}-cp27-none-linux_x86_64.whl
+RUN apt-get update && apt-get install git -y
+
+# Install hadoop
+ENV HADOOP_VERSION="3.1.2"
+RUN wget 
http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-${HADOOP_VERSION}/hadoop-${HADOOP_VERSION}.tar.gz
 
 Review comment:
   I don't mean the hadoop version - I mean the "http://mirrors...;  site. 
   a) this is known to be unreliable
   b) as a policy, all apache download should be from the download script
   
   
https://www.apache.org/dyn/closer.cgi/hadoop/common/hadoop-3.1.2/hadoop-3.1.2-src.tar.gz
   
   https://hadoop.apache.org/releases.html


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-13 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265334590
 
 

 ##
 File path: 
submarine/src/main/java/org/apache/zeppelin/submarine/SubmarineShellInterpreter.java
 ##
 @@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.submarine;
+
+import org.apache.commons.exec.CommandLine;
+import org.apache.commons.exec.DefaultExecutor;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.zeppelin.interpreter.InterpreterContext;
+import org.apache.zeppelin.interpreter.InterpreterException;
+import org.apache.zeppelin.interpreter.InterpreterResult;
+import org.apache.zeppelin.shell.ShellInterpreter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Properties;
+
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.SUBMARINE_ALGORITHM_HDFS_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.SUBMARINE_HADOOP_KEYTAB;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.SUBMARINE_HADOOP_PRINCIPAL;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.TF_CHECKPOINT_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.USERNAME_SYMBOL;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.ZEPPELIN_SUBMARINE_AUTH_TYPE;
+
+/**
+ * Submarine Shell interpreter for Zeppelin.
+ */
+public class SubmarineShellInterpreter extends ShellInterpreter {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(SubmarineShellInterpreter.class);
+
+  private final boolean isWindows = 
System.getProperty("os.name").startsWith("Windows");
+  private final String shell = isWindows ? "cmd /c" : "bash -c";
+
+  public SubmarineShellInterpreter(Properties property) {
+super(property);
+  }
+
+  @Override
+  public InterpreterResult internalInterpret(String cmd, InterpreterContext 
intpContext) {
+// algorithm path & checkpoint path support replaces ${username} with real 
user name
+String algorithmPath = 
properties.getProperty(SUBMARINE_ALGORITHM_HDFS_PATH, "");
+if (algorithmPath.contains(USERNAME_SYMBOL)) {
+  algorithmPath = algorithmPath.replace(USERNAME_SYMBOL, userName);
+  properties.setProperty(SUBMARINE_ALGORITHM_HDFS_PATH, algorithmPath);
+}
+String checkpointPath = properties.getProperty(
+TF_CHECKPOINT_PATH, "");
+if (checkpointPath.contains(USERNAME_SYMBOL)) {
+  checkpointPath = checkpointPath.replace(USERNAME_SYMBOL, userName);
+  properties.setProperty(TF_CHECKPOINT_PATH, checkpointPath);
+}
+
+return super.internalInterpret(cmd, intpContext);
+  }
+
+  @Override
+  protected boolean runKerberosLogin() {
+try {
+  createSecureConfiguration();
+  return true;
+} catch (Exception e) {
+  LOGGER.error("Unable to run kinit for zeppelin", e);
+}
+return false;
+  }
+
+  public void createSecureConfiguration() throws InterpreterException {
+Properties properties = getProperties();
+CommandLine cmdLine = CommandLine.parse(shell);
+cmdLine.addArgument("-c", false);
+String kinitCommand = String.format("kinit -k -t %s %s",
+properties.getProperty(SUBMARINE_HADOOP_KEYTAB),
+properties.getProperty(SUBMARINE_HADOOP_PRINCIPAL));
+cmdLine.addArgument(kinitCommand, false);
+DefaultExecutor executor = new DefaultExecutor();
+try {
+  executor.execute(cmdLine);
+} catch (Exception e) {
+  LOGGER.error("Unable to run kinit for zeppelin user " + kinitCommand, e);
+  throw new InterpreterException(e);
+}
+  }
+
+  @Override
+  protected boolean isKerboseEnabled() {
+if (!StringUtils.isAnyEmpty(getProperty(ZEPPELIN_SUBMARINE_AUTH_TYPE))
+&& getProperty(ZEPPELIN_SUBMARINE_AUTH_TYPE)
+.equalsIgnoreCase("kerberos")) {
 
 Review comment:
   indentation? can you merge this into the last line


This is an automated message from the Apache Git Service.
To respond to the message, please log on to 

[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-13 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265334757
 
 

 ##
 File path: 
submarine/src/main/java/org/apache/zeppelin/submarine/commons/SubmarineConstants.java
 ##
 @@ -0,0 +1,119 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.submarine.commons;
+
+/*
+ * NOTE: use lowercase + "_" for the option name
+ */
+public class SubmarineConstants {
+  // Docker container Environmental variable at `submarine-job-run-tf.jinja`
+  // and `/bin/interpreter.sh`
+  public static final String DOCKER_HADOOP_HDFS_HOME = 
"DOCKER_HADOOP_HDFS_HOME";
+  public static final String DOCKER_JAVA_HOME= "DOCKER_JAVA_HOME";
+  public static final String DOCKER_CONTAINER_TIME_ZONE = 
"DOCKER_CONTAINER_TIME_ZONE";
+  public static final String INTERPRETER_LAUNCH_MODE = 
"INTERPRETER_LAUNCH_MODE";
+
+  // interpreter.sh Environmental variable
+  public static final String SUBMARINE_HADOOP_HOME  = "SUBMARINE_HADOOP_HOME";
+  public static final String HADOOP_YARN_SUBMARINE_JAR  = 
"HADOOP_YARN_SUBMARINE_JAR";
+  public static final String SUBMARINE_INTERPRETER_DOCKER_IMAGE
+  = "SUBMARINE_INTERPRETER_DOCKER_IMAGE";
+
+  public static final String ZEPPELIN_SUBMARINE_AUTH_TYPE = 
"zeppelin.submarine.auth.type";
+  public static final String SUBMARINE_HADOOP_CONF_DIR  = 
"SUBMARINE_HADOOP_CONF_DIR";
+  public static final String SUBMARINE_HADOOP_KEYTAB= 
"SUBMARINE_HADOOP_KEYTAB";
+  public static final String SUBMARINE_HADOOP_PRINCIPAL = 
"SUBMARINE_HADOOP_PRINCIPAL";
+  public static final String SUBMARINE_HADOOP_KRB5_CONF = 
"submarine.hadoop.krb5.conf";
+
+  public static final String JOB_NAME = "JOB_NAME";
+  public static final String CLEAN_CHECKPOINT = "CLEAN_CHECKPOINT";
+  public static final String INPUT_PATH = "INPUT_PATH";
+  public static final String CHECKPOINT_PATH = "CHECKPOINT_PATH";
+  public static final String PS_LAUNCH_CMD = "PS_LAUNCH_CMD";
+  public static final String WORKER_LAUNCH_CMD = "WORKER_LAUNCH_CMD";
+  public static final String MACHINELEARING_DISTRIBUTED_ENABLE
+  = "machinelearing.distributed.enable";
+
+  public static final String ZEPPELIN_INTERPRETER_RPC_PORTRANGE
+  = "zeppelin.interpreter.rpc.portRange";
 
 Review comment:
   is this defined else where?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-13 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265334232
 
 

 ##
 File path: 
submarine/src/main/java/org/apache/zeppelin/submarine/SubmarineInterpreter.java
 ##
 @@ -0,0 +1,275 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.submarine;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.zeppelin.display.ui.OptionInput.ParamOption;
+import org.apache.zeppelin.interpreter.Interpreter;
+import org.apache.zeppelin.interpreter.InterpreterContext;
+import org.apache.zeppelin.interpreter.InterpreterResult;
+import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
+import org.apache.zeppelin.scheduler.Scheduler;
+import org.apache.zeppelin.scheduler.SchedulerFactory;
+import org.apache.zeppelin.submarine.commons.SubmarineCommand;
+import org.apache.zeppelin.submarine.commons.SubmarineConstants;
+import org.apache.zeppelin.submarine.job.SubmarineJob;
+import org.apache.zeppelin.submarine.commons.SubmarineUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.List;
+import java.util.Properties;
+
+import static 
org.apache.zeppelin.submarine.commons.SubmarineCommand.CLEAN_RUNTIME_CACHE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.CHECKPOINT_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.CLEAN_CHECKPOINT;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_CLEAN;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_JOB_RUN;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_JOB_SHOW;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_TYPE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_USAGE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.INPUT_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.MACHINELEARING_DISTRIBUTED_ENABLE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.OPERATION_TYPE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.PS_LAUNCH_CMD;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.SUBMARINE_ALGORITHM_HDFS_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.TF_CHECKPOINT_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.USERNAME_SYMBOL;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.WORKER_LAUNCH_CMD;
+import static org.apache.zeppelin.submarine.commons.SubmarineUtils.unifyKey;
+
+/**
+ * SubmarineInterpreter of Hadoop Submarine implementation.
+ * Support for Hadoop Submarine cli. All the commands documented here
+ * 
https://github.com/apache/hadoop/tree/trunk/hadoop-submarine/hadoop-submarine-core
+ * /src/site/markdown/QuickStart.md is supported.
+ */
+public class SubmarineInterpreter extends Interpreter {
+  private Logger LOGGER = LoggerFactory.getLogger(SubmarineInterpreter.class);
+
+  // Number of submarines executed in parallel for each interpreter instance
+  protected int concurrentExecutedMax = 1;
+
+  private boolean needUpdateConfig = true;
+  private String currentReplName = "";
+
+  SubmarineContext submarineContext = null;
+
+  public SubmarineInterpreter(Properties properties) {
+super(properties);
+
+String concurrentMax = 
getProperty(SubmarineConstants.SUBMARINE_CONCURRENT_MAX, "1");
+concurrentExecutedMax = Integer.parseInt(concurrentMax);
+
+submarineContext = SubmarineContext.getInstance();
+  }
+
+  @Override
+  public void open() {
+LOGGER.info("SubmarineInterpreter open()");
+  }
+
+  @Override
+  public void close() {
+submarineContext.stopAllSubmarineJob();
+  }
+
+  private void setParagraphConfig(InterpreterContext context) {
+String replName = context.getReplName();
+if (StringUtils.equals(currentReplName, replName)) {
+  currentReplName = context.getReplName();
+  needUpdateConfig = true;
+}
+if (needUpdateConfig) {
+  needUpdateConfig = false;
+  if (currentReplName.equals("submarine") || currentReplName.isEmpty()) {
 
 Review comment:
   IIRC, the interpreter name is configurable? eg.  spark is `spark2` in 

[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-13 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265333214
 
 

 ##
 File path: scripts/docker/submarine/submarine-interpreter-cpu-1.0.0/Dockerfile
 ##
 @@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM zeppelin-tensorflow_1.10-hadoop_3.1.2-cpu:1.0.0
 
 Review comment:
   how is zeppelin-tensorflow_1.10-hadoop_3.1.2-cpu created? it looks like it 
is built by a script in the PR, how is this name chosen?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-13 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265333667
 
 

 ##
 File path: 
scripts/docker/submarine/tensorflow_1.10-hadoop_3.1.2-gpu-1.0.0/Dockerfile
 ##
 @@ -0,0 +1,71 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
+
+# Pick up some TF dependencies
+RUN apt-get update && apt-get install -y --allow-downgrades 
--no-install-recommends \
+  --allow-change-held-packages --allow-unauthenticated \
+  build-essential libfreetype6-dev libpng12-dev \
+  libzmq3-dev pkg-config python python-dev \
+  rsync software-properties-common curl unzip wget grep sed vim \
+iputils-ping net-tools gdb python2.7-dbg tzdata \
+cuda-cublas-9-0 cuda-cufft-9-0 cuda-curand-9-0 cuda-cusolver-9-0 \
+  cuda-cusparse-9-0 libcudnn7=7.0.5.15-1+cuda9.0 && \
+  apt-get clean && \
+  rm -rf /var/lib/apt/lists/*
+
+RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install 
-yq krb5-user libpam-krb5 && apt-get clean
+
+RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
+  python get-pip.py && \
+  rm get-pip.py
+
+RUN echo "Install python related packages" && \
+  apt-get -y update && \
+  apt-get install -y gfortran && \
+  # numerical/algebra packages
+  apt-get install -y libblas-dev libatlas-dev liblapack-dev && \
+  # font, image for matplotlib
+  apt-get install -y libpng-dev libxft-dev && \
+  # for tkinter
+  apt-get install -y python-tk libxml2-dev libxslt-dev zlib1g-dev
+
+RUN pip --no-cache-dir install Pillow h5py ipykernel jupyter matplotlib numpy 
pandas scipy sklearn && \
+  python -m ipykernel.kernelspec
+
+# Set the locale
+# disable bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
+RUN apt-get clean && apt-get update && apt-get install -y locales
+RUN locale-gen en_US.UTF-8
+
+# Install TensorFlow GPU version.
+ENV TENSORFLOW_VERSION="1.10.0"
+RUN pip --no-cache-dir install \
+  
http://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-${TENSORFLOW_VERSION}-cp27-none-linux_x86_64.whl
+RUN apt-get update && apt-get install git -y
+
+# Install hadoop
+ENV HADOOP_VERSION="3.1.2"
+RUN wget 
http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-${HADOOP_VERSION}/hadoop-${HADOOP_VERSION}.tar.gz
 
 Review comment:
   we can't hardcode the mirror


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop Submarine (Machine Learning) interpreter

2019-03-13 Thread GitBox
felixcheung commented on a change in pull request #3331: [Zeppelin-4049] Hadoop 
Submarine (Machine Learning) interpreter
URL: https://github.com/apache/zeppelin/pull/3331#discussion_r265334390
 
 

 ##
 File path: 
submarine/src/main/java/org/apache/zeppelin/submarine/SubmarineInterpreter.java
 ##
 @@ -0,0 +1,275 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.submarine;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.zeppelin.display.ui.OptionInput.ParamOption;
+import org.apache.zeppelin.interpreter.Interpreter;
+import org.apache.zeppelin.interpreter.InterpreterContext;
+import org.apache.zeppelin.interpreter.InterpreterResult;
+import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
+import org.apache.zeppelin.scheduler.Scheduler;
+import org.apache.zeppelin.scheduler.SchedulerFactory;
+import org.apache.zeppelin.submarine.commons.SubmarineCommand;
+import org.apache.zeppelin.submarine.commons.SubmarineConstants;
+import org.apache.zeppelin.submarine.job.SubmarineJob;
+import org.apache.zeppelin.submarine.commons.SubmarineUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.List;
+import java.util.Properties;
+
+import static 
org.apache.zeppelin.submarine.commons.SubmarineCommand.CLEAN_RUNTIME_CACHE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.CHECKPOINT_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.CLEAN_CHECKPOINT;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_CLEAN;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_JOB_RUN;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_JOB_SHOW;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_TYPE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.COMMAND_USAGE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.INPUT_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.MACHINELEARING_DISTRIBUTED_ENABLE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.OPERATION_TYPE;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.PS_LAUNCH_CMD;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.SUBMARINE_ALGORITHM_HDFS_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.TF_CHECKPOINT_PATH;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.USERNAME_SYMBOL;
+import static 
org.apache.zeppelin.submarine.commons.SubmarineConstants.WORKER_LAUNCH_CMD;
+import static org.apache.zeppelin.submarine.commons.SubmarineUtils.unifyKey;
+
+/**
+ * SubmarineInterpreter of Hadoop Submarine implementation.
+ * Support for Hadoop Submarine cli. All the commands documented here
+ * 
https://github.com/apache/hadoop/tree/trunk/hadoop-submarine/hadoop-submarine-core
+ * /src/site/markdown/QuickStart.md is supported.
+ */
+public class SubmarineInterpreter extends Interpreter {
+  private Logger LOGGER = LoggerFactory.getLogger(SubmarineInterpreter.class);
+
+  // Number of submarines executed in parallel for each interpreter instance
+  protected int concurrentExecutedMax = 1;
+
+  private boolean needUpdateConfig = true;
+  private String currentReplName = "";
+
+  SubmarineContext submarineContext = null;
+
+  public SubmarineInterpreter(Properties properties) {
+super(properties);
+
+String concurrentMax = 
getProperty(SubmarineConstants.SUBMARINE_CONCURRENT_MAX, "1");
+concurrentExecutedMax = Integer.parseInt(concurrentMax);
+
+submarineContext = SubmarineContext.getInstance();
+  }
+
+  @Override
+  public void open() {
+LOGGER.info("SubmarineInterpreter open()");
+  }
+
+  @Override
+  public void close() {
+submarineContext.stopAllSubmarineJob();
+  }
+
+  private void setParagraphConfig(InterpreterContext context) {
+String replName = context.getReplName();
+if (StringUtils.equals(currentReplName, replName)) {
+  currentReplName = context.getReplName();
+  needUpdateConfig = true;
+}
+if (needUpdateConfig) {
+  needUpdateConfig = false;
+  if (currentReplName.equals("submarine") || currentReplName.isEmpty()) {
+context.getConfig().put("editorHide", true);
+context.getConfig().put("title",