Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# conf file
conf/zeppelin-env.sh
conf/zeppelin-env.cmd
conf/zeppelin-site.xml
conf/keystore
conf/truststore
Expand Down
112 changes: 112 additions & 0 deletions bin/common.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
@echo off

REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements. See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.

if "%ZEPPELIN_HOME%"=="" (
for %%d in (%~dp0..) do (
set ZEPPELIN_HOME=%%~fd
)
)

if "%ZEPPELIN_CONF_DIR%"=="" (
set ZEPPELIN_CONF_DIR=%ZEPPELIN_HOME%\conf
)

if "%ZEPPELIN_LOG_DIR%"=="" (
set ZEPPELIN_LOG_DIR=%ZEPPELIN_HOME%\logs
)

if "%ZEPPELIN_NOTEBOOK_DIR%"=="" (
set ZEPPELIN_NOTEBOOK_DIR=%ZEPPELIN_HOME%\notebook
)

if "%ZEPPELIN_PID_DIR%"=="" (
set ZEPPELIN_PID_DIR=%ZEPPELIN_HOME%\run
)

if "%ZEPPELIN_WAR%"=="" (
if exist "%ZEPPELIN_HOME%\zeppelin-web\dist" (
set ZEPPELIN_WAR=%ZEPPELIN_HOME%\zeppelin-web\dist
) else (
for %%d in ("%ZEPPELIN_HOME%\zeppelin-web*.war") do (
set ZEPPELIN_WAR=%%d
)
)
)

if "%ZEPPELIN_INTERPRETER_DIR%"=="" (
set ZEPPELIN_INTERPRETER_DIR=%ZEPPELIN_HOME%\interpreter
)

if exist "%ZEPPELIN_CONF_DIR%\zeppelin-env.cmd" (
call %ZEPPELIN_CONF_DIR%\zeppelin-env.cmd
)

if "%ZEPPELIN_CLASSPATH%"=="" (
set ZEPPELIN_CLASSPATH=%ZEPPELIN_CONF_DIR%
) else (
set ZEPPELIN_CLASSPATH=%ZEPPELIN_CLASSPATH%;%ZEPPELIN_CONF_DIR%
)

if "%ZEPPELIN_ENCODING%"=="" (
set ZEPPELIN_ENCODING=UTF-8
)

if "%ZEPPELIN_MEM%"=="" (
set ZEPPELIN_MEM=-Xms1024m -Xmx1024m -XX:MaxPermSize=512m
)

if "%ZEPPELIN_JAVA_OPTS%"=="" (
set ZEPPELIN_JAVA_OPTS=-Dfile.encoding=%ZEPPELIN_ENCODING% %ZEPPELIN_MEM%
) else (
set ZEPPELIN_JAVA_OPTS=%ZEPPELIN_JAVA_OPTS% -Dfile.encoding=%ZEPPELIN_ENCODING% %ZEPPELIN_MEM%
)

if "%JAVA_OPTS%"=="" (
set JAVA_OPTS=%ZEPPELIN_JAVA_OPTS%
) else (
set JAVA_OPTS=%JAVA_OPTS% %ZEPPELIN_JAVA_OPTS%
)

if "%ZEPPELIN_INTP_JAVA_OPTS%"=="" (
set ZEPPELIN_INTP_JAVA_OPTS=%ZEPPELIN_JAVA_OPTS%
)

if "%ZEPPELIN_INTP_MEM%"=="" (
set ZEPPELIN_INTP_MEM=%ZEPPELIN_MEM%
)

set JAVA_INTP_OPTS=%ZEPPELIN_INTP_JAVA_OPTS% -Dfile.encoding=%ZEPPELIN_ENCODING%

if "%JAVA_HOME%"=="" (
set ZEPPELIN_RUNNER=java
) else (
set ZEPPELIN_RUNNER=%JAVA_HOME%\bin\java
)

if "%ZEPPELIN_IDENT_STRING%"=="" (
set ZEPPELIN_IDENT_STRING=%USERNAME%
)

if "%DEBUG%"=="" (
set DEBUG=0
)

if "%ZEPPELIN_INTERPRETER_REMOTE_RUNNER%"=="" (
set ZEPPELIN_INTERPRETER_REMOTE_RUNNER=bin\interpreter.cmd
)

exit /b
38 changes: 38 additions & 0 deletions bin/functions.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
@echo off

REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements. See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.

if not "%1"=="" goto %1

exit /b

:ADDEACHJARINDIR
for %%d in ("%~2\*.jar") do (
set ZEPPELIN_CLASSPATH=%%d;!ZEPPELIN_CLASSPATH!
)
exit /b

:ADDEACHJARINDIRRECURSIVE
for /r "%~2" %%d in (*.jar) do (
set ZEPPELIN_CLASSPATH=%%d;!ZEPPELIN_CLASSPATH!
)
exit /b

:ADDJARINDIR
if exist "%~2" (
set ZEPPELIN_CLASSPATH=%~2\*;%ZEPPELIN_CLASSPATH%
)
exit /b
135 changes: 135 additions & 0 deletions bin/interpreter.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
@echo off

REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements. See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.

setlocal enableextensions enabledelayedexpansion

set bin=%~dp0

:loop
if "%~1"=="" goto cont
if /I "%~1"=="-h" goto usage
if /I "%~1"=="-d" (
set INTERPRETER_DIR=%~2
set INTERPRETER_ID=%~n2
)
if /I "%~1"=="-p" set PORT=%~2
if /I "%~1"=="-l" set LOCAL_INTERPRETER_REPO=%~2
shift
goto loop
:cont

if "%PORT%"=="" goto usage
if "%INTERPRETER_DIR%"=="" goto usage

call "%bin%\common.cmd"

set ZEPPELIN_CLASSPATH=%ZEPPELIN_CLASSPATH%;%ZEPPELIN_CONF_DIR%

if exist "%ZEPPELIN_HOME%\zeppelin-interpreter\target\classes" (
set ZEPPELIN_CLASSPATH=%ZEPPELIN_CLASSPATH%;%ZEPPELIN_HOME%\zeppelin-interpreter\target\classes
) else (
for %%d in ("%ZEPPELIN_HOME%\lib\zeppelin-interpreter*.jar") do (
set ZEPPELIN_INTERPRETER_JAR=%%d
)
set ZEPPELIN_CLASSPATH=%ZEPPELIN_CLASSPATH%;!ZEPPELIN_INTERPRETER_JAR!
)

call "%bin%\functions.cmd" ADDJARINDIR "%ZEPPELIN_HOME%\zeppelin-interpreter\target\lib"
call "%bin%\functions.cmd" ADDJARINDIR "%INTERPRETER_DIR%"

set HOSTNAME=%COMPUTERNAME%
set ZEPPELIN_SERVER=org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer

set ZEPPELIN_LOGFILE=%ZEPPELIN_LOG_DIR%\zeppelin-interpreter-%INTERPRETER_ID%-%ZEPPELIN_IDENT_STRING%-%HOSTNAME%.log
set JAVA_INTP_OPTS=%JAVA_INTP_OPTS% -Dzeppelin.log.file=%ZEPPELIN_LOGFILE%

if not exist "%ZEPPELIN_LOG_DIR%" (
echo Log dir doesn't exist, create %ZEPPELIN_LOG_DIR%
mkdir %ZEPPELIN_LOG_DIR%
)

if /I "%INTERPRETER_ID%"=="spark" (
if not "%SPARK_HOME%"=="" (
set SPARK_SUBMIT=%SPARK_HOME%\bin\spark-submit.cmd
for %%d in ("%ZEPPELIN_HOME%\interpreter\spark\zeppelin-spark*.jar") do (
set SPARK_APP_JAR=%%d
)
set ZEPPELIN_CLASSPATH=%SPARK_APP_JAR%

for %%d in ("%SPARK_HOME%\python\lib\py4j-*-src.zip") do (
set py4j=%%d
)

set PYTHONPATH=%py4j%;%SPARK_HOME%\python;%PYTHONPATH%
) else (
if not "%HADOOP_HOME%"=="" if exist "%HADOOP_HOME%\bin\hadoop.cmd" (
for /f "tokens=*" %%d in ('"%HADOOP_HOME%\bin\hadoop.cmd" classpath') do (
set LOCAL_HADOOP_CLASSPATH=%%d
)
set ZEPPELIN_CLASSPATH=!LOCAL_HADOOP_CLASSPATH!;%ZEPPELIN_CLASSPATH%
)

call "%bin%\functions.cmd" ADDJARINDIR "%INTERPRETER_DIR%\dep"

for %%d in ("%ZEPPELIN_HOME%\interpreter\spark\pyspark\py4j-*-src.zip") do (
set py4j=%%d
)

set PYSPARKPATH=%ZEPPELIN_HOME%\interpreter\spark\pyspark\pyspark.zip;%py4j%

if "%PYTHONPATH%"=="" (
set PYTHONPATH=%PYSPARKPATH%
) else (
set PYTHONPATH=%PYTHONPATH%;%PYSPARKPATH%
)

set PYSPARKPATH=

if not "%HADOOP_HOME%"=="" if "%HADOOP_CONF_DIR%"=="" (
if exist "%HADOOP_HOME%\etc\hadoop" (
set HADOOP_CONF_DIR=%HADOOP_HOME%\etc\hadoop
) else if exist "/etc/hadoop/conf" (
set HADOOP_CONF_DIR=/etc/hadoop/conf
)
)

if exist "%HADOOP_CONF_DIR%" (
set ZEPPELIN_CLASSPATH=%ZEPPELIN_CLASSPATH%;%HADOOP_CONF_DIR%
)

if "%SPARK_CLASSPATH%"=="" (
set SPARK_CLASSPATH=%ZEPPELIN_CLASSPATH%
) else (
set SPARK_CLASSPATH=%SPARK_CLASSPATH%;%ZEPPELIN_CLASSPATH%
)
)
)

call "%bin%\functions.cmd" ADDJARINDIR "%LOCAL_INTERPRETER_REPO%"

set CLASSPATH=%ZEPPELIN_CLASSPATH%

if not "%SPARK_SUBMIT%"=="" (
"%SPARK_SUBMIT%" --class %ZEPPELIN_SERVER% --driver-class-path %ZEPPELIN_CLASSPATH_OVERRIDES%;%CLASSPATH% --driver-java-options "%JAVA_INTP_OPTS%" %SPARK_SUBMIT_OPTIONS% %SPARK_APP_JAR% %PORT%
) else (
"%ZEPPELIN_RUNNER%" %JAVA_INTP_OPTS% %ZEPPELIN_INTP_MEM% -cp %ZEPPELIN_CLASSPATH_OVERRIDES%;%CLASSPATH% %ZEPPELIN_SERVER% %PORT%
)

exit /b

:usage
echo Usage: %~n0 -p ^<port^> -d ^<interpreter dir to load^> -l ^<local interpreter repo dir to load^>
86 changes: 86 additions & 0 deletions bin/zeppelin.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
@echo off

REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements. See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.

setlocal enableextensions enabledelayedexpansion

set bin=%~dp0

if not "%1"=="--config" goto MAIN

:SET_CONFIG
shift
set conf_dir=%~f1
shift
if not exist "%conf_dir%" (
echo ERROR: %conf_dir% is not a directory
echo Usage: %~n0 [--config ^<conf-dir^>]
exit /b 1
) else (
set ZEPPELIN_CONF_DIR=%conf_dir%
)

:MAIN
call "%bin%\common.cmd"

set HOSTNAME=%COMPUTERNAME%
set ZEPPELIN_LOGFILE="%ZEPPELIN_LOG_DIR%\zeppelin-%ZEPPELIN_IDENT_STRING%-%HOSTNAME%.log"
set LOG="%ZEPPELIN_LOG_DIR%\zeppelin-cli-%ZEPPELIN_IDENT_STRING%-%HOSTNAME%.out"

set ZEPPELIN_SERVER=org.apache.zeppelin.server.ZeppelinServer
set JAVA_OPTS=%JAVA_OPTS% -Dzeppelin.log.file=%ZEPPELIN_LOGFILE%

if exist "%ZEPPELIN_HOME%\zeppelin-interpreter\target\classes" (
set ZEPPELIN_CLASSPATH=%ZEPPELIN_CLASSPATH%;"%ZEPPELIN_HOME%\zeppelin-interpreter\target\classes"
)

if exist "%ZEPPELIN_HOME%\zeppelin-zengine\target\classes" (
set ZEPPELIN_CLASSPATH=%ZEPPELIN_CLASSPATH%;"%ZEPPELIN_HOME%\zeppelin-zengine\target\classes"
)

if exist "%ZEPPELIN_HOME%\zeppelin-server\target\classes" (
set ZEPPELIN_CLASSPATH=%ZEPPELIN_CLASSPATH%;"%ZEPPELIN_HOME%\zeppelin-server\target\classes"
)

call "%bin%\functions.cmd" ADDJARINDIR "%ZEPPELIN_HOME%"
call "%bin%\functions.cmd" ADDJARINDIR "%ZEPPELIN_HOME%\lib"
call "%bin%\functions.cmd" ADDJARINDIR "%ZEPPELIN_HOME%\zeppelin-interpreter\target\lib"
call "%bin%\functions.cmd" ADDJARINDIR "%ZEPPELIN_HOME%\zeppelin-zengine\target\lib"
call "%bin%\functions.cmd" ADDJARINDIR "%ZEPPELIN_HOME%\zeppelin-server\target\lib"
call "%bin%\functions.cmd" ADDJARINDIR "%ZEPPELIN_HOME%\zeppelin-web\target\lib"

if "%CLASSPATH%"=="" (
set CLASSPATH=%ZEPPELIN_CLASSPATH%
) else (
set CLASSPATH=%CLASSPATH%;%ZEPPELIN_CLASSPATH%
)

if not exist %ZEPPELIN_LOG_DIR% (
echo Log dir doesn't exist, create %ZEPPELIN_LOG_DIR%
mkdir %ZEPPELIN_LOG_DIR%
)

if not exist %ZEPPELIN_PID_DIR% (
echo Pid dir doesn't exist, create %ZEPPELIN_PID_DIR%
mkdir %ZEPPELIN_PID_DIR%
)

if not exist %ZEPPELIN_NOTEBOOK_DIR% (
echo Notebook dir doesn't exist, create %ZEPPELIN_NOTEBOOK_DIR%
mkdir %ZEPPELIN_NOTEBOOK_DIR%
)

"%ZEPPELIN_RUNNER%" %JAVA_OPTS% -cp %ZEPPELIN_CLASSPATH_OVERRIDES%;%CLASSPATH% %ZEPPELIN_SERVER% "%*"
Loading