mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
fix: Add setErrorMessage method to Job
This commit is contained in:
parent
4fec44cc46
commit
c8c8f0e1db
4 changed files with 25 additions and 9 deletions
|
|
@ -64,7 +64,6 @@ public abstract class Job {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private String jobName;
|
||||
String id;
|
||||
|
||||
|
|
@ -135,6 +134,13 @@ public abstract class Job {
|
|||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* just set status without notifying to listeners for spell.
|
||||
*/
|
||||
public void setStatusWithoutNotification(Status status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void setStatus(Status status) {
|
||||
if (this.status == status) {
|
||||
return;
|
||||
|
|
@ -257,4 +263,8 @@ public abstract class Job {
|
|||
}
|
||||
|
||||
public abstract void setResult(Object results);
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1638,8 +1638,9 @@ public class NotebookServer extends WebSocketServlet
|
|||
final Note note = notebook.getNote(noteId);
|
||||
Paragraph p = setParagraphUsingMessage(note, fromMessage, paragraphId,
|
||||
text, title, params, config);
|
||||
p.setStatus(status);
|
||||
p.setResult(fromMessage.get("results"));
|
||||
p.setErrorMessage((String) fromMessage.get("errorMessage"));
|
||||
p.setStatusWithoutNotification(status);
|
||||
|
||||
addNewParagraphIfLastParagraphIsExecuted(note, p);
|
||||
if (!persistNoteWithAuthInfo(conn, note, p)) {
|
||||
|
|
|
|||
|
|
@ -228,25 +228,28 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
};
|
||||
|
||||
$scope.propagateSpellResult = function(paragraphId, paragraphTitle,
|
||||
paragraphText, paragraphResults, paragraphStatus,
|
||||
paragraphText, paragraphResults,
|
||||
paragraphStatus, paragraphErrorMessage,
|
||||
paragraphConfig, paragraphSettingsParam) {
|
||||
websocketMsgSrv.paragraphExecutedBySpell(
|
||||
paragraphId, paragraphTitle,
|
||||
paragraphText, paragraphResults, paragraphStatus,
|
||||
paragraphText, paragraphResults,
|
||||
paragraphStatus, paragraphErrorMessage,
|
||||
paragraphConfig, paragraphSettingsParam);
|
||||
};
|
||||
|
||||
$scope.handleSpellError = function(paragraphText, error,
|
||||
digestRequired, propagated) {
|
||||
const errorMessage = error.stack;
|
||||
$scope.paragraph.status = 'ERROR';
|
||||
$scope.paragraph.errorMessage = error.stack;
|
||||
$scope.paragraph.errorMessage = errorMessage;
|
||||
console.error('Failed to execute interpret() in spell\n', error);
|
||||
if (digestRequired) { $scope.$digest(); }
|
||||
|
||||
if (!propagated) {
|
||||
$scope.propagateSpellResult(
|
||||
$scope.paragraph.id, $scope.paragraph.title,
|
||||
paragraphText, [], $scope.paragraph.status,
|
||||
paragraphText, [], $scope.paragraph.status, errorMessage,
|
||||
$scope.paragraph.config, $scope.paragraph.settings.params);
|
||||
}
|
||||
};
|
||||
|
|
@ -254,6 +257,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
$scope.runParagraphUsingSpell = function(spell, paragraphText,
|
||||
magic, digestRequired, propagated) {
|
||||
$scope.paragraph.results = {};
|
||||
$scope.paragraph.errorMessage = '';
|
||||
if (digestRequired) { $scope.$digest(); }
|
||||
|
||||
try {
|
||||
|
|
@ -269,7 +273,6 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
parsed.then(resultsMsg => {
|
||||
const status = 'FINISHED';
|
||||
$scope.paragraph.status = status;
|
||||
$scope.paragraph.errorMessage = '';
|
||||
$scope.paragraph.results.code = status;
|
||||
$scope.paragraph.results.msg = resultsMsg;
|
||||
$scope.paragraph.config.tableHide = false;
|
||||
|
|
@ -279,7 +282,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
const propagable = SpellResult.createPropagable(resultsMsg);
|
||||
$scope.propagateSpellResult(
|
||||
$scope.paragraph.id, $scope.paragraph.title,
|
||||
paragraphText, propagable, status,
|
||||
paragraphText, propagable, status, '',
|
||||
$scope.paragraph.config, $scope.paragraph.settings.params);
|
||||
}
|
||||
}).catch(error => {
|
||||
|
|
|
|||
|
|
@ -160,7 +160,8 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
},
|
||||
|
||||
paragraphExecutedBySpell: function(paragraphId, paragraphTitle,
|
||||
paragraphText, paragraphResultsMsg, paragraphStatus,
|
||||
paragraphText, paragraphResultsMsg,
|
||||
paragraphStatus, paragraphErrorMessage,
|
||||
paragraphConfig, paragraphParams) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'PARAGRAPH_EXECUTED_BY_SPELL',
|
||||
|
|
@ -176,6 +177,7 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
})
|
||||
},
|
||||
status: paragraphStatus,
|
||||
errorMessage: paragraphErrorMessage,
|
||||
config: paragraphConfig,
|
||||
params: paragraphParams
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue