mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Handle output update in angular mode
This commit is contained in:
parent
0e4d81c841
commit
fade3c1f0f
5 changed files with 16 additions and 10 deletions
|
|
@ -837,8 +837,6 @@ public class SparkInterpreter extends Interpreter {
|
|||
|
||||
Object lastObj = getValue(varName);
|
||||
if (lastObj != null) {
|
||||
logger.info("Put LastValue {} {} {} into ResourcePool",
|
||||
varName, lastObj, lastObj.getClass().getName());
|
||||
ResourcePool resourcePool = context.getResourcePool();
|
||||
resourcePool.put(context.getNoteId(), context.getParagraphId(),
|
||||
WellKnownResourceName.ZeppelinReplResult.toString(), lastObj);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -153,11 +154,7 @@ public class InterpreterOutput extends OutputStream {
|
|||
* @throws IOException
|
||||
*/
|
||||
public void write(URL url) throws IOException {
|
||||
if ("file".equals(url.getProtocol())) {
|
||||
write(new File(url.getPath()));
|
||||
} else {
|
||||
outList.add(url);
|
||||
}
|
||||
outList.add(url);
|
||||
}
|
||||
|
||||
public void addResourceSearchPath(String path) {
|
||||
|
|
@ -168,8 +165,6 @@ public class InterpreterOutput extends OutputStream {
|
|||
// search file under provided paths first, for dev mode
|
||||
for (String path : resourceSearchPaths) {
|
||||
File res = new File(path + "/" + resourceName);
|
||||
logger.info("path = " + path + ", res = " + resourceName);
|
||||
logger.info("Search resource " + res.getAbsolutePath());
|
||||
if (res.isFile()) {
|
||||
write(res);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -114,4 +114,8 @@ public class DevInterpreter extends Interpreter {
|
|||
public void setInterpreterEvent(InterpreterEvent event) {
|
||||
this.interpreterEvent = event;
|
||||
}
|
||||
|
||||
public InterpreterEvent getInterpreterEvent() {
|
||||
return interpreterEvent;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ public class ZeppelinApplicationDevServer extends ZeppelinDevServer {
|
|||
|
||||
try {
|
||||
logger.info("Run " + className);
|
||||
app.context().out.clear();
|
||||
app.context().out.setType(InterpreterResult.Type.ANGULAR);
|
||||
app.run();
|
||||
} catch (ApplicationException e) {
|
||||
|
|
|
|||
|
|
@ -812,9 +812,17 @@ public class RemoteInterpreterServer
|
|||
} else {
|
||||
try {
|
||||
app.context().out.clear();
|
||||
app.context().out.setType(InterpreterResult.Type.ANGULAR);
|
||||
app.run();
|
||||
String output = new String(app.context().out.toByteArray());
|
||||
logger.info("Update app output " + output);
|
||||
eventClient.onAppOutputUpdate(
|
||||
app.context().getNoteId(),
|
||||
app.context().getParagraphId(),
|
||||
applicationInstanceId,
|
||||
output);
|
||||
return new RemoteApplicationResult(true, "");
|
||||
} catch (ApplicationException e) {
|
||||
} catch (ApplicationException | IOException e) {
|
||||
return new RemoteApplicationResult(false, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue