Skip to content

Commit 14e120d

Browse files
author
Alex Bush
authored
Merge pull request #2 from apache/master
Merge latest changes from master
2 parents 46981fd + dd1be03 commit 14e120d

File tree

45 files changed

+13213
-258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+13213
-258
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,8 @@ matrix:
5656
env: PYTHON="2" WEB_E2E="true" SCALA_VER="2.11" SPARK_VER="2.1.0" HADOOP_VER="2.6" PROFILE="-Pweb-ci -Pscala-2.11" BUILD_FLAG="package -DskipTests -DskipRat" TEST_FLAG="verify -DskipRat" MODULES="-pl ${INTERPRETERS}" TEST_MODULES="-pl zeppelin-web" TEST_PROJECTS="-Pweb-e2e"
5757
addons:
5858
apt:
59-
sources:
60-
- r-packages-trusty
6159
packages:
6260
- google-chrome-stable
63-
- r-base-dev
6461

6562
# Test core modules
6663
# Several tests were excluded from this configuration due to the following issues:

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ The text of each license is also included at licenses/LICENSE-[project]-[version
257257
(Apache 2.0) Software under ./bigquery/* was developed at Google (http://www.google.com/). Licensed under the Apache v2.0 License.
258258
(Apache 2.0) Roboto Font (https://github.com/google/roboto/)
259259
(Apache 2.0) Gson extra (https://github.com/DanySK/gson-extras)
260+
(Apache 2.0) Nimbus JOSE+JWT (https://bitbucket.org/connect2id/nimbus-jose-jwt/wiki/Home)
260261

261262
========================================================================
262263
BSD 3-Clause licenses

bin/interpreter.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# limitations under the License.
1717
#
1818

19+
1920
bin=$(dirname "${BASH_SOURCE-$0}")
2021
bin=$(cd "${bin}">/dev/null; pwd)
2122

@@ -50,11 +51,6 @@ while getopts "hc:p:r:d:l:v:u:g:" o; do
5051
;;
5152
u)
5253
ZEPPELIN_IMPERSONATE_USER="${OPTARG}"
53-
if [[ -z "$ZEPPELIN_IMPERSONATE_CMD" ]]; then
54-
ZEPPELIN_IMPERSONATE_RUN_CMD=`echo "ssh ${ZEPPELIN_IMPERSONATE_USER}@localhost" `
55-
else
56-
ZEPPELIN_IMPERSONATE_RUN_CMD=$(eval "echo ${ZEPPELIN_IMPERSONATE_CMD} ")
57-
fi
5854
;;
5955
g)
6056
INTERPRETER_SETTING_NAME=${OPTARG}
@@ -96,6 +92,15 @@ INTERPRETER_ID=$(basename "${INTERPRETER_DIR}")
9692
ZEPPELIN_PID="${ZEPPELIN_PID_DIR}/zeppelin-interpreter-${INTERPRETER_ID}-${ZEPPELIN_IDENT_STRING}-${HOSTNAME}.pid"
9793
ZEPPELIN_LOGFILE="${ZEPPELIN_LOG_DIR}/zeppelin-interpreter-${INTERPRETER_SETTING_NAME}-"
9894

95+
if [[ -z "$ZEPPELIN_IMPERSONATE_CMD" ]]; then
96+
if [[ "${INTERPRETER_ID}" != "spark" || "$ZEPPELIN_IMPERSONATE_SPARK_PROXY_USER" == "false" ]]; then
97+
ZEPPELIN_IMPERSONATE_RUN_CMD=`echo "ssh ${ZEPPELIN_IMPERSONATE_USER}@localhost" `
98+
fi
99+
else
100+
ZEPPELIN_IMPERSONATE_RUN_CMD=$(eval "echo ${ZEPPELIN_IMPERSONATE_CMD} ")
101+
fi
102+
103+
99104
if [[ ! -z "$ZEPPELIN_IMPERSONATE_USER" ]]; then
100105
ZEPPELIN_LOGFILE+="${ZEPPELIN_IMPERSONATE_USER}-"
101106
fi
@@ -195,7 +200,7 @@ fi
195200

196201
addJarInDirForIntp "${LOCAL_INTERPRETER_REPO}"
197202

198-
if [[ ! -z "$ZEPPELIN_IMPERSONATE_USER" ]]; then
203+
if [[ ! -z "$ZEPPELIN_IMPERSONATE_USER" && "${INTERPRETER_ID}" != "spark" ]]; then
199204
suid="$(id -u ${ZEPPELIN_IMPERSONATE_USER})"
200205
if [[ -n "${suid}" || -z "${SPARK_SUBMIT}" ]]; then
201206
INTERPRETER_RUN_COMMAND=${ZEPPELIN_IMPERSONATE_RUN_CMD}" '"
@@ -206,15 +211,12 @@ if [[ ! -z "$ZEPPELIN_IMPERSONATE_USER" ]]; then
206211
fi
207212

208213
if [[ -n "${SPARK_SUBMIT}" ]]; then
209-
if [[ -n "$ZEPPELIN_IMPERSONATE_USER" ]] && [[ "$ZEPPELIN_IMPERSONATE_SPARK_PROXY_USER" != "false" ]]; then
210-
INTERPRETER_RUN_COMMAND+=' '` echo ${SPARK_SUBMIT} --class ${ZEPPELIN_SERVER} --driver-class-path \"${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${ZEPPELIN_INTP_CLASSPATH}\" --driver-java-options \"${JAVA_INTP_OPTS}\" ${SPARK_SUBMIT_OPTIONS} ${ZEPPELIN_SPARK_CONF} --proxy-user ${ZEPPELIN_IMPERSONATE_USER} ${SPARK_APP_JAR} ${CALLBACK_HOST} ${PORT} ${INTP_PORT}`
211-
else
212-
INTERPRETER_RUN_COMMAND+=' '` echo ${SPARK_SUBMIT} --class ${ZEPPELIN_SERVER} --driver-class-path \"${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${ZEPPELIN_INTP_CLASSPATH}\" --driver-java-options \"${JAVA_INTP_OPTS}\" ${SPARK_SUBMIT_OPTIONS} ${ZEPPELIN_SPARK_CONF} ${SPARK_APP_JAR} ${CALLBACK_HOST} ${PORT} ${INTP_PORT}`
213-
fi
214+
INTERPRETER_RUN_COMMAND+=' '` echo ${SPARK_SUBMIT} --class ${ZEPPELIN_SERVER} --driver-class-path \"${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${ZEPPELIN_INTP_CLASSPATH}\" --driver-java-options \"${JAVA_INTP_OPTS}\" ${SPARK_SUBMIT_OPTIONS} ${ZEPPELIN_SPARK_CONF} ${SPARK_APP_JAR} ${CALLBACK_HOST} ${PORT} ${INTP_PORT}`
214215
else
215216
INTERPRETER_RUN_COMMAND+=' '` echo ${ZEPPELIN_RUNNER} ${JAVA_INTP_OPTS} ${ZEPPELIN_INTP_MEM} -cp ${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${ZEPPELIN_INTP_CLASSPATH} ${ZEPPELIN_SERVER} ${CALLBACK_HOST} ${PORT} ${INTP_PORT}`
216217
fi
217218

219+
218220
if [[ ! -z "$ZEPPELIN_IMPERSONATE_USER" ]] && [[ -n "${suid}" || -z "${SPARK_SUBMIT}" ]]; then
219221
INTERPRETER_RUN_COMMAND+="'"
220222
fi

conf/shiro.ini.template

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@ user3 = password4, role2
5656
#zeppelinHubRealm.zeppelinhubUrl = https://www.zeppelinhub.com
5757
#securityManager.realms = $zeppelinHubRealm
5858

59+
## A same for configuring Knox SSO Realm
60+
#knoxJwtRealm = org.apache.zeppelin.realm.jwt.KnoxJwtRealm
61+
#knoxJwtRealm.providerUrl = https://domain.example.com/
62+
#knoxJwtRealm.login = gateway/knoxsso/knoxauth/login.html
63+
#knoxJwtRealm.logout = gateway/knoxssout/api/v1/webssout
64+
#knoxJwtRealm.redirectParam = originalUrl
65+
#knoxJwtRealm.cookieName = hadoop-jwt
66+
#knoxJwtRealm.publicKeyPath = /etc/zeppelin/conf/knox-sso.pem
67+
#
68+
#knoxJwtRealm.groupPrincipalMapping = group.principal.mapping
69+
#knoxJwtRealm.principalMapping = principal.mapping
70+
#authc = org.apache.zeppelin.realm.jwt.KnoxAuthenticationFilter
71+
5972
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
6073

6174
### If caching of user is required then uncomment below lines

docs/_includes/themes/zeppelin/_navigation.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
<li><a href="{{BASE_PATH}}/usage/other_features/personalized_mode.html">Personalized Mode</a></li>
6363
<li><a href="{{BASE_PATH}}/usage/other_features/customizing_homepage.html">Customizing Zeppelin Homepage</a></li>
6464
<li><a href="{{BASE_PATH}}/usage/other_features/notebook_actions.html">Notebook Actions</a></li>
65+
<li><a href="{{BASE_PATH}}/usage/other_features/cron_scheduler.html">Cron Scheduler</a></li>
6566
<li role="separator" class="divider"></li>
6667
<li class="title"><span>REST API</span></li>
6768
<li><a href="{{BASE_PATH}}/usage/rest_api/interpreter.html">Interpreter API</a></li>
132 KB
Loading

docs/setup/security/shiro_authentication.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,30 @@ securityManager.realms = $zeppelinHubRealm
210210

211211
> Note: ZeppelinHub is not releated to Apache Zeppelin project.
212212
213+
### Knox SSO
214+
[KnoxSSO](https://knox.apache.org/books/knox-0-13-0/dev-guide.html#KnoxSSO+Integration) provides an abstraction for integrating any number of authentication systems and SSO solutions and enables participating web applications to scale to those solutions more easily. Without the token exchange capabilities offered by KnoxSSO each component UI would need to integrate with each desired solution on its own.
215+
216+
To enable this, apply the following change in `conf/shiro.ini` under `[main]` section.
217+
218+
```
219+
### A sample for configuring Knox JWT Realm
220+
knoxJwtRealm = org.apache.zeppelin.realm.jwt.KnoxJwtRealm
221+
## Domain of Knox SSO
222+
knoxJwtRealm.providerUrl = https://domain.example.com/
223+
## Url for login
224+
knoxJwtRealm.login = gateway/knoxsso/knoxauth/login.html
225+
## Url for logout
226+
knoxJwtRealm.logout = gateway/knoxssout/api/v1/webssout
227+
knoxJwtRealm.redirectParam = originalUrl
228+
knoxJwtRealm.cookieName = hadoop-jwt
229+
knoxJwtRealm.publicKeyPath = /etc/zeppelin/conf/knox-sso.pem
230+
knoxJwtRealm.groupPrincipalMapping = group.principal.mapping
231+
knoxJwtRealm.principalMapping = principal.mapping
232+
# This is required if KNOX SSO is enabled, to check if "knoxJwtRealm.cookieName" cookie was expired/deleted.
233+
authc = org.apache.zeppelin.realm.jwt.KnoxAuthenticationFilter
234+
```
235+
236+
213237
## Secure Cookie for Zeppelin Sessions (optional)
214238
Zeppelin can be configured to set `HttpOnly` flag in the session cookie. With this configuration, Zeppelin cookies can
215239
not be accessed via client side scripts thus preventing majority of Cross-site scripting (XSS) attacks.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
layout: page
3+
title: "Running a Notebook on a Given Schedule Automatically"
4+
description: "You can run a notebook on a given schedule automatically by setting up a cron scheduler on the notebook."
5+
group: usage/other_features
6+
---
7+
<!--
8+
Licensed under the Apache License, Version 2.0 (the "License");
9+
you may not use this file except in compliance with the License.
10+
You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing, software
15+
distributed under the License is distributed on an "AS IS" BASIS,
16+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
See the License for the specific language governing permissions and
18+
limitations under the License.
19+
-->
20+
{% include JB/setup %}
21+
22+
# Running a Notebook on a Given Schedule Automatically
23+
24+
<div id="toc"></div>
25+
26+
Apache Zeppelin provides a cron scheduler for each notebook. You can run a notebook on a given schedule automatically by setting up a cron scheduler on the notebook.
27+
28+
## Setting up a cron scheduler on a notebook
29+
30+
Click the clock icon on the tool bar and open a cron scheduler dialog box.
31+
32+
<img src="{{BASE_PATH}}/assets/themes/zeppelin/img/docs-img/cron_scheduler_dialog_box.png" />
33+
34+
There are the following items which you can input or set:
35+
36+
### Preset
37+
38+
You can set a cron schedule easily by clicking each option such as `1m` and `5m`. The login user is set as a cron executing user automatically. You can also clear the cron schedule settings by clicking `None`.
39+
40+
### Cron expression
41+
42+
You can set the cron schedule by filling in this form. Please see [Cron Trigger Tutorial](http://www.quartz-scheduler.org/documentation/quartz-2.2.x/tutorials/crontrigger) for the available cron syntax.
43+
44+
### Cron executing user
45+
46+
You can set the cron executing user by filling in this form and press the enter key.
47+
48+
### auto-restart interpreter on cron execution
49+
50+
When this checkbox is set to "on", the interpreters which are binded to the notebook are stopped automatically after the cron execution. This feature is useful if you want to release the interpreter resources after the cron execution.
51+
52+
> **Note**: A cron execution is skipped if one of the paragraphs is in a state of `RUNNING` or `PENDING` no matter whether it is executed automatically (i.e. by the cron scheduler) or manually by a user opening this notebook.

markdown/src/main/java/org/apache/zeppelin/markdown/PegdownParser.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ public PegdownParser() {
4141
@Override
4242
public String render(String markdownText) {
4343
String html = "";
44-
String parsed = processor.markdownToHtml(markdownText);
45-
44+
String parsed;
45+
synchronized (processor) {
46+
parsed = processor.markdownToHtml(markdownText);
47+
}
4648
if (null == parsed) {
4749
throw new RuntimeException("Cannot parse markdown text to HTML using pegdown");
4850
}

markdown/src/test/java/org/apache/zeppelin/markdown/PegdownParserTest.java

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,26 @@
1919

2020
import static org.junit.Assert.assertEquals;
2121

22+
import java.util.ArrayList;
2223
import java.util.Properties;
2324
import org.apache.zeppelin.interpreter.InterpreterResult;
2425

2526
import static org.apache.zeppelin.markdown.PegdownParser.wrapWithMarkdownClassDiv;
2627
import static org.junit.Assert.assertThat;
2728

2829
import org.hamcrest.CoreMatchers;
29-
import org.junit.After;
30-
import org.junit.Assert;
31-
import org.junit.Before;
32-
import org.junit.Test;
30+
import org.junit.*;
31+
import org.junit.rules.ErrorCollector;
3332
import org.slf4j.Logger;
3433
import org.slf4j.LoggerFactory;
3534

3635
public class PegdownParserTest {
3736
Logger logger = LoggerFactory.getLogger(PegdownParserTest.class);
3837
Markdown md;
3938

39+
@Rule
40+
public ErrorCollector collector = new ErrorCollector();
41+
4042
@Before
4143
public void setUp() throws Exception {
4244
Properties props = new Properties();
@@ -50,6 +52,35 @@ public void tearDown() throws Exception {
5052
md.close();
5153
}
5254

55+
@Test
56+
public void testMultipleThread() {
57+
ArrayList<Thread> arrThreads = new ArrayList<Thread>();
58+
for (int i = 0; i < 10; i++) {
59+
Thread t = new Thread() {
60+
public void run() {
61+
String r1 = null;
62+
try {
63+
r1 = md.interpret("# H1", null).code().name();
64+
} catch (Exception e) {
65+
logger.error("testTestMultipleThread failed to interpret", e);
66+
}
67+
collector.checkThat("SUCCESS",
68+
CoreMatchers.containsString(r1));
69+
}
70+
};
71+
t.start();
72+
arrThreads.add(t);
73+
}
74+
75+
for (int i = 0; i < 10; i++) {
76+
try {
77+
arrThreads.get(i).join();
78+
} catch (InterruptedException e) {
79+
logger.error("testTestMultipleThread failed to join threads", e);
80+
}
81+
}
82+
}
83+
5384
@Test
5485
public void testHeader() {
5586
InterpreterResult r1 = md.interpret("# H1", null);

0 commit comments

Comments
 (0)