This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void runParagraph(NotebookSocket conn, HashSet<String> userAndRoles, Notebook notebook, | |
Message fromMessage) throws IOException { | |
final String paragraphId = (String) fromMessage.get("id"); | |
if (paragraphId == null) { | |
return; | |
} | |
String noteId = getOpenNoteId(conn); | |
final Note note = notebook.getNote(noteId); | |
NotebookAuthorization notebookAuthorization = notebook.getNotebookAuthorization(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Run asynchronously paragraph job REST API | |
* | |
* @param message - JSON with params if user wants to update dynamic form's value | |
* null, empty string, empty json if user doesn't want to update | |
* @return JSON with status.OK | |
* @throws IOException, IllegalArgumentException | |
*/ | |
@POST | |
@Path("job/{notebookId}/{paragraphId}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Run a single paragraph. | |
* | |
* @param paragraphId ID of paragraph | |
*/ | |
public void run(String paragraphId) { | |
Paragraph p = getParagraph(paragraphId); | |
p.setListener(jobListenerFactory.getParagraphJobListener(this)); | |
String requiredReplName = p.getRequiredReplName(); | |
Interpreter intp = factory.getInterpreter(getId(), requiredReplName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String getInterpreterInstanceKey(String noteId, InterpreterSetting setting) { | |
if (setting.getOption().isExistingProcess()) { | |
return Constants.EXISTING_PROCESS; | |
} else if (setting.getOption().isPerNoteSession() || setting.getOption().isPerNoteProcess()) { | |
return noteId; | |
} else { | |
return SHARED_SESSION; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String getInterpreterProcessKey(String noteId) { | |
if (getOption().isExistingProcess) { | |
return Constants.EXISTING_PROCESS; | |
} else if (getOption().isPerNoteProcess()) { | |
return noteId; | |
} else { | |
return SHARED_PROCESS; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected Object jobRun() throws Throwable { | |
String replName = getRequiredReplName(); | |
Interpreter repl = getRepl(replName); | |
logger.info("run paragraph {} using {} " + repl, getId(), replName); | |
if (repl == null) { | |
logger.error("Can not find interpreter name " + repl); | |
throw new RuntimeException("Can not find interpreter for " + getRequiredReplName()); | |
} |