From fbe2346040b525c559dab7cad0db46ef9fbab30f Mon Sep 17 00:00:00 2001 From: Sachin Date: Fri, 3 Jun 2016 18:32:14 +0530 Subject: [PATCH 1/8] [ZEPPELIN-940] Allow zeppelin server to connect to already executing Remote Interpreter --- .../remote/RemoteInterpreterProcess.java | 100 ++++++++++++------ .../remote/RemoteInterpreterProcessTest.java | 32 ++++++ 2 files changed, 100 insertions(+), 32 deletions(-) diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java index 67a048ba9cc..34e16a2bf74 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java @@ -31,12 +31,18 @@ import java.io.IOException; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; +import java.util.Properties; /** * */ public class RemoteInterpreterProcess implements ExecuteResultHandler { private static final Logger logger = LoggerFactory.getLogger(RemoteInterpreterProcess.class); + private static final String ZEPPELIN_INTERPRETER_PORT = "zeppelin.interpreter.port"; + + private static final String ZEPPELIN_INTERPRETER_HOST = "zeppelin.interpreter.host"; + + public static final String ZEPPELIN_INTERPRETER_ISEXECUTING = "zeppelin.interpreter.isexecuting"; private final AtomicInteger referenceCount; private DefaultExecutor executor; @@ -52,6 +58,8 @@ public class RemoteInterpreterProcess implements ExecuteResultHandler { private final RemoteInterpreterEventPoller remoteInterpreterEventPoller; private final InterpreterContextRunnerPool interpreterContextRunnerPool; private int connectTimeout; + String host = "localhost"; + boolean isInterpreterAlreadyExecuting = false; public RemoteInterpreterProcess(String intpRunner, String intpDir, @@ -91,54 +99,82 @@ public int getPort() { public int reference(InterpreterGroup interpreterGroup) { synchronized (referenceCount) { if (executor == null) { - // start server process - try { - port = RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces(); - } catch (IOException e1) { - throw new InterpreterException(e1); + Properties properties = interpreterGroup.getProperty(); + + if (properties.containsKey(ZEPPELIN_INTERPRETER_ISEXECUTING)) { + isInterpreterAlreadyExecuting = + Boolean.parseBoolean(properties.getProperty(ZEPPELIN_INTERPRETER_ISEXECUTING)); + if (isInterpreterAlreadyExecuting) { + if (properties.containsKey(ZEPPELIN_INTERPRETER_HOST)) { + host = properties.getProperty(ZEPPELIN_INTERPRETER_HOST); + + } else { + throw new InterpreterException("Can't find property " + ZEPPELIN_INTERPRETER_HOST + + ".Please specify the host on which interpreter is executing"); + } + if (properties.containsKey(ZEPPELIN_INTERPRETER_PORT)) { + port = Integer + .parseInt(interpreterGroup.getProperty().getProperty(ZEPPELIN_INTERPRETER_PORT)); + } else { + throw new InterpreterException("Can't find property " + ZEPPELIN_INTERPRETER_PORT + + ".Please specify the port on which interpreter is listening"); + } + } + running = true; } - CommandLine cmdLine = CommandLine.parse(interpreterRunner); - cmdLine.addArgument("-d", false); - cmdLine.addArgument(interpreterDir, false); - cmdLine.addArgument("-p", false); - cmdLine.addArgument(Integer.toString(port), false); - cmdLine.addArgument("-l", false); - cmdLine.addArgument(localRepoDir, false); - - executor = new DefaultExecutor(); - - watchdog = new ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT); - executor.setWatchdog(watchdog); + if (!isInterpreterAlreadyExecuting) { + try { + port = RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces(); + } catch (IOException e1) { + throw new InterpreterException(e1); + } + CommandLine cmdLine = CommandLine.parse(interpreterRunner); + cmdLine.addArgument("-d", false); + cmdLine.addArgument(interpreterDir, false); + cmdLine.addArgument("-p", false); + cmdLine.addArgument(Integer.toString(port), false); + cmdLine.addArgument("-l", false); + cmdLine.addArgument(localRepoDir, false); + + executor = new DefaultExecutor(); + + watchdog = new ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT); + executor.setWatchdog(watchdog); + + running = true; + try { + Map procEnv = EnvironmentUtils.getProcEnvironment(); + procEnv.putAll(env); + + logger.info("Run interpreter process {}", cmdLine); + executor.execute(cmdLine, procEnv, this); + + } catch (IOException e) { + running = false; + throw new InterpreterException(e); + } - running = true; - try { - Map procEnv = EnvironmentUtils.getProcEnvironment(); - procEnv.putAll(env); - - logger.info("Run interpreter process {}", cmdLine); - executor.execute(cmdLine, procEnv, this); - } catch (IOException e) { - running = false; - throw new InterpreterException(e); + } else { + logger.info( + "Not starting interpreter as \"zeppelin.interpreter.isexecuting\" is set to true"); } - long startTime = System.currentTimeMillis(); while (System.currentTimeMillis() - startTime < connectTimeout) { - if (RemoteInterpreterUtils.checkIfRemoteEndpointAccessible("localhost", port)) { + if (RemoteInterpreterUtils.checkIfRemoteEndpointAccessible(host, port)) { break; } else { try { Thread.sleep(500); } catch (InterruptedException e) { - logger.error("Exception in RemoteInterpreterProcess while synchronized reference " + - "Thread.sleep", e); + logger.error("Exception in RemoteInterpreterProcess while synchronized reference " + + "Thread.sleep", e); } } } - clientPool = new GenericObjectPool(new ClientFactory("localhost", port)); + clientPool = new GenericObjectPool(new ClientFactory(host, port)); remoteInterpreterEventPoller.setInterpreterGroup(interpreterGroup); remoteInterpreterEventPoller.setInterpreterProcess(this); diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java index 52d38581ec2..a657e48abda 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java @@ -22,7 +22,10 @@ import static org.mockito.Mockito.*; import java.util.HashMap; +import java.util.Properties; +import org.apache.thrift.TException; +import org.apache.thrift.transport.TTransportException; import org.apache.zeppelin.interpreter.InterpreterGroup; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService.Client; import org.junit.Test; @@ -32,6 +35,7 @@ public class RemoteInterpreterProcessTest { System.getProperty("os.name").startsWith("Windows") ? "../bin/interpreter.cmd" : "../bin/interpreter.sh"; + private static final int DUMMY_PORT=3678; @Test public void testStartStop() { @@ -70,4 +74,32 @@ public void testClientFactory() throws Exception { rip.dereference(); } + + @Test + public void testStartStopRemoteInterpreter() throws TException, InterruptedException { + RemoteInterpreterServer server = new RemoteInterpreterServer(3678); + server.start(); + boolean running = false; + long startTime = System.currentTimeMillis(); + while (System.currentTimeMillis() - startTime < 10 * 1000) { + if (server.isRunning()) { + running = true; + break; + } else { + Thread.sleep(200); + } + } + Properties properties = new Properties(); + properties.setProperty("zeppelin.interpreter.port", "3678"); + properties.setProperty("zeppelin.interpreter.host", "localhost"); + properties.setProperty("zeppelin.interpreter.isexecuting", "true"); + InterpreterGroup intpGroup = mock(InterpreterGroup.class); + when(intpGroup.getProperty()).thenReturn(properties); + RemoteInterpreterProcess rip = new RemoteInterpreterProcess(INTERPRETER_SCRIPT, "nonexists", + "fakeRepo", new HashMap(), 10 * 1000, null); + assertFalse(rip.isRunning()); + assertEquals(0, rip.referenceCount()); + assertEquals(1, rip.reference(intpGroup)); + assertEquals(true, rip.isRunning()); + } } From 355c1f292e1765c8409eb13023bd2b3309e8cbcc Mon Sep 17 00:00:00 2001 From: Sachin Date: Mon, 6 Jun 2016 13:42:21 +0530 Subject: [PATCH 2/8] Add UI component for the accepting Host and Port when executing option is selected --- .../zeppelin/interpreter/Constants.java | 31 +++++++++++++++++ .../remote/RemoteInterpreterProcess.java | 33 ++++++++----------- .../remote/RemoteInterpreterProcessTest.java | 7 ++-- .../interpreter-create.html | 18 ++++++++++ .../app/interpreter/interpreter.controller.js | 11 +++++++ .../src/app/interpreter/interpreter.html | 20 +++++++++++ .../interpreter/InterpreterFactory.java | 5 ++- .../interpreter/InterpreterOption.java | 31 +++++++++++++++++ .../interpreter/InterpreterSetting.java | 2 ++ .../notebook/NoteInterpreterLoader.java | 3 ++ 10 files changed, 137 insertions(+), 24 deletions(-) create mode 100644 zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Constants.java diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Constants.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Constants.java new file mode 100644 index 00000000000..be4263435d7 --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Constants.java @@ -0,0 +1,31 @@ +/* + * 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.interpreter; +/** + * Interpreter related constants + * + * + */ +public class Constants { + public static final String ZEPPELIN_INTERPRETER_PORT = "zeppelin.interpreter.port"; + + public static final String ZEPPELIN_INTERPRETER_HOST = "zeppelin.interpreter.host"; + + public static final String EXECUTING_PROCESS = "executing_process"; + +} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java index 34e16a2bf74..ec1d0e2d6ee 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java @@ -22,6 +22,7 @@ import org.apache.commons.exec.environment.EnvironmentUtils; import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.thrift.TException; +import org.apache.zeppelin.interpreter.Constants; import org.apache.zeppelin.interpreter.InterpreterException; import org.apache.zeppelin.interpreter.InterpreterGroup; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService.Client; @@ -38,12 +39,6 @@ */ public class RemoteInterpreterProcess implements ExecuteResultHandler { private static final Logger logger = LoggerFactory.getLogger(RemoteInterpreterProcess.class); - private static final String ZEPPELIN_INTERPRETER_PORT = "zeppelin.interpreter.port"; - - private static final String ZEPPELIN_INTERPRETER_HOST = "zeppelin.interpreter.host"; - - public static final String ZEPPELIN_INTERPRETER_ISEXECUTING = "zeppelin.interpreter.isexecuting"; - private final AtomicInteger referenceCount; private DefaultExecutor executor; private ExecuteWatchdog watchdog; @@ -99,25 +94,23 @@ public int getPort() { public int reference(InterpreterGroup interpreterGroup) { synchronized (referenceCount) { if (executor == null) { - Properties properties = interpreterGroup.getProperty(); - - if (properties.containsKey(ZEPPELIN_INTERPRETER_ISEXECUTING)) { - isInterpreterAlreadyExecuting = - Boolean.parseBoolean(properties.getProperty(ZEPPELIN_INTERPRETER_ISEXECUTING)); + if (interpreterGroup.containsKey(Constants.EXECUTING_PROCESS)) { + Properties properties = interpreterGroup.getProperty(); + isInterpreterAlreadyExecuting = true; if (isInterpreterAlreadyExecuting) { - if (properties.containsKey(ZEPPELIN_INTERPRETER_HOST)) { - host = properties.getProperty(ZEPPELIN_INTERPRETER_HOST); + if (properties.containsKey(Constants.ZEPPELIN_INTERPRETER_HOST)) { + host = properties.getProperty(Constants.ZEPPELIN_INTERPRETER_HOST); } else { - throw new InterpreterException("Can't find property " + ZEPPELIN_INTERPRETER_HOST - + ".Please specify the host on which interpreter is executing"); + throw new InterpreterException("Can't find value for option Host." + + "Please specify the host on which interpreter is executing"); } - if (properties.containsKey(ZEPPELIN_INTERPRETER_PORT)) { - port = Integer - .parseInt(interpreterGroup.getProperty().getProperty(ZEPPELIN_INTERPRETER_PORT)); + if (properties.containsKey(Constants.ZEPPELIN_INTERPRETER_PORT)) { + port = Integer.parseInt( + interpreterGroup.getProperty().getProperty(Constants.ZEPPELIN_INTERPRETER_PORT)); } else { - throw new InterpreterException("Can't find property " + ZEPPELIN_INTERPRETER_PORT - + ".Please specify the port on which interpreter is listening"); + throw new InterpreterException("Can't find value for option Port." + + "Please specify the port on which interpreter is listening"); } } running = true; diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java index a657e48abda..f9f77504aed 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java @@ -26,6 +26,7 @@ import org.apache.thrift.TException; import org.apache.thrift.transport.TTransportException; +import org.apache.zeppelin.interpreter.Constants; import org.apache.zeppelin.interpreter.InterpreterGroup; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService.Client; import org.junit.Test; @@ -90,11 +91,11 @@ public void testStartStopRemoteInterpreter() throws TException, InterruptedExcep } } Properties properties = new Properties(); - properties.setProperty("zeppelin.interpreter.port", "3678"); - properties.setProperty("zeppelin.interpreter.host", "localhost"); - properties.setProperty("zeppelin.interpreter.isexecuting", "true"); + properties.setProperty(Constants.ZEPPELIN_INTERPRETER_PORT, "3678"); + properties.setProperty(Constants.ZEPPELIN_INTERPRETER_HOST, "localhost"); InterpreterGroup intpGroup = mock(InterpreterGroup.class); when(intpGroup.getProperty()).thenReturn(properties); + when(intpGroup.containsKey(Constants.EXECUTING_PROCESS)).thenReturn(true); RemoteInterpreterProcess rip = new RemoteInterpreterProcess(INTERPRETER_SCRIPT, "nonexists", "fakeRepo", new HashMap(), 10 * 1000, null); assertFalse(rip.isRunning()); diff --git a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html index c46c1d1b900..bb30903ac09 100644 --- a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html +++ b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html @@ -64,11 +64,29 @@

Create new interpreter

isolated +
  • + + executing + +
  • + Interpreter for note
    +
    + Host + +
    +
    + Port + +
    Properties diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index 5d561a7fb40..6c94538cecb 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -73,12 +73,19 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, if (sessionOption === 'isolated') { option.perNoteSession = false; option.perNoteProcess = true; + option.executing = false; } else if (sessionOption === 'scoped') { option.perNoteSession = true; option.perNoteProcess = false; + option.executing = false; + } else if (sessionOption === 'executing') { + option.executing = true; + option.perNoteProcess = false; + option.perNoteSession = false; } else { option.perNoteSession = false; option.perNoteProcess = false; + option.executing = false; } }; @@ -96,6 +103,8 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, return 'scoped'; } else if (option.perNoteProcess) { return 'isolated'; + } else if (option.executing) { + return 'executing'; } else { return 'shared'; } @@ -273,8 +282,10 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, dependencies: [], option: { remote: true, + executing: false, perNoteSession: false, perNoteProcess: false + } }; emptyNewProperty($scope.newInterpreterSetting); diff --git a/zeppelin-web/src/app/interpreter/interpreter.html b/zeppelin-web/src/app/interpreter/interpreter.html index 655ef7a548d..e237ffbd517 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.html +++ b/zeppelin-web/src/app/interpreter/interpreter.html @@ -148,11 +148,31 @@
    Option
    isolated +
  • + + executing + +
  • + Interpreter for note +
    + Host + +
    +
    + Port + +
    + +
    Currently there are no properties and dependencies set for this interpreter diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java index 17728406130..da25af9823e 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java @@ -544,7 +544,10 @@ public void createInterpretersForNote( String groupName = interpreterSetting.getGroup(); InterpreterOption option = interpreterSetting.getOption(); Properties properties = interpreterSetting.getProperties(); - + if (option.isExecuting()) { + properties.put(Constants.ZEPPELIN_INTERPRETER_HOST, option.getHost()); + properties.put(Constants.ZEPPELIN_INTERPRETER_PORT, option.getPort()); + } // if interpreters are already there, wait until they're being removed synchronized (interpreterGroup) { long interpreterRemovalWaitStart = System.nanoTime(); diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java index ba6f7b903c1..fedd436e3c5 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java @@ -24,6 +24,37 @@ public class InterpreterOption { boolean remote; boolean perNoteSession; boolean perNoteProcess; + + boolean executing; + + String host; + String port; + + + public boolean isExecuting() { + return executing; + } + + public void setExecuting(boolean executing) { + this.executing = executing; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + public InterpreterOption() { remote = false; diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java index 91eb2c87ece..30ce3cf3962 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java @@ -126,6 +126,8 @@ public String getGroup() { private String getInterpreterProcessKey(String noteId) { if (getOption().isPerNoteProcess()) { return noteId; + } else if (getOption().isExecuting()) { + return Constants.EXECUTING_PROCESS; } else { return SHARED_PROCESS; } diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteInterpreterLoader.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteInterpreterLoader.java index 7e22ca0b40e..0ce859fe167 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteInterpreterLoader.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteInterpreterLoader.java @@ -21,6 +21,7 @@ import java.util.LinkedList; import java.util.List; +import org.apache.zeppelin.interpreter.Constants; import org.apache.zeppelin.interpreter.Interpreter; import org.apache.zeppelin.interpreter.Interpreter.RegisteredInterpreter; import org.apache.zeppelin.interpreter.InterpreterException; @@ -77,6 +78,8 @@ public List getInterpreterSettings() { private String getInterpreterInstanceKey(InterpreterSetting setting) { if (setting.getOption().isPerNoteSession() || setting.getOption().isPerNoteProcess()) { return noteId; + } else if (setting.getOption().isExecuting()) { + return Constants.EXECUTING_PROCESS; } else { return SHARED_SESSION; } From 2e30e3dcafdab40ff26a5eea4fe20d0ac9810ed2 Mon Sep 17 00:00:00 2001 From: Sachin Date: Fri, 3 Jun 2016 18:32:14 +0530 Subject: [PATCH 3/8] [ZEPPELIN-940] Allow zeppelin server to connect to already executing Remote Interpreter --- .../remote/RemoteInterpreterProcess.java | 100 ++++++++++++------ .../remote/RemoteInterpreterProcessTest.java | 32 ++++++ 2 files changed, 100 insertions(+), 32 deletions(-) diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java index 67a048ba9cc..34e16a2bf74 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java @@ -31,12 +31,18 @@ import java.io.IOException; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; +import java.util.Properties; /** * */ public class RemoteInterpreterProcess implements ExecuteResultHandler { private static final Logger logger = LoggerFactory.getLogger(RemoteInterpreterProcess.class); + private static final String ZEPPELIN_INTERPRETER_PORT = "zeppelin.interpreter.port"; + + private static final String ZEPPELIN_INTERPRETER_HOST = "zeppelin.interpreter.host"; + + public static final String ZEPPELIN_INTERPRETER_ISEXECUTING = "zeppelin.interpreter.isexecuting"; private final AtomicInteger referenceCount; private DefaultExecutor executor; @@ -52,6 +58,8 @@ public class RemoteInterpreterProcess implements ExecuteResultHandler { private final RemoteInterpreterEventPoller remoteInterpreterEventPoller; private final InterpreterContextRunnerPool interpreterContextRunnerPool; private int connectTimeout; + String host = "localhost"; + boolean isInterpreterAlreadyExecuting = false; public RemoteInterpreterProcess(String intpRunner, String intpDir, @@ -91,54 +99,82 @@ public int getPort() { public int reference(InterpreterGroup interpreterGroup) { synchronized (referenceCount) { if (executor == null) { - // start server process - try { - port = RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces(); - } catch (IOException e1) { - throw new InterpreterException(e1); + Properties properties = interpreterGroup.getProperty(); + + if (properties.containsKey(ZEPPELIN_INTERPRETER_ISEXECUTING)) { + isInterpreterAlreadyExecuting = + Boolean.parseBoolean(properties.getProperty(ZEPPELIN_INTERPRETER_ISEXECUTING)); + if (isInterpreterAlreadyExecuting) { + if (properties.containsKey(ZEPPELIN_INTERPRETER_HOST)) { + host = properties.getProperty(ZEPPELIN_INTERPRETER_HOST); + + } else { + throw new InterpreterException("Can't find property " + ZEPPELIN_INTERPRETER_HOST + + ".Please specify the host on which interpreter is executing"); + } + if (properties.containsKey(ZEPPELIN_INTERPRETER_PORT)) { + port = Integer + .parseInt(interpreterGroup.getProperty().getProperty(ZEPPELIN_INTERPRETER_PORT)); + } else { + throw new InterpreterException("Can't find property " + ZEPPELIN_INTERPRETER_PORT + + ".Please specify the port on which interpreter is listening"); + } + } + running = true; } - CommandLine cmdLine = CommandLine.parse(interpreterRunner); - cmdLine.addArgument("-d", false); - cmdLine.addArgument(interpreterDir, false); - cmdLine.addArgument("-p", false); - cmdLine.addArgument(Integer.toString(port), false); - cmdLine.addArgument("-l", false); - cmdLine.addArgument(localRepoDir, false); - - executor = new DefaultExecutor(); - - watchdog = new ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT); - executor.setWatchdog(watchdog); + if (!isInterpreterAlreadyExecuting) { + try { + port = RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces(); + } catch (IOException e1) { + throw new InterpreterException(e1); + } + CommandLine cmdLine = CommandLine.parse(interpreterRunner); + cmdLine.addArgument("-d", false); + cmdLine.addArgument(interpreterDir, false); + cmdLine.addArgument("-p", false); + cmdLine.addArgument(Integer.toString(port), false); + cmdLine.addArgument("-l", false); + cmdLine.addArgument(localRepoDir, false); + + executor = new DefaultExecutor(); + + watchdog = new ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT); + executor.setWatchdog(watchdog); + + running = true; + try { + Map procEnv = EnvironmentUtils.getProcEnvironment(); + procEnv.putAll(env); + + logger.info("Run interpreter process {}", cmdLine); + executor.execute(cmdLine, procEnv, this); + + } catch (IOException e) { + running = false; + throw new InterpreterException(e); + } - running = true; - try { - Map procEnv = EnvironmentUtils.getProcEnvironment(); - procEnv.putAll(env); - - logger.info("Run interpreter process {}", cmdLine); - executor.execute(cmdLine, procEnv, this); - } catch (IOException e) { - running = false; - throw new InterpreterException(e); + } else { + logger.info( + "Not starting interpreter as \"zeppelin.interpreter.isexecuting\" is set to true"); } - long startTime = System.currentTimeMillis(); while (System.currentTimeMillis() - startTime < connectTimeout) { - if (RemoteInterpreterUtils.checkIfRemoteEndpointAccessible("localhost", port)) { + if (RemoteInterpreterUtils.checkIfRemoteEndpointAccessible(host, port)) { break; } else { try { Thread.sleep(500); } catch (InterruptedException e) { - logger.error("Exception in RemoteInterpreterProcess while synchronized reference " + - "Thread.sleep", e); + logger.error("Exception in RemoteInterpreterProcess while synchronized reference " + + "Thread.sleep", e); } } } - clientPool = new GenericObjectPool(new ClientFactory("localhost", port)); + clientPool = new GenericObjectPool(new ClientFactory(host, port)); remoteInterpreterEventPoller.setInterpreterGroup(interpreterGroup); remoteInterpreterEventPoller.setInterpreterProcess(this); diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java index 52d38581ec2..a657e48abda 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java @@ -22,7 +22,10 @@ import static org.mockito.Mockito.*; import java.util.HashMap; +import java.util.Properties; +import org.apache.thrift.TException; +import org.apache.thrift.transport.TTransportException; import org.apache.zeppelin.interpreter.InterpreterGroup; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService.Client; import org.junit.Test; @@ -32,6 +35,7 @@ public class RemoteInterpreterProcessTest { System.getProperty("os.name").startsWith("Windows") ? "../bin/interpreter.cmd" : "../bin/interpreter.sh"; + private static final int DUMMY_PORT=3678; @Test public void testStartStop() { @@ -70,4 +74,32 @@ public void testClientFactory() throws Exception { rip.dereference(); } + + @Test + public void testStartStopRemoteInterpreter() throws TException, InterruptedException { + RemoteInterpreterServer server = new RemoteInterpreterServer(3678); + server.start(); + boolean running = false; + long startTime = System.currentTimeMillis(); + while (System.currentTimeMillis() - startTime < 10 * 1000) { + if (server.isRunning()) { + running = true; + break; + } else { + Thread.sleep(200); + } + } + Properties properties = new Properties(); + properties.setProperty("zeppelin.interpreter.port", "3678"); + properties.setProperty("zeppelin.interpreter.host", "localhost"); + properties.setProperty("zeppelin.interpreter.isexecuting", "true"); + InterpreterGroup intpGroup = mock(InterpreterGroup.class); + when(intpGroup.getProperty()).thenReturn(properties); + RemoteInterpreterProcess rip = new RemoteInterpreterProcess(INTERPRETER_SCRIPT, "nonexists", + "fakeRepo", new HashMap(), 10 * 1000, null); + assertFalse(rip.isRunning()); + assertEquals(0, rip.referenceCount()); + assertEquals(1, rip.reference(intpGroup)); + assertEquals(true, rip.isRunning()); + } } From 4d51cd9b301594ec0a5f8ce1603395172b9d9264 Mon Sep 17 00:00:00 2001 From: Sachin Date: Mon, 6 Jun 2016 13:42:21 +0530 Subject: [PATCH 4/8] Add UI component for the accepting Host and Port when executing option is selected --- .../zeppelin/interpreter/Constants.java | 31 +++++++++++++++++ .../remote/RemoteInterpreterProcess.java | 33 ++++++++----------- .../remote/RemoteInterpreterProcessTest.java | 7 ++-- .../interpreter-create.html | 18 ++++++++++ .../app/interpreter/interpreter.controller.js | 11 +++++++ .../src/app/interpreter/interpreter.html | 20 +++++++++++ .../interpreter/InterpreterFactory.java | 5 ++- .../interpreter/InterpreterOption.java | 31 +++++++++++++++++ .../interpreter/InterpreterSetting.java | 2 ++ .../notebook/NoteInterpreterLoader.java | 3 ++ 10 files changed, 137 insertions(+), 24 deletions(-) create mode 100644 zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Constants.java diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Constants.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Constants.java new file mode 100644 index 00000000000..be4263435d7 --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Constants.java @@ -0,0 +1,31 @@ +/* + * 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.interpreter; +/** + * Interpreter related constants + * + * + */ +public class Constants { + public static final String ZEPPELIN_INTERPRETER_PORT = "zeppelin.interpreter.port"; + + public static final String ZEPPELIN_INTERPRETER_HOST = "zeppelin.interpreter.host"; + + public static final String EXECUTING_PROCESS = "executing_process"; + +} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java index 34e16a2bf74..ec1d0e2d6ee 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java @@ -22,6 +22,7 @@ import org.apache.commons.exec.environment.EnvironmentUtils; import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.thrift.TException; +import org.apache.zeppelin.interpreter.Constants; import org.apache.zeppelin.interpreter.InterpreterException; import org.apache.zeppelin.interpreter.InterpreterGroup; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService.Client; @@ -38,12 +39,6 @@ */ public class RemoteInterpreterProcess implements ExecuteResultHandler { private static final Logger logger = LoggerFactory.getLogger(RemoteInterpreterProcess.class); - private static final String ZEPPELIN_INTERPRETER_PORT = "zeppelin.interpreter.port"; - - private static final String ZEPPELIN_INTERPRETER_HOST = "zeppelin.interpreter.host"; - - public static final String ZEPPELIN_INTERPRETER_ISEXECUTING = "zeppelin.interpreter.isexecuting"; - private final AtomicInteger referenceCount; private DefaultExecutor executor; private ExecuteWatchdog watchdog; @@ -99,25 +94,23 @@ public int getPort() { public int reference(InterpreterGroup interpreterGroup) { synchronized (referenceCount) { if (executor == null) { - Properties properties = interpreterGroup.getProperty(); - - if (properties.containsKey(ZEPPELIN_INTERPRETER_ISEXECUTING)) { - isInterpreterAlreadyExecuting = - Boolean.parseBoolean(properties.getProperty(ZEPPELIN_INTERPRETER_ISEXECUTING)); + if (interpreterGroup.containsKey(Constants.EXECUTING_PROCESS)) { + Properties properties = interpreterGroup.getProperty(); + isInterpreterAlreadyExecuting = true; if (isInterpreterAlreadyExecuting) { - if (properties.containsKey(ZEPPELIN_INTERPRETER_HOST)) { - host = properties.getProperty(ZEPPELIN_INTERPRETER_HOST); + if (properties.containsKey(Constants.ZEPPELIN_INTERPRETER_HOST)) { + host = properties.getProperty(Constants.ZEPPELIN_INTERPRETER_HOST); } else { - throw new InterpreterException("Can't find property " + ZEPPELIN_INTERPRETER_HOST - + ".Please specify the host on which interpreter is executing"); + throw new InterpreterException("Can't find value for option Host." + + "Please specify the host on which interpreter is executing"); } - if (properties.containsKey(ZEPPELIN_INTERPRETER_PORT)) { - port = Integer - .parseInt(interpreterGroup.getProperty().getProperty(ZEPPELIN_INTERPRETER_PORT)); + if (properties.containsKey(Constants.ZEPPELIN_INTERPRETER_PORT)) { + port = Integer.parseInt( + interpreterGroup.getProperty().getProperty(Constants.ZEPPELIN_INTERPRETER_PORT)); } else { - throw new InterpreterException("Can't find property " + ZEPPELIN_INTERPRETER_PORT - + ".Please specify the port on which interpreter is listening"); + throw new InterpreterException("Can't find value for option Port." + + "Please specify the port on which interpreter is listening"); } } running = true; diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java index a657e48abda..f9f77504aed 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java @@ -26,6 +26,7 @@ import org.apache.thrift.TException; import org.apache.thrift.transport.TTransportException; +import org.apache.zeppelin.interpreter.Constants; import org.apache.zeppelin.interpreter.InterpreterGroup; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService.Client; import org.junit.Test; @@ -90,11 +91,11 @@ public void testStartStopRemoteInterpreter() throws TException, InterruptedExcep } } Properties properties = new Properties(); - properties.setProperty("zeppelin.interpreter.port", "3678"); - properties.setProperty("zeppelin.interpreter.host", "localhost"); - properties.setProperty("zeppelin.interpreter.isexecuting", "true"); + properties.setProperty(Constants.ZEPPELIN_INTERPRETER_PORT, "3678"); + properties.setProperty(Constants.ZEPPELIN_INTERPRETER_HOST, "localhost"); InterpreterGroup intpGroup = mock(InterpreterGroup.class); when(intpGroup.getProperty()).thenReturn(properties); + when(intpGroup.containsKey(Constants.EXECUTING_PROCESS)).thenReturn(true); RemoteInterpreterProcess rip = new RemoteInterpreterProcess(INTERPRETER_SCRIPT, "nonexists", "fakeRepo", new HashMap(), 10 * 1000, null); assertFalse(rip.isRunning()); diff --git a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html index f41dbfbaab5..1e28751a337 100644 --- a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html +++ b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html @@ -64,11 +64,29 @@

    Create new interpreter

    isolated +
  • + + executing + +
  • + Interpreter for note

    +
    + Host + +
    +
    + Port + +
    Properties
    diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index 5d561a7fb40..6c94538cecb 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -73,12 +73,19 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, if (sessionOption === 'isolated') { option.perNoteSession = false; option.perNoteProcess = true; + option.executing = false; } else if (sessionOption === 'scoped') { option.perNoteSession = true; option.perNoteProcess = false; + option.executing = false; + } else if (sessionOption === 'executing') { + option.executing = true; + option.perNoteProcess = false; + option.perNoteSession = false; } else { option.perNoteSession = false; option.perNoteProcess = false; + option.executing = false; } }; @@ -96,6 +103,8 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, return 'scoped'; } else if (option.perNoteProcess) { return 'isolated'; + } else if (option.executing) { + return 'executing'; } else { return 'shared'; } @@ -273,8 +282,10 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, dependencies: [], option: { remote: true, + executing: false, perNoteSession: false, perNoteProcess: false + } }; emptyNewProperty($scope.newInterpreterSetting); diff --git a/zeppelin-web/src/app/interpreter/interpreter.html b/zeppelin-web/src/app/interpreter/interpreter.html index 24831bc9b81..127fec843ac 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.html +++ b/zeppelin-web/src/app/interpreter/interpreter.html @@ -148,11 +148,31 @@
    Option
    isolated +
  • + + executing + +
  • + Interpreter for note +
    + Host + +
    +
    + Port + +
    + +
    Currently there are no properties and dependencies set for this interpreter diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java index 17728406130..da25af9823e 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java @@ -544,7 +544,10 @@ public void createInterpretersForNote( String groupName = interpreterSetting.getGroup(); InterpreterOption option = interpreterSetting.getOption(); Properties properties = interpreterSetting.getProperties(); - + if (option.isExecuting()) { + properties.put(Constants.ZEPPELIN_INTERPRETER_HOST, option.getHost()); + properties.put(Constants.ZEPPELIN_INTERPRETER_PORT, option.getPort()); + } // if interpreters are already there, wait until they're being removed synchronized (interpreterGroup) { long interpreterRemovalWaitStart = System.nanoTime(); diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java index ba6f7b903c1..fedd436e3c5 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java @@ -24,6 +24,37 @@ public class InterpreterOption { boolean remote; boolean perNoteSession; boolean perNoteProcess; + + boolean executing; + + String host; + String port; + + + public boolean isExecuting() { + return executing; + } + + public void setExecuting(boolean executing) { + this.executing = executing; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + public InterpreterOption() { remote = false; diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java index 91eb2c87ece..30ce3cf3962 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java @@ -126,6 +126,8 @@ public String getGroup() { private String getInterpreterProcessKey(String noteId) { if (getOption().isPerNoteProcess()) { return noteId; + } else if (getOption().isExecuting()) { + return Constants.EXECUTING_PROCESS; } else { return SHARED_PROCESS; } diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteInterpreterLoader.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteInterpreterLoader.java index 7e22ca0b40e..0ce859fe167 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteInterpreterLoader.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteInterpreterLoader.java @@ -21,6 +21,7 @@ import java.util.LinkedList; import java.util.List; +import org.apache.zeppelin.interpreter.Constants; import org.apache.zeppelin.interpreter.Interpreter; import org.apache.zeppelin.interpreter.Interpreter.RegisteredInterpreter; import org.apache.zeppelin.interpreter.InterpreterException; @@ -77,6 +78,8 @@ public List getInterpreterSettings() { private String getInterpreterInstanceKey(InterpreterSetting setting) { if (setting.getOption().isPerNoteSession() || setting.getOption().isPerNoteProcess()) { return noteId; + } else if (setting.getOption().isExecuting()) { + return Constants.EXECUTING_PROCESS; } else { return SHARED_SESSION; } From 84d2347fec130095a681d7b23c528ab869b382df Mon Sep 17 00:00:00 2001 From: Sachin Date: Tue, 7 Jun 2016 18:42:51 +0530 Subject: [PATCH 5/8] Added checkbox for Connecting to existing process and renamed the variables --- .../zeppelin/interpreter/Constants.java | 2 +- .../remote/RemoteInterpreterProcess.java | 4 ++-- .../remote/RemoteInterpreterProcessTest.java | 2 +- .../interpreter-create.html | 20 ++++++++--------- .../app/interpreter/interpreter.controller.js | 14 ++++-------- .../src/app/interpreter/interpreter.html | 22 ++++++++++--------- .../interpreter/InterpreterFactory.java | 2 +- .../interpreter/InterpreterOption.java | 12 +++++----- .../interpreter/InterpreterSetting.java | 6 ++--- .../notebook/NoteInterpreterLoader.java | 6 ++--- 10 files changed, 44 insertions(+), 46 deletions(-) diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Constants.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Constants.java index be4263435d7..0ab94ac2c77 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Constants.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Constants.java @@ -26,6 +26,6 @@ public class Constants { public static final String ZEPPELIN_INTERPRETER_HOST = "zeppelin.interpreter.host"; - public static final String EXECUTING_PROCESS = "executing_process"; + public static final String EXISTING_PROCESS = "existing_process"; } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java index ec1d0e2d6ee..05baf623809 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java @@ -94,7 +94,7 @@ public int getPort() { public int reference(InterpreterGroup interpreterGroup) { synchronized (referenceCount) { if (executor == null) { - if (interpreterGroup.containsKey(Constants.EXECUTING_PROCESS)) { + if (interpreterGroup.containsKey(Constants.EXISTING_PROCESS)) { Properties properties = interpreterGroup.getProperty(); isInterpreterAlreadyExecuting = true; if (isInterpreterAlreadyExecuting) { @@ -150,7 +150,7 @@ public int reference(InterpreterGroup interpreterGroup) { } else { logger.info( - "Not starting interpreter as \"zeppelin.interpreter.isexecuting\" is set to true"); + "Not starting interpreter as \"isExistingProcess\" is enabled"); } long startTime = System.currentTimeMillis(); diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java index f9f77504aed..f9d7d3942b5 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java @@ -95,7 +95,7 @@ public void testStartStopRemoteInterpreter() throws TException, InterruptedExcep properties.setProperty(Constants.ZEPPELIN_INTERPRETER_HOST, "localhost"); InterpreterGroup intpGroup = mock(InterpreterGroup.class); when(intpGroup.getProperty()).thenReturn(properties); - when(intpGroup.containsKey(Constants.EXECUTING_PROCESS)).thenReturn(true); + when(intpGroup.containsKey(Constants.EXISTING_PROCESS)).thenReturn(true); RemoteInterpreterProcess rip = new RemoteInterpreterProcess(INTERPRETER_SCRIPT, "nonexists", "fakeRepo", new HashMap(), 10 * 1000, null); assertFalse(rip.isRunning()); diff --git a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html index 1e28751a337..d802b53d847 100644 --- a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html +++ b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html @@ -64,25 +64,25 @@

    Create new interpreter

    isolated -
  • - - executing - -
  • - Interpreter for note

    -
    + +
    +
    + + + +
    +
    +
    Host
    -
    +
    Port diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index 6c94538cecb..86109107df0 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -73,19 +73,12 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, if (sessionOption === 'isolated') { option.perNoteSession = false; option.perNoteProcess = true; - option.executing = false; } else if (sessionOption === 'scoped') { option.perNoteSession = true; option.perNoteProcess = false; - option.executing = false; - } else if (sessionOption === 'executing') { - option.executing = true; - option.perNoteProcess = false; - option.perNoteSession = false; } else { option.perNoteSession = false; option.perNoteProcess = false; - option.executing = false; } }; @@ -103,8 +96,6 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, return 'scoped'; } else if (option.perNoteProcess) { return 'isolated'; - } else if (option.executing) { - return 'executing'; } else { return 'shared'; } @@ -129,6 +120,9 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, if (!setting.option) { setting.option = {}; } + if (setting.option.isExistingProcess === undefined) { + setting.option.isExistingProcess = false; + } if (setting.option.remote === undefined) { // remote always true for now setting.option.remote = true; @@ -282,7 +276,7 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, dependencies: [], option: { remote: true, - executing: false, + isExistingProcess: false, perNoteSession: false, perNoteProcess: false diff --git a/zeppelin-web/src/app/interpreter/interpreter.html b/zeppelin-web/src/app/interpreter/interpreter.html index 127fec843ac..c840f890545 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.html +++ b/zeppelin-web/src/app/interpreter/interpreter.html @@ -148,25 +148,27 @@
    Option
    isolated -
  • - - executing - -
  • - Interpreter for note
    + +
    +
    +
    + + +
    +
    -
    +
    Host
    -
    +
    Port diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java index da25af9823e..bad18c02347 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java @@ -544,7 +544,7 @@ public void createInterpretersForNote( String groupName = interpreterSetting.getGroup(); InterpreterOption option = interpreterSetting.getOption(); Properties properties = interpreterSetting.getProperties(); - if (option.isExecuting()) { + if (option.isExistingProcess) { properties.put(Constants.ZEPPELIN_INTERPRETER_HOST, option.getHost()); properties.put(Constants.ZEPPELIN_INTERPRETER_PORT, option.getPort()); } diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java index fedd436e3c5..f9e43abfcae 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java @@ -25,18 +25,20 @@ public class InterpreterOption { boolean perNoteSession; boolean perNoteProcess; - boolean executing; + boolean isExistingProcess; String host; String port; - public boolean isExecuting() { - return executing; + + + public boolean isExistingProcess() { + return isExistingProcess; } - public void setExecuting(boolean executing) { - this.executing = executing; + public void setExistingProcess(boolean isExistingProcess) { + this.isExistingProcess = isExistingProcess; } public String getPort() { diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java index 30ce3cf3962..20607149283 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java @@ -124,10 +124,10 @@ public String getGroup() { private String getInterpreterProcessKey(String noteId) { - if (getOption().isPerNoteProcess()) { + if (getOption().isExistingProcess) { + return Constants.EXISTING_PROCESS; + } else if (getOption().isPerNoteProcess()) { return noteId; - } else if (getOption().isExecuting()) { - return Constants.EXECUTING_PROCESS; } else { return SHARED_PROCESS; } diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteInterpreterLoader.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteInterpreterLoader.java index 0ce859fe167..b1719c59384 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteInterpreterLoader.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteInterpreterLoader.java @@ -76,10 +76,10 @@ public List getInterpreterSettings() { } private String getInterpreterInstanceKey(InterpreterSetting setting) { - if (setting.getOption().isPerNoteSession() || setting.getOption().isPerNoteProcess()) { + if (setting.getOption().isExistingProcess()) { + return Constants.EXISTING_PROCESS; + } else if (setting.getOption().isPerNoteSession() || setting.getOption().isPerNoteProcess()) { return noteId; - } else if (setting.getOption().isExecuting()) { - return Constants.EXECUTING_PROCESS; } else { return SHARED_SESSION; } From 067a06ed3d2d775f0920849e42e01fcef226f26d Mon Sep 17 00:00:00 2001 From: Sachin Date: Fri, 10 Jun 2016 10:47:08 +0530 Subject: [PATCH 6/8] Add documentation for connecting to existing remote interpreter --- .../img/screenshots/existing_interpreter.png | Bin 0 -> 7350 bytes docs/manual/interpreters.md | 13 +++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 docs/assets/themes/zeppelin/img/screenshots/existing_interpreter.png diff --git a/docs/assets/themes/zeppelin/img/screenshots/existing_interpreter.png b/docs/assets/themes/zeppelin/img/screenshots/existing_interpreter.png new file mode 100644 index 0000000000000000000000000000000000000000..ad32da4c8d5c25e8f0fc75b47be0fa0126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ao*=LLU0)vZ#laGz#{t?vT w;uhlN6XND!JBYcBrN@6Q5IBbpyBENamsSB+Nty=!2Y{;NvH$=8 literal 0 HcmV?d00001 diff --git a/docs/manual/interpreters.md b/docs/manual/interpreters.md index 87a412230d7..f9b0423b967 100644 --- a/docs/manual/interpreters.md +++ b/docs/manual/interpreters.md @@ -60,3 +60,16 @@ Each Interpreter Setting can choose one of 'shared', 'scoped', 'isolated' interp In 'shared' mode, every notebook bound to the Interpreter Setting will share the single Interpreter instance. In 'scoped' mode, each notebook will create new Interpreter instance in the same interpreter process. In 'isolated' mode, each notebook will create new Interpreter process. + + +## Connecting to the Existing Remote Interpreter + +Zeppelin users can start interpreter thread embedded in their service.This will provide flexibility to user to start interpreter on remote host. To start interpreter along with your service you have to create an instance of ``RemoteInterpreterServer`` and start it as follows: + +``RemoteInterpreterServer interpreter=new RemoteInterpreterServer(3789); `` +``// Here, 3678 is the port on which interpreter will listen.`` +``interpreter.start()`` + +The above code will start interpreter thread inside your process.Once the interpreter is started you can configure zeppelin to connect to RemoteInterpreter by checking **Connect to existing process** checkbox and then provide **Host** and **Port** on which interpreter porocess is listening as shown in the image below: + + From f57eb78ac3ea9265191e33a8cf8f4d28f3552a85 Mon Sep 17 00:00:00 2001 From: Sachin Date: Fri, 10 Jun 2016 11:05:39 +0530 Subject: [PATCH 7/8] Incorporated review comments related to documentation --- docs/manual/interpreters.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/manual/interpreters.md b/docs/manual/interpreters.md index f9b0423b967..5312d85cf2f 100644 --- a/docs/manual/interpreters.md +++ b/docs/manual/interpreters.md @@ -64,12 +64,12 @@ In 'shared' mode, every notebook bound to the Interpreter Setting will share the ## Connecting to the Existing Remote Interpreter -Zeppelin users can start interpreter thread embedded in their service.This will provide flexibility to user to start interpreter on remote host. To start interpreter along with your service you have to create an instance of ``RemoteInterpreterServer`` and start it as follows: +Zeppelin users can start interpreter thread embedded in their service. This will provide flexibility to user to start interpreter on remote host. To start interpreter along with your service you have to create an instance of ``RemoteInterpreterServer`` and start it as follows: ``RemoteInterpreterServer interpreter=new RemoteInterpreterServer(3789); `` -``// Here, 3678 is the port on which interpreter will listen.`` +``// Here, 3678 is the port on which interpreter will listen. `` ``interpreter.start()`` -The above code will start interpreter thread inside your process.Once the interpreter is started you can configure zeppelin to connect to RemoteInterpreter by checking **Connect to existing process** checkbox and then provide **Host** and **Port** on which interpreter porocess is listening as shown in the image below: +The above code will start interpreter thread inside your process. Once the interpreter is started you can configure zeppelin to connect to RemoteInterpreter by checking **Connect to existing process** checkbox and then provide **Host** and **Port** on which interpreter porocess is listening as shown in the image below: From f279767c7008449233baab8fd4ceee81a0d7270e Mon Sep 17 00:00:00 2001 From: Sachin Date: Fri, 10 Jun 2016 12:21:21 +0530 Subject: [PATCH 8/8] Changed the Markdown style for code block in document --- docs/manual/interpreters.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/manual/interpreters.md b/docs/manual/interpreters.md index 5312d85cf2f..9fc99b612f7 100644 --- a/docs/manual/interpreters.md +++ b/docs/manual/interpreters.md @@ -66,9 +66,12 @@ In 'shared' mode, every notebook bound to the Interpreter Setting will share the Zeppelin users can start interpreter thread embedded in their service. This will provide flexibility to user to start interpreter on remote host. To start interpreter along with your service you have to create an instance of ``RemoteInterpreterServer`` and start it as follows: -``RemoteInterpreterServer interpreter=new RemoteInterpreterServer(3789); `` -``// Here, 3678 is the port on which interpreter will listen. `` -``interpreter.start()`` +``` +RemoteInterpreterServer interpreter=new RemoteInterpreterServer(3678); +// Here, 3678 is the port on which interpreter will listen. +interpreter.start() + +``` The above code will start interpreter thread inside your process. Once the interpreter is started you can configure zeppelin to connect to RemoteInterpreter by checking **Connect to existing process** checkbox and then provide **Host** and **Port** on which interpreter porocess is listening as shown in the image below: