mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Add option for per note session interpreter
This commit is contained in:
parent
ddf2c89ec3
commit
5787984def
8 changed files with 60 additions and 12 deletions
|
|
@ -94,11 +94,10 @@ public class InterpreterRestApi {
|
|||
NewInterpreterSettingRequest.class);
|
||||
Properties p = new Properties();
|
||||
p.putAll(request.getProperties());
|
||||
// Option is deprecated from API, always use remote = true
|
||||
InterpreterGroup interpreterGroup = interpreterFactory.add(request.getName(),
|
||||
request.getGroup(),
|
||||
request.getDependencies(),
|
||||
new InterpreterOption(true),
|
||||
request.getOption(),
|
||||
p);
|
||||
InterpreterSetting setting = interpreterFactory.get(interpreterGroup.getId());
|
||||
logger.info("new setting created with {}", setting.id());
|
||||
|
|
@ -126,9 +125,8 @@ public class InterpreterRestApi {
|
|||
try {
|
||||
UpdateInterpreterSettingRequest request = gson.fromJson(message,
|
||||
UpdateInterpreterSettingRequest.class);
|
||||
// Option is deprecated from API, always use remote = true
|
||||
interpreterFactory.setPropertyAndRestart(settingId,
|
||||
new InterpreterOption(true),
|
||||
request.getOption(),
|
||||
request.getProperties(),
|
||||
request.getDependencies());
|
||||
} catch (InterpreterException e) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.zeppelin.dep.Dependency;
|
||||
import org.apache.zeppelin.interpreter.InterpreterOption;
|
||||
|
||||
/**
|
||||
* NewInterpreterSetting rest api request message
|
||||
|
|
@ -29,9 +30,10 @@ import org.apache.zeppelin.dep.Dependency;
|
|||
public class NewInterpreterSettingRequest {
|
||||
String name;
|
||||
String group;
|
||||
// option was deprecated
|
||||
|
||||
Map<String, String> properties;
|
||||
List<Dependency> dependencies;
|
||||
InterpreterOption option;
|
||||
|
||||
public NewInterpreterSettingRequest() {
|
||||
|
||||
|
|
@ -52,4 +54,8 @@ public class NewInterpreterSettingRequest {
|
|||
public List<Dependency> getDependencies() {
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
public InterpreterOption getOption() {
|
||||
return option;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,19 +21,21 @@ import java.util.List;
|
|||
import java.util.Properties;
|
||||
|
||||
import org.apache.zeppelin.dep.Dependency;
|
||||
import org.apache.zeppelin.interpreter.InterpreterOption;
|
||||
|
||||
/**
|
||||
* UpdateInterpreterSetting rest api request message
|
||||
*/
|
||||
public class UpdateInterpreterSettingRequest {
|
||||
// option was deprecated
|
||||
Properties properties;
|
||||
List<Dependency> dependencies;
|
||||
InterpreterOption option;
|
||||
|
||||
public UpdateInterpreterSettingRequest(Properties properties,
|
||||
List<Dependency> dependencies) {
|
||||
List<Dependency> dependencies, InterpreterOption option) {
|
||||
this.properties = properties;
|
||||
this.dependencies = dependencies;
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public Properties getProperties() {
|
||||
|
|
@ -43,4 +45,8 @@ public class UpdateInterpreterSettingRequest {
|
|||
public List<Dependency> getDependencies() {
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
public InterpreterOption getOption() {
|
||||
return option;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,17 +23,14 @@ import org.apache.zeppelin.interpreter.InterpreterOption;
|
|||
|
||||
/**
|
||||
* Created by eranw on 8/30/15.
|
||||
* Omit InterpreterOption from serialization
|
||||
*/
|
||||
public class JsonExclusionStrategy implements ExclusionStrategy {
|
||||
|
||||
public boolean shouldSkipClass(Class<?> arg0) {
|
||||
//exclude only InterpreterOption
|
||||
return InterpreterOption.class.equals(arg0);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldSkipField(FieldAttributes f) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ limitations under the License.
|
|||
</select>
|
||||
</div>
|
||||
|
||||
<b>Option</b>
|
||||
<div class="checkbox">
|
||||
<label><input type="checkbox" style="top:-5px" ng-model="newInterpreterSetting.option.perNoteSession">Per note session</input></label>
|
||||
</div>
|
||||
|
||||
<b>Properties</b>
|
||||
<table class="table table-striped properties">
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -72,7 +72,17 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope,
|
|||
$scope.addNewInterpreterDependency(settingId);
|
||||
}
|
||||
|
||||
// add missing field of option
|
||||
if (!setting.option) {
|
||||
setting.option = {};
|
||||
}
|
||||
if (setting.option.remote === undefined) {
|
||||
// remote always true for now
|
||||
setting.option.remote = true;
|
||||
}
|
||||
|
||||
var request = {
|
||||
option: angular.copy(setting.option),
|
||||
properties: angular.copy(setting.properties),
|
||||
dependencies: angular.copy(setting.dependencies)
|
||||
};
|
||||
|
|
@ -214,7 +224,11 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope,
|
|||
name: undefined,
|
||||
group: undefined,
|
||||
properties: {},
|
||||
dependencies: []
|
||||
dependencies: [],
|
||||
option: {
|
||||
remote: true,
|
||||
perNoteSession: false
|
||||
}
|
||||
};
|
||||
emptyNewProperty($scope.newInterpreterSetting);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -109,6 +109,19 @@ limitations under the License.
|
|||
</div>
|
||||
</div>
|
||||
<div class="row interpreter">
|
||||
<div class="col-md-12">
|
||||
<h5>Option</h5>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox"
|
||||
style="top:-5px"
|
||||
ng-disabled="!valueform.$visible"
|
||||
ng-model="setting.option.perNoteSession">
|
||||
Per note session</input>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="_.isEmpty(setting.properties) && _.isEmpty(setting.dependencies) || valueform.$hidden" class="col-md-12 gray40-message">
|
||||
<em>Currently there are no properties and dependencies set for this interpreter</em>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ package org.apache.zeppelin.interpreter;
|
|||
*/
|
||||
public class InterpreterOption {
|
||||
boolean remote;
|
||||
boolean perNoteSession;
|
||||
|
||||
public InterpreterOption() {
|
||||
remote = false;
|
||||
|
|
@ -38,4 +39,12 @@ public class InterpreterOption {
|
|||
public void setRemote(boolean remote) {
|
||||
this.remote = remote;
|
||||
}
|
||||
|
||||
public boolean isPerNoteSession() {
|
||||
return perNoteSession;
|
||||
}
|
||||
|
||||
public void setPerNoteSession(boolean perNoteSession) {
|
||||
this.perNoteSession = perNoteSession;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue