use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class MessageCreator method buildDisplayData.
public static Message buildDisplayData(Message message, List<MIMEContainer> mimes) {
Message reply = initMessage(DISPLAY_DATA, message);
reply.setContent(new HashMap<>());
reply.getContent().put("metadata", new HashMap<>());
HashMap<String, Object> map3 = new HashMap<>();
mimes.forEach(mimeItem -> map3.put(mimeItem.getMime().asString(), mimeItem.getData()));
reply.getContent().put("data", map3);
return reply;
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class MessageCreator method buildOutputMessage.
public static Message buildOutputMessage(Message message, String text, boolean hasError) {
Message reply = initMessage(STREAM, message);
reply.setContent(new HashMap<>());
reply.getContent().put(NAME, hasError ? STDERR : STDOUT);
reply.getContent().put(TEXT, text);
logger.debug("Console output:", "Error: " + hasError, text);
return reply;
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class MessageCreator method getExecutionStateMessage.
private static Message getExecutionStateMessage(Message parentMessage, String state) {
Map<String, Serializable> map1 = new HashMap<String, Serializable>(1);
map1.put(EXECUTION_STATE, state);
Message reply = initMessage(STATUS, parentMessage);
reply.setContent(map1);
return reply;
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class MessageCreator method createMessage.
public static synchronized List<MessageHolder> createMessage(SimpleEvaluationObject seo) {
logger.debug("Creating message response message from: " + seo);
Message message = seo.getJupyterMessage();
List<MessageHolder> ret = new ArrayList<>();
if (isConsoleOutputMessage(seo)) {
ret.addAll(createConsoleResult(seo, message));
} else if (isError(seo.getStatus())) {
ret.addAll(createError(seo, message));
} else if (isFinish(seo.getStatus()) && seo.isShowResult()) {
ret.addAll(createFinish(seo, message));
} else {
logger.debug("Unhandled status of SimpleEvaluationObject : " + seo.getStatus());
}
return ret;
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class MessageCreator method buildClearOutput.
public static Message buildClearOutput(Message message, boolean wait) {
Message reply = initMessage(CLEAR_OUTPUT, message);
reply.setContent(new HashMap<>());
reply.getContent().put("wait", wait);
reply.getContent().put("metadata", new HashMap<>());
return reply;
}
Aggregations