mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
reimplement run.eachParagraph to run.all method
This commit is contained in:
parent
1428795f80
commit
a672cf38d1
2 changed files with 19 additions and 21 deletions
|
|
@ -479,21 +479,12 @@ public class NotebookRestApi {
|
|||
return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build();
|
||||
}
|
||||
|
||||
for (Paragraph paragraph : note.getParagraphs()) {
|
||||
note.setLastReplName(paragraph.getId());
|
||||
try {
|
||||
note.run(paragraph.getId());
|
||||
} catch (Exception ex) {
|
||||
LOG.error("Exception from run", ex);
|
||||
if (paragraph != null) {
|
||||
paragraph.setReturn(
|
||||
new InterpreterResult(InterpreterResult.Code.ERROR, ex.getMessage()),
|
||||
ex);
|
||||
paragraph.setStatus(Job.Status.ERROR);
|
||||
}
|
||||
return new JsonResponse<>(Status.PRECONDITION_FAILED,
|
||||
paragraph.getJobName() + " Not selected or Invalid Interpreter bind").build();
|
||||
}
|
||||
try {
|
||||
note.runAll();
|
||||
} catch (Exception ex) {
|
||||
LOG.error("Exception from run", ex);
|
||||
return new JsonResponse<>(Status.PRECONDITION_FAILED,
|
||||
ex.getMessage() + "- Not selected or Invalid Interpreter bind").build();
|
||||
}
|
||||
|
||||
return new JsonResponse<>(Status.OK).build();
|
||||
|
|
|
|||
|
|
@ -445,11 +445,11 @@ public class Note implements Serializable, ParagraphJobListener {
|
|||
AuthenticationInfo authenticationInfo = new AuthenticationInfo();
|
||||
authenticationInfo.setUser(cronExecutingUser);
|
||||
p.setAuthenticationInfo(authenticationInfo);
|
||||
|
||||
p.setListener(jobListenerFactory.getParagraphJobListener(this));
|
||||
Interpreter intp = factory.getInterpreter(getId(), p.getRequiredReplName());
|
||||
|
||||
intp.getScheduler().submit(p);
|
||||
try {
|
||||
run(p.getId());
|
||||
} catch (InterpreterException intpException) {
|
||||
throw intpException;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -472,7 +472,14 @@ public class Note implements Serializable, ParagraphJobListener {
|
|||
logger.debug("New paragraph: {}", pText);
|
||||
p.setEffectiveText(pText);
|
||||
} else {
|
||||
throw new InterpreterException("Interpreter " + requiredReplName + " not found");
|
||||
InterpreterException intpException;
|
||||
intpException = new InterpreterException(
|
||||
"Pargaraph " + p.getJobName() + "'s Interpreter " + requiredReplName + " not found");
|
||||
p.setReturn(
|
||||
new InterpreterResult(InterpreterResult.Code.ERROR, intpException.getMessage()),
|
||||
intpException);
|
||||
p.setStatus(Job.Status.ERROR);
|
||||
throw intpException;
|
||||
}
|
||||
}
|
||||
if (p.getConfig().get("enabled") == null || (Boolean) p.getConfig().get("enabled")) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue