mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
change UI and restart interpreter process
This commit is contained in:
parent
322d427f26
commit
29966a0194
5 changed files with 25 additions and 18 deletions
|
|
@ -159,8 +159,10 @@ public class InterpreterRestApi {
|
|||
|
||||
try {
|
||||
RestartInterpreterRequest request = gson.fromJson(message, RestartInterpreterRequest.class);
|
||||
boolean shouldBeCheckedIntpMode = request == null ? false : request.getCheckIntpCondition();
|
||||
interpreterFactory.restart(settingId, shouldBeCheckedIntpMode);
|
||||
|
||||
String noteId = request == null ? null : request.getNoteId();
|
||||
interpreterFactory.restart(settingId, noteId);
|
||||
|
||||
} catch (InterpreterException e) {
|
||||
logger.error("Exception in InterpreterRestApi while restartSetting ", e);
|
||||
return new JsonResponse<>(Status.NOT_FOUND, e.getMessage(), ExceptionUtils.getStackTrace(e))
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ package org.apache.zeppelin.rest.message;
|
|||
*/
|
||||
public class RestartInterpreterRequest {
|
||||
boolean checkIntpCondition;
|
||||
String noteId;
|
||||
|
||||
public RestartInterpreterRequest() {
|
||||
|
||||
|
|
@ -30,4 +31,7 @@ public class RestartInterpreterRequest {
|
|||
public boolean getCheckIntpCondition() {
|
||||
return checkIntpCondition;
|
||||
}
|
||||
public String getNoteId() {
|
||||
return noteId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -635,8 +635,9 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro
|
|||
callback: function(result) {
|
||||
if (result) {
|
||||
var payload = {
|
||||
'checkIntpCondition': 'true'
|
||||
'noteId' : $scope.note.id
|
||||
};
|
||||
|
||||
$http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/restart/' + interpeter.id, payload)
|
||||
.success(function(data, status, headers, config) {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': interpeter.id});
|
||||
|
|
|
|||
|
|
@ -33,11 +33,6 @@ limitations under the License.
|
|||
as-sortable="interpreterSelectionListeners" data-ng-model="interpreterBindings">
|
||||
<div data-ng-repeat="item in interpreterBindings" as-sortable-item>
|
||||
<div>
|
||||
<div as-sortable-item-handle
|
||||
class="btn btn-warning"
|
||||
ng-click="restartInterpreter(item)">
|
||||
<font style="font-size:16px">Restart</font>
|
||||
</div>
|
||||
<div as-sortable-item-handle
|
||||
ng-click="item.selected = !item.selected"
|
||||
class="btn"
|
||||
|
|
@ -53,6 +48,9 @@ limitations under the License.
|
|||
</span>
|
||||
</small>
|
||||
</div>
|
||||
<a ng-click="restartInterpreter(item)" ng-show="item.selected">
|
||||
<span class="glyphicon glyphicon-refresh btn-md"></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -853,20 +853,22 @@ public class InterpreterFactory implements InterpreterGroupFactory {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean interpreterIsShared(InterpreterSetting setting) {
|
||||
if (setting.getOption().isPerNoteProcess() == false &&
|
||||
setting.getOption().isPerNoteSession() == false){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
private boolean noteIsExist(String noteId) {
|
||||
return noteId == null ? false : true;
|
||||
}
|
||||
|
||||
public void restart(String settingId, boolean shouldBeCheckedIntpMode) {
|
||||
public void restart(String settingId, String noteId) {
|
||||
InterpreterSetting setting = interpreterSettings.get(settingId);
|
||||
|
||||
if (shouldBeCheckedIntpMode && interpreterIsShared(setting)) {
|
||||
throw new InterpreterException("Can't restart shared interpreter process.");
|
||||
if (noteIsExist(noteId)) {
|
||||
if (setting.getOption().isPerNoteProcess()) {
|
||||
setting.closeAndRemoveInterpreterGroup(noteId);
|
||||
} else if (setting.getOption().isPerNoteSession()) {
|
||||
InterpreterGroup interpreterGroup = setting.getInterpreterGroup(noteId);
|
||||
interpreterGroup.close(noteId);
|
||||
interpreterGroup.destroy(noteId);
|
||||
}
|
||||
}
|
||||
|
||||
restart(settingId);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue