Skip to content

Commit 415c1f5

Browse files
Merge branch 'apache/master'
2 parents df1620c + 64acfa9 commit 415c1f5

File tree

7 files changed

+104
-42
lines changed

7 files changed

+104
-42
lines changed

spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -481,18 +481,18 @@ public void open() {
481481

482482
System.setProperty("scala.repl.name.line", "line" + this.hashCode() + "$");
483483

484-
/* create scala repl */
485-
this.interpreter = new SparkILoop(null, new PrintWriter(out));
484+
synchronized (sharedInterpreterLock) {
485+
/* create scala repl */
486+
this.interpreter = new SparkILoop(null, new PrintWriter(out));
486487

487-
interpreter.settings_$eq(settings);
488+
interpreter.settings_$eq(settings);
488489

489-
interpreter.createInterpreter();
490+
interpreter.createInterpreter();
490491

491-
intp = interpreter.intp();
492-
intp.setContextClassLoader();
493-
intp.initializeSynchronous();
492+
intp = interpreter.intp();
493+
intp.setContextClassLoader();
494+
intp.initializeSynchronous();
494495

495-
synchronized (sharedInterpreterLock) {
496496
if (classOutputDir == null) {
497497
classOutputDir = settings.outputDirs().getSingleOutput().get();
498498
} else {
@@ -523,35 +523,35 @@ public void open() {
523523
sparkVersion = SparkVersion.fromVersionString(sc.version());
524524

525525
sqlc = getSQLContext();
526-
}
527-
528-
dep = getDependencyResolver();
529-
530-
z = new ZeppelinContext(sc, sqlc, null, dep,
531-
Integer.parseInt(getProperty("zeppelin.spark.maxResult")));
532526

533-
intp.interpret("@transient var _binder = new java.util.HashMap[String, Object]()");
534-
binder = (Map<String, Object>) getValue("_binder");
535-
binder.put("sc", sc);
536-
binder.put("sqlc", sqlc);
537-
binder.put("z", z);
538-
539-
intp.interpret("@transient val z = "
540-
+ "_binder.get(\"z\").asInstanceOf[org.apache.zeppelin.spark.ZeppelinContext]");
541-
intp.interpret("@transient val sc = "
542-
+ "_binder.get(\"sc\").asInstanceOf[org.apache.spark.SparkContext]");
543-
intp.interpret("@transient val sqlc = "
544-
+ "_binder.get(\"sqlc\").asInstanceOf[org.apache.spark.sql.SQLContext]");
545-
intp.interpret("@transient val sqlContext = "
546-
+ "_binder.get(\"sqlc\").asInstanceOf[org.apache.spark.sql.SQLContext]");
547-
intp.interpret("import org.apache.spark.SparkContext._");
548-
549-
if (sparkVersion.oldSqlContextImplicits()) {
550-
intp.interpret("import sqlContext._");
551-
} else {
552-
intp.interpret("import sqlContext.implicits._");
553-
intp.interpret("import sqlContext.sql");
554-
intp.interpret("import org.apache.spark.sql.functions._");
527+
dep = getDependencyResolver();
528+
529+
z = new ZeppelinContext(sc, sqlc, null, dep,
530+
Integer.parseInt(getProperty("zeppelin.spark.maxResult")));
531+
532+
intp.interpret("@transient var _binder = new java.util.HashMap[String, Object]()");
533+
binder = (Map<String, Object>) getValue("_binder");
534+
binder.put("sc", sc);
535+
binder.put("sqlc", sqlc);
536+
binder.put("z", z);
537+
538+
intp.interpret("@transient val z = "
539+
+ "_binder.get(\"z\").asInstanceOf[org.apache.zeppelin.spark.ZeppelinContext]");
540+
intp.interpret("@transient val sc = "
541+
+ "_binder.get(\"sc\").asInstanceOf[org.apache.spark.SparkContext]");
542+
intp.interpret("@transient val sqlc = "
543+
+ "_binder.get(\"sqlc\").asInstanceOf[org.apache.spark.sql.SQLContext]");
544+
intp.interpret("@transient val sqlContext = "
545+
+ "_binder.get(\"sqlc\").asInstanceOf[org.apache.spark.sql.SQLContext]");
546+
intp.interpret("import org.apache.spark.SparkContext._");
547+
548+
if (sparkVersion.oldSqlContextImplicits()) {
549+
intp.interpret("import sqlContext._");
550+
} else {
551+
intp.interpret("import sqlContext.implicits._");
552+
intp.interpret("import sqlContext.sql");
553+
intp.interpret("import org.apache.spark.sql.functions._");
554+
}
555555
}
556556

557557
/* Temporary disabling DisplayUtils. see https://issues.apache.org/jira/browse/ZEPPELIN-127

zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public synchronized void init() {
131131
interpreterProcess.reference(getInterpreterGroup());
132132
interpreterProcess.setMaxPoolSize(
133133
Math.max(this.maxPoolSize, interpreterProcess.getMaxPoolSize()));
134+
String groupId = getInterpreterGroup().getId();
134135

135136
synchronized (interpreterProcess) {
136137
Client client = null;
@@ -144,7 +145,7 @@ public synchronized void init() {
144145
try {
145146
logger.info("Create remote interpreter {}", getClassName());
146147
property.put("zeppelin.interpreter.localRepo", localRepoPath);
147-
client.createInterpreter(getInterpreterGroup().getId(), noteId,
148+
client.createInterpreter(groupId, noteId,
148149
getClassName(), (Map) property);
149150
} catch (TException e) {
150151
broken = true;

zeppelin-server/src/test/java/org/apache/zeppelin/integration/ParagraphActionsIT.java

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,66 @@ public void testWidth() throws Exception {
322322
CoreMatchers.equalTo(true));
323323
}
324324
} catch (Exception e) {
325-
handleException("Exception in ParagraphActionsIT while testWidth ", e);
325+
handleException("Exception in ParagraphActionsIT while testWidth ", e);
326+
}
327+
328+
}
329+
330+
@Test
331+
public void testTitleButton() throws Exception {
332+
if (!endToEndTestEnabled()) {
333+
return;
334+
}
335+
try {
336+
createNewNote();
337+
338+
waitForParagraph(1, "READY");
339+
340+
String xpathToTitle = getParagraphXPath(1) + "//div[contains(@class, 'title')]/div";
341+
String xpathToSettingIcon = getParagraphXPath(1) + "//span[@class='icon-settings']";
342+
String xpathToShowTitle=getParagraphXPath(1) + "//ul/li/a[@ng-click='showTitle()']";
343+
String xpathToHideTitle=getParagraphXPath(1) + "//ul/li/a[@ng-click='hideTitle()']";
344+
345+
collector.checkThat("Before Show Title : The title field contains",
346+
driver.findElement(By.xpath(xpathToTitle)).getText(),
347+
CoreMatchers.equalTo(""));
348+
driver.findElement(By.xpath(xpathToSettingIcon)).click();
349+
collector.checkThat("Before Show Title : The title option in option panel of paragraph is labeled as ",
350+
driver.findElement(By.xpath(xpathToShowTitle)).getText(),
351+
CoreMatchers.equalTo("Show title"));
352+
353+
driver.findElement(By.xpath(xpathToShowTitle)).click();
354+
collector.checkThat("After Show Title : The title field contains",
355+
driver.findElement(By.xpath(xpathToTitle)).getText(),
356+
CoreMatchers.equalTo("Untitled"));
357+
358+
driver.findElement(By.xpath(xpathToSettingIcon)).click();
359+
collector.checkThat("After Show Title : The title option in option panel of paragraph is labeled as",
360+
driver.findElement(By.xpath(xpathToHideTitle)).getText(),
361+
CoreMatchers.equalTo("Hide title"));
362+
363+
driver.findElement(By.xpath(xpathToHideTitle)).click();
364+
collector.checkThat("After Hide Title : The title field contains",
365+
driver.findElement(By.xpath(xpathToTitle)).getText(),
366+
CoreMatchers.equalTo(""));
367+
driver.findElement(By.xpath(xpathToSettingIcon)).click();
368+
driver.findElement(By.xpath(xpathToShowTitle)).click();
369+
370+
driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'title')]")).click();
371+
driver.findElement(By.xpath(getParagraphXPath(1) + "//input")).sendKeys("NEW TITLE" + Keys.ENTER);
372+
collector.checkThat("After Editing the Title : The title field contains ",
373+
driver.findElement(By.xpath(xpathToTitle)).getText(),
374+
CoreMatchers.equalTo("NEW TITLE"));
375+
driver.navigate().refresh();
376+
ZeppelinITUtils.sleep(1000, false);
377+
collector.checkThat("After Page Refresh : The title field contains ",
378+
driver.findElement(By.xpath(xpathToTitle)).getText(),
379+
CoreMatchers.equalTo("NEW TITLE"));
380+
ZeppelinITUtils.sleep(1000, false);
381+
deleteTestNotebook(driver);
382+
383+
} catch (Exception e) {
384+
handleException("Exception in ParagraphActionsIT while testTitleButton ", e);
326385
}
327386

328387
}

zeppelin-web/pom.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,6 @@
163163
<groupId>org.apache.maven.plugins</groupId>
164164
<artifactId>maven-deploy-plugin</artifactId>
165165
<version>2.7</version>
166-
<configuration>
167-
<skip>true</skip>
168-
</configuration>
169166
</plugin>
170167

171168
<plugin>

zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ public void setPropertyAndRestart(String id,
664664
intpsetting.getInterpreterGroup().destroy();
665665

666666
intpsetting.setOption(option);
667+
intpsetting.setProperties(properties);
667668
intpsetting.setDependencies(dependencies);
668669

669670
InterpreterGroup interpreterGroup = createInterpreterGroup(intpsetting.id(), option);

zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ public Properties getProperties() {
129129
return properties;
130130
}
131131

132+
public void setProperties(Properties properties) {
133+
this.properties = properties;
134+
}
135+
132136
public List<Dependency> getDependencies() {
133137
if (dependencies == null) {
134138
return new LinkedList<Dependency>();

zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ private void updateParagraphResult(InterpreterOutput out) {
339339
}
340340

341341
static class ParagraphRunner extends InterpreterContextRunner {
342-
private Note note;
342+
private transient Note note;
343343

344344
public ParagraphRunner(Note note, String noteId, String paragraphId) {
345345
super(noteId, paragraphId);

0 commit comments

Comments
 (0)