Skip to content

Commit f149c3b

Browse files
authored
Merge pull request #1 from apache/master
update
2 parents 5d4b645 + a94ef00 commit f149c3b

File tree

20 files changed

+221
-63
lines changed

20 files changed

+221
-63
lines changed

conf/zeppelin-site.xml.template

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,4 +711,11 @@
711711
<description>path for storing search index on disk.</description>
712712
</property>
713713

714+
<property>
715+
<name>zeppelin.jobmanager.enable</name>
716+
<value>true</value>
717+
<description>The Job tab in zeppelin page seems not so useful instead it cost lots of memory and affect the performance.
718+
Disable it can save lots of memory</description>
719+
</property>
720+
714721
</configuration>

docs/development/helium/overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ Currently, Helium supports 4 types of package.
3737
- [Helium Interpreter](../writing_zeppelin_interpreter.html): Adding a new custom interpreter
3838

3939

40+
## Configuration
41+
42+
Zeppelin ships with several builtin helium plugins which is located in $ZEPPELIN_HOME/heliums. If you want to try more types of heliums plugins,
43+
you can configure `zeppelin.helium.registry` to be `helium,https://s3.amazonaws.com/helium-package/helium.json` in zeppelin-site.xml. `https://s3.amazonaws.com/helium-package/helium.json` will be updated regularly.

groovy/src/main/java/org/apache/zeppelin/groovy/GObject.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import groovy.lang.Closure;
2020
import groovy.xml.MarkupBuilder;
21-
import org.apache.thrift.TException;
2221
import org.apache.zeppelin.annotation.ZeppelinApi;
2322
import org.apache.zeppelin.display.AngularObject;
2423
import org.apache.zeppelin.display.AngularObjectRegistry;
@@ -240,7 +239,7 @@ public Object angular(String name) {
240239
}
241240

242241
@SuppressWarnings("unchecked")
243-
public void angularBind(String name, Object o, String noteId) throws TException {
242+
public void angularBind(String name, Object o, String noteId) {
244243
z.angularBind(name, o, noteId);
245244
}
246245

@@ -251,7 +250,7 @@ public void angularBind(String name, Object o, String noteId) throws TException
251250
* @param name name of the variable
252251
* @param o value
253252
*/
254-
public void angularBind(String name, Object o) throws TException {
253+
public void angularBind(String name, Object o) {
255254
angularBind(name, o, interpreterContext.getNoteId());
256255
}
257256

zeppelin-interpreter-shaded/pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@
105105
<excludes>
106106
<exclude>org/apache/zeppelin/*</exclude>
107107
<exclude>org/apache/zeppelin/**/*</exclude>
108-
<exclude>org/apache/thrift/*</exclude>
109-
<exclude>org/apache/thrift/**/*</exclude>
110108
<exclude>org/slf4j/*</exclude>
111109
<exclude>org/slf4j/**/*</exclude>
112110
<exclude>org/apache/commons/logging/*</exclude>

zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,10 @@ public boolean isAnonymousAllowed() {
609609
return anonymousAllowed;
610610
}
611611

612+
public boolean isJobManagerEnabled() {
613+
return getBoolean(ConfVars.ZEPPELIN_JOBMANAGER_ENABLE);
614+
}
615+
612616
public boolean isUsernameForceLowerCase() {
613617
return getBoolean(ConfVars.ZEPPELIN_USERNAME_FORCE_LOWERCASE);
614618
}
@@ -920,7 +924,7 @@ public enum ConfVars {
920924
ZEPPELIN_CONFIG_STORAGE_CLASS("zeppelin.config.storage.class",
921925
"org.apache.zeppelin.storage.LocalConfigStorage"),
922926
ZEPPELIN_DEP_LOCALREPO("zeppelin.dep.localrepo", "local-repo"),
923-
ZEPPELIN_HELIUM_REGISTRY("zeppelin.helium.registry", "helium," + HELIUM_PACKAGE_DEFAULT_URL),
927+
ZEPPELIN_HELIUM_REGISTRY("zeppelin.helium.registry", "helium"),
924928
ZEPPELIN_HELIUM_NODE_INSTALLER_URL("zeppelin.helium.node.installer.url",
925929
"https://nodejs.org/dist/"),
926930
ZEPPELIN_HELIUM_NPM_INSTALLER_URL("zeppelin.helium.npm.installer.url",
@@ -993,7 +997,8 @@ public enum ConfVars {
993997
ZEPPELIN_PROXY_PASSWORD("zeppelin.proxy.password", null),
994998
ZEPPELIN_SEARCH_INDEX_REBUILD("zeppelin.search.index.rebuild", false),
995999
ZEPPELIN_SEARCH_USE_DISK("zeppelin.search.use.disk", true),
996-
ZEPPELIN_SEARCH_INDEX_PATH("zeppelin.search.index.path", "/tmp/zeppelin-index");
1000+
ZEPPELIN_SEARCH_INDEX_PATH("zeppelin.search.index.path", "/tmp/zeppelin-index"),
1001+
ZEPPELIN_JOBMANAGER_ENABLE("zeppelin.jobmanager.enable", true);
9971002

9981003
private String varName;
9991004
@SuppressWarnings("rawtypes")

zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/ZeppelinContext.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
package org.apache.zeppelin.interpreter;
1919

20-
import org.apache.thrift.TException;
2120
import org.apache.zeppelin.annotation.Experimental;
2221
import org.apache.zeppelin.annotation.ZeppelinApi;
2322
import org.apache.zeppelin.display.AngularObject;
@@ -673,10 +672,9 @@ public Object angularGlobal(String name) {
673672
*
674673
* @param name name of the variable
675674
* @param o value
676-
* @throws TException
677675
*/
678676
@ZeppelinApi
679-
public void angularBind(String name, Object o) throws TException {
677+
public void angularBind(String name, Object o) {
680678
angularBind(name, o, interpreterContext.getNoteId());
681679
}
682680

@@ -688,7 +686,7 @@ public void angularBind(String name, Object o) throws TException {
688686
* @param o value
689687
*/
690688
@Deprecated
691-
public void angularBindGlobal(String name, Object o) throws TException {
689+
public void angularBindGlobal(String name, Object o) {
692690
angularBind(name, o, (String) null);
693691
}
694692

@@ -701,7 +699,7 @@ public void angularBindGlobal(String name, Object o) throws TException {
701699
* @param watcher watcher of the variable
702700
*/
703701
@ZeppelinApi
704-
public void angularBind(String name, Object o, AngularObjectWatcher watcher) throws TException {
702+
public void angularBind(String name, Object o, AngularObjectWatcher watcher) {
705703
angularBind(name, o, interpreterContext.getNoteId(), watcher);
706704
}
707705

@@ -714,8 +712,7 @@ public void angularBind(String name, Object o, AngularObjectWatcher watcher) thr
714712
* @param watcher watcher of the variable
715713
*/
716714
@Deprecated
717-
public void angularBindGlobal(String name, Object o, AngularObjectWatcher watcher)
718-
throws TException {
715+
public void angularBindGlobal(String name, Object o, AngularObjectWatcher watcher) {
719716
angularBind(name, o, null, watcher);
720717
}
721718

@@ -791,7 +788,7 @@ public void angularUnwatchGlobal(String name) {
791788
* @param name
792789
*/
793790
@ZeppelinApi
794-
public void angularUnbind(String name) throws TException {
791+
public void angularUnbind(String name) {
795792
String noteId = interpreterContext.getNoteId();
796793
angularUnbind(name, noteId);
797794
}
@@ -802,7 +799,7 @@ public void angularUnbind(String name) throws TException {
802799
* @param name
803800
*/
804801
@Deprecated
805-
public void angularUnbindGlobal(String name) throws TException {
802+
public void angularUnbindGlobal(String name) {
806803
angularUnbind(name, null);
807804
}
808805

@@ -814,7 +811,7 @@ public void angularUnbindGlobal(String name) throws TException {
814811
* @param o value
815812
* @param noteId
816813
*/
817-
public void angularBind(String name, Object o, String noteId) throws TException {
814+
public void angularBind(String name, Object o, String noteId) {
818815
AngularObjectRegistry registry = interpreterContext.getAngularObjectRegistry();
819816

820817
if (registry.get(name, noteId, null) == null) {
@@ -833,7 +830,7 @@ public void angularBind(String name, Object o, String noteId) throws TException
833830
* @param noteId
834831
* @param paragraphId
835832
*/
836-
public void angularBind(String name, Object o, String noteId, String paragraphId) throws TException {
833+
public void angularBind(String name, Object o, String noteId, String paragraphId) {
837834
AngularObjectRegistry registry = interpreterContext.getAngularObjectRegistry();
838835

839836
if (registry.get(name, noteId, paragraphId) == null) {
@@ -852,8 +849,7 @@ public void angularBind(String name, Object o, String noteId, String paragraphId
852849
* @param o value
853850
* @param watcher watcher of the variable
854851
*/
855-
private void angularBind(String name, Object o, String noteId, AngularObjectWatcher watcher)
856-
throws TException {
852+
private void angularBind(String name, Object o, String noteId, AngularObjectWatcher watcher) {
857853
AngularObjectRegistry registry = interpreterContext.getAngularObjectRegistry();
858854

859855
if (registry.get(name, noteId, null) == null) {
@@ -908,7 +904,7 @@ private void angularUnwatch(String name, String noteId) {
908904
*
909905
* @param name
910906
*/
911-
private void angularUnbind(String name, String noteId) throws TException {
907+
private void angularUnbind(String name, String noteId) {
912908
AngularObjectRegistry registry = interpreterContext.getAngularObjectRegistry();
913909
registry.remove(name, noteId, null);
914910
}

zeppelin-server/src/main/java/org/apache/zeppelin/service/JobManagerService.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import javax.inject.Inject;
2121
import org.apache.commons.lang3.StringUtils;
22+
import org.apache.zeppelin.conf.ZeppelinConfiguration;
2223
import org.apache.zeppelin.notebook.Note;
2324
import org.apache.zeppelin.notebook.Notebook;
2425
import org.apache.zeppelin.notebook.Paragraph;
@@ -39,16 +40,21 @@ public class JobManagerService {
3940
private static final Logger LOGGER = LoggerFactory.getLogger(JobManagerService.class);
4041

4142
private Notebook notebook;
43+
private ZeppelinConfiguration conf;
4244

4345
@Inject
44-
public JobManagerService(Notebook notebook) {
46+
public JobManagerService(Notebook notebook, ZeppelinConfiguration conf) {
4547
this.notebook = notebook;
48+
this.conf = conf;
4649
}
4750

4851
public List<NoteJobInfo> getNoteJobInfo(String noteId,
4952
ServiceContext context,
5053
ServiceCallback<List<NoteJobInfo>> callback)
5154
throws IOException {
55+
if (!conf.isJobManagerEnabled()) {
56+
return new ArrayList<>();
57+
}
5258
List<NoteJobInfo> notesJobInfo = new ArrayList<>();
5359
Note jobNote = notebook.getNote(noteId);
5460
if (jobNote == null) {
@@ -66,6 +72,9 @@ public List<NoteJobInfo> getNoteJobInfoByUnixTime(long lastUpdateServerUnixTime,
6672
ServiceContext context,
6773
ServiceCallback<List<NoteJobInfo>> callback)
6874
throws IOException {
75+
if (!conf.isJobManagerEnabled()) {
76+
return new ArrayList<>();
77+
}
6978
List<Note> notes = notebook.getAllNotes();
7079
List<NoteJobInfo> notesJobInfo = new ArrayList<>();
7180
for (Note note : notes) {
@@ -81,6 +90,9 @@ public List<NoteJobInfo> getNoteJobInfoByUnixTime(long lastUpdateServerUnixTime,
8190
public void removeNoteJobInfo(String noteId,
8291
ServiceContext context,
8392
ServiceCallback<List<NoteJobInfo>> callback) throws IOException {
93+
if (!conf.isJobManagerEnabled()) {
94+
return;
95+
}
8496
List<NoteJobInfo> notesJobInfo = new ArrayList<>();
8597
notesJobInfo.add(new NoteJobInfo(noteId, true));
8698
callback.onSuccess(notesJobInfo, context);

zeppelin-server/src/test/java/org/apache/zeppelin/cluster/ClusterEventTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public class ClusterEventTest extends ZeppelinServerMock {
8686

8787
private static Notebook notebook;
8888
private static NotebookServer notebookServer;
89-
private static SchedulerService schedulerService;
89+
private static QuartzSchedulerService schedulerService;
9090
private static NotebookService notebookService;
9191
private static AuthorizationService authorizationService;
9292
private HttpServletRequest mockRequest;
@@ -103,6 +103,7 @@ public static void init() throws Exception {
103103
authorizationService = TestUtils.getInstance(AuthorizationService.class);
104104

105105
schedulerService = new QuartzSchedulerService(zconf, notebook);
106+
schedulerService.waitForFinishInit();
106107
notebookServer = spy(NotebookServer.getInstance());
107108
notebookService = new NotebookService(notebook, authorizationService, zconf, schedulerService);
108109

zeppelin-server/src/test/java/org/apache/zeppelin/rest/InterpreterRestApiTest.java

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.apache.commons.httpclient.methods.GetMethod;
2626
import org.apache.commons.httpclient.methods.PostMethod;
2727
import org.apache.commons.httpclient.methods.PutMethod;
28+
import org.apache.commons.lang3.StringUtils;
2829
import org.apache.zeppelin.interpreter.InterpreterOption;
2930
import org.apache.zeppelin.interpreter.InterpreterSetting;
3031
import org.apache.zeppelin.notebook.Note;
@@ -234,6 +235,62 @@ public void testSettingsCreateWithEmptyJson() throws IOException {
234235
post.releaseConnection();
235236
}
236237

238+
@Test
239+
public void testSettingsCreateWithInvalidName() throws IOException {
240+
String reqBody = "{"
241+
+ "\"name\": \"mdName\","
242+
+ "\"group\": \"md\","
243+
+ "\"properties\": {"
244+
+ "\"propname\": {"
245+
+ "\"value\": \"propvalue\","
246+
+ "\"name\": \"propname\","
247+
+ "\"type\": \"textarea\""
248+
+ "}"
249+
+ "},"
250+
+ "\"interpreterGroup\": ["
251+
+ "{"
252+
+ "\"class\": \"org.apache.zeppelin.markdown.Markdown\","
253+
+ "\"name\": \"md\""
254+
+ "}"
255+
+ "],"
256+
+ "\"dependencies\": [],"
257+
+ "\"option\": {"
258+
+ "\"remote\": true,"
259+
+ "\"session\": false"
260+
+ "}"
261+
+ "}";
262+
JsonObject jsonRequest = gson.fromJson(StringUtils.replace(reqBody, "mdName", "mdValidName"), JsonElement.class).getAsJsonObject();
263+
PostMethod post = httpPost("/interpreter/setting/", jsonRequest.toString());
264+
String postResponse = post.getResponseBodyAsString();
265+
LOG.info("testSetting with valid name\n" + post.getResponseBodyAsString());
266+
InterpreterSetting created = convertResponseToInterpreterSetting(postResponse);
267+
String newSettingId = created.getId();
268+
// then : call create setting API
269+
assertThat("test create method:", post, isAllowed());
270+
post.releaseConnection();
271+
272+
// when: call delete setting API
273+
DeleteMethod delete = httpDelete("/interpreter/setting/" + newSettingId);
274+
LOG.info("testSetting delete response\n" + delete.getResponseBodyAsString());
275+
// then: call delete setting API
276+
assertThat("Test delete method:", delete, isAllowed());
277+
delete.releaseConnection();
278+
279+
280+
JsonObject jsonRequest2 = gson.fromJson(StringUtils.replace(reqBody, "mdName", "name space"), JsonElement.class).getAsJsonObject();
281+
PostMethod post2 = httpPost("/interpreter/setting/", jsonRequest2.toString());
282+
LOG.info("testSetting with name with space\n" + post2.getResponseBodyAsString());
283+
assertThat("test create method with space:", post2, isNotFound());
284+
post2.releaseConnection();
285+
286+
JsonObject jsonRequest3 = gson.fromJson(StringUtils.replace(reqBody, "mdName", ""), JsonElement.class).getAsJsonObject();
287+
PostMethod post3 = httpPost("/interpreter/setting/", jsonRequest3.toString());
288+
LOG.info("testSetting with empty name\n" + post3.getResponseBodyAsString());
289+
assertThat("test create method with empty name:", post3, isNotFound());
290+
post3.releaseConnection();
291+
292+
}
293+
237294
public void testInterpreterRestart() throws IOException, InterruptedException {
238295
Note note = null;
239296
try {

zeppelin-server/src/test/java/org/apache/zeppelin/service/NotebookServiceTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void setUp() throws Exception {
117117
SearchService searchService = new LuceneSearch(zeppelinConfiguration);
118118
Credentials credentials = new Credentials(false, null, null);
119119
NoteManager noteManager = new NoteManager(notebookRepo);
120-
AuthorizationService authorizationService = new AuthorizationService(zeppelinConfiguration);
120+
AuthorizationService authorizationService = new AuthorizationService(noteManager, zeppelinConfiguration);
121121
Notebook notebook =
122122
new Notebook(
123123
zeppelinConfiguration,
@@ -130,7 +130,8 @@ public void setUp() throws Exception {
130130
credentials,
131131
null);
132132

133-
SchedulerService schedulerService = new QuartzSchedulerService(zeppelinConfiguration, notebook);
133+
QuartzSchedulerService schedulerService = new QuartzSchedulerService(zeppelinConfiguration, notebook);
134+
schedulerService.waitForFinishInit();
134135
notebookService =
135136
new NotebookService(
136137
notebook, authorizationService, zeppelinConfiguration, schedulerService);

0 commit comments

Comments
 (0)