use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class BaseHandler method createReplyMessage.
protected Message createReplyMessage(Message message, Serializable responceData) {
Message ret = null;
if (message != null) {
ret = new Message();
Map<String, Serializable> commMap = message.getContent();
ret.setHeader(new Header(COMM_MSG, message.getHeader().getSession()));
HashMap<String, Serializable> map = new HashMap<>();
map.put(COMM_ID, getString(commMap, COMM_ID));
map.put(DATA, responceData);
ret.setContent(map);
}
return ret;
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class TimeCellModeMagicCommand method execute.
@Override
public MagicCommandOutcomeItem execute(MagicCommandExecutionParam param) {
Message message = param.getCode().getMessage();
int executionCount = param.getExecutionCount();
return time(param.getCommandCodeBlock(), message, executionCount, param.isShowResult());
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class TimeItLineModeMagicCommand method execute.
@Override
public MagicCommandOutcomeItem execute(MagicCommandExecutionParam param) {
Message message = param.getCode().getMessage();
int executionCount = param.getExecutionCount();
String codeToExecute = param.getCommand().replace(TIMEIT_LINE, "");
codeToExecute = codeToExecute.replaceAll("(-.)(\\d*\\s)", "");
try {
return timeIt(buildTimeItOption(param.getCode()), codeToExecute, message, executionCount, param.isShowResult());
} catch (IllegalArgumentException e) {
return new MagicCommandOutput(MagicCommandOutput.Status.ERROR, e.getMessage());
}
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class TimeLineModeMagicCommand method execute.
@Override
public MagicCommandOutcomeItem execute(MagicCommandExecutionParam param) {
Message message = param.getCode().getMessage();
int executionCount = param.getExecutionCount();
String codeToExecute = param.getCommand().replace(TIME_LINE, "");
return time(codeToExecute, message, executionCount, param.isShowResult());
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class KernelSocketsZMQ method handleControlMsg.
private void handleControlMsg() {
Message message = readMessage(controlSocket);
JupyterMessages type = message.getHeader().getTypeEnum();
if (type.equals(SHUTDOWN_REQUEST)) {
Message reply = new Message();
reply.setHeader(new Header(SHUTDOWN_REPLY, message.getHeader().getSession()));
reply.setParentHeader(message.getHeader());
reply.setContent(message.getContent());
sendMsg(controlSocket, Collections.singletonList(reply));
shutdown();
}
}
Aggregations