use of org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEvent in project zeppelin by apache.
the class RemoteInterpreterEventClient method onAppOutputAppend.
public void onAppOutputAppend(String noteId, String paragraphId, int index, String appId, String output) {
Map<String, Object> appendOutput = new HashMap<>();
appendOutput.put("noteId", noteId);
appendOutput.put("paragraphId", paragraphId);
appendOutput.put("index", Integer.toString(index));
appendOutput.put("appId", appId);
appendOutput.put("data", output);
sendEvent(new RemoteInterpreterEvent(RemoteInterpreterEventType.OUTPUT_APPEND, gson.toJson(appendOutput)));
}
use of org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEvent in project zeppelin by apache.
the class RemoteInterpreterEventClient method angularObjectRemove.
/**
* notify angularObject removal
*/
public void angularObjectRemove(String name, String noteId, String paragraphId) {
Map<String, String> removeObject = new HashMap<>();
removeObject.put("name", name);
removeObject.put("noteId", noteId);
removeObject.put("paragraphId", paragraphId);
sendEvent(new RemoteInterpreterEvent(RemoteInterpreterEventType.ANGULAR_OBJECT_REMOVE, gson.toJson(removeObject)));
}
use of org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEvent in project zeppelin by apache.
the class RemoteInterpreterEventClient method getZeppelinServerNoteRunner.
/**
* Run paragraph
* @param runner
*/
public void getZeppelinServerNoteRunner(String eventOwnerKey, ZeppelinServerResourceParagraphRunner runner) {
RemoteZeppelinServerResource eventBody = new RemoteZeppelinServerResource();
eventBody.setResourceType(RemoteZeppelinServerResource.Type.PARAGRAPH_RUNNERS);
eventBody.setOwnerKey(eventOwnerKey);
eventBody.setData(runner);
sendEvent(new RemoteInterpreterEvent(RemoteInterpreterEventType.REMOTE_ZEPPELIN_SERVER_RESOURCE, gson.toJson(eventBody)));
}
use of org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEvent in project zeppelin by apache.
the class RemoteInterpreterEventClient method pollEvent.
/**
* Supposed to call from RemoteInterpreterEventPoller
* @return next available event
*/
public RemoteInterpreterEvent pollEvent() {
synchronized (eventQueue) {
if (eventQueue.isEmpty()) {
try {
eventQueue.wait(1000);
} catch (InterruptedException e) {
}
}
if (eventQueue.isEmpty()) {
return new RemoteInterpreterEvent(RemoteInterpreterEventType.NO_OP, "");
} else {
RemoteInterpreterEvent event = eventQueue.remove(0);
logger.debug("Send event {}", event.getType());
return event;
}
}
}
use of org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEvent in project zeppelin by apache.
the class RemoteInterpreterEventClient method onAppOutputUpdate.
public void onAppOutputUpdate(String noteId, String paragraphId, int index, String appId, InterpreterResult.Type type, String output) {
Map<String, Object> appendOutput = new HashMap<>();
appendOutput.put("noteId", noteId);
appendOutput.put("paragraphId", paragraphId);
appendOutput.put("index", Integer.toString(index));
appendOutput.put("appId", appId);
appendOutput.put("type", type);
appendOutput.put("data", output);
logger.info("onAppoutputUpdate = {}", output);
sendEvent(new RemoteInterpreterEvent(RemoteInterpreterEventType.OUTPUT_UPDATE, gson.toJson(appendOutput)));
}
Aggregations