mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
WIP
This commit is contained in:
parent
6480d1d9df
commit
94dfed27c4
8 changed files with 73 additions and 28 deletions
|
|
@ -599,6 +599,11 @@ public class NotebookRestApi {
|
|||
// handle params if presented
|
||||
handleParagraphParams(message, note, paragraph);
|
||||
|
||||
AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal());
|
||||
|
||||
paragraph.setAuthenticationInfo(subject);
|
||||
note.persist(subject);
|
||||
|
||||
note.run(paragraph.getId());
|
||||
return new JsonResponse<>(Status.OK).build();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("RECEIVE MSG = " + messagereceived);
|
||||
}
|
||||
|
||||
|
||||
String ticket = TicketContainer.instance.getTicket(messagereceived.principal);
|
||||
if (ticket != null && !ticket.equals(messagereceived.ticket)){
|
||||
/* not to pollute logs, log instead of exception */
|
||||
|
|
@ -1181,14 +1181,9 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
String text = (String) fromMessage.get("paragraph");
|
||||
p.setText(text);
|
||||
p.setTitle((String) fromMessage.get("title"));
|
||||
if (!fromMessage.principal.equals("anonymous")) {
|
||||
AuthenticationInfo authenticationInfo = new AuthenticationInfo(fromMessage.principal,
|
||||
fromMessage.ticket);
|
||||
p.setAuthenticationInfo(authenticationInfo);
|
||||
|
||||
} else {
|
||||
p.setAuthenticationInfo(new AuthenticationInfo());
|
||||
}
|
||||
AuthenticationInfo authenticationInfo =
|
||||
new AuthenticationInfo(fromMessage.principal, fromMessage.ticket);
|
||||
p.setAuthenticationInfo(authenticationInfo);
|
||||
|
||||
Map<String, Object> params = (Map<String, Object>) fromMessage
|
||||
.get("params");
|
||||
|
|
|
|||
25
zeppelin-server/src/main/resources/log4j.properties
Normal file
25
zeppelin-server/src/main/resources/log4j.properties
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
log4j.rootLogger = INFO, stdout
|
||||
|
||||
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%5p [%d] ({%t} %F[%M]:%L) - %m%n
|
||||
|
||||
log4j.additivity.org.apache.zeppelin.interpreter = false
|
||||
log4j.logger.org.apache.zeppelin.interpreter = DEBUG, stdout
|
||||
|
|
@ -18,14 +18,19 @@
|
|||
[users]
|
||||
# List of users with their password allowed to access Zeppelin.
|
||||
# To use a different strategy (LDAP / Database / ...) check the shiro doc at http://shiro.apache.org/configuration.html#Configuration-INISections
|
||||
admin = password
|
||||
admin = password, admin
|
||||
user1 = user1, role1
|
||||
|
||||
|
||||
[urls]
|
||||
|
||||
# anon means the access is anonymous.
|
||||
# authcBasic means Basic Auth Security
|
||||
# To enfore security, comment the line below and uncomment the next one
|
||||
/** = anon
|
||||
#/** = authcBasic
|
||||
#/** = anon
|
||||
/** = authc
|
||||
|
||||
[roles]
|
||||
role1 = *
|
||||
role2 = *
|
||||
role3 = *
|
||||
admin = *
|
||||
|
|
|
|||
|
|
@ -573,7 +573,7 @@ public class ZeppelinConfiguration extends XMLConfiguration {
|
|||
// Allows a way to specify a ',' separated list of allowed origins for rest and websockets
|
||||
// i.e. http://localhost:8080
|
||||
ZEPPELIN_ALLOWED_ORIGINS("zeppelin.server.allowed.origins", "*"),
|
||||
ZEPPELIN_ANONYMOUS_ALLOWED("zeppelin.anonymous.allowed", true),
|
||||
ZEPPELIN_ANONYMOUS_ALLOWED("zeppelin.anonymous.allowed", false),
|
||||
ZEPPELIN_CREDENTIALS_PERSIST("zeppelin.credentials.persist", true),
|
||||
ZEPPELIN_WEBSOCKET_MAX_TEXT_MESSAGE_SIZE("zeppelin.websocket.max.text.message.size", "1024000");
|
||||
|
||||
|
|
|
|||
|
|
@ -1133,13 +1133,17 @@ public class InterpreterFactory implements InterpreterGroupFactory {
|
|||
}
|
||||
|
||||
private String getInterpreterInstanceKey(String user, String noteId, InterpreterSetting setting) {
|
||||
String key;
|
||||
if (setting.getOption().isExistingProcess()) {
|
||||
return Constants.EXISTING_PROCESS;
|
||||
key = user + ":" + Constants.EXISTING_PROCESS;
|
||||
} else if (setting.getOption().isPerNoteSession() || setting.getOption().isPerNoteProcess()) {
|
||||
return noteId;
|
||||
key = user + ":" + noteId;
|
||||
} else {
|
||||
return SHARED_SESSION;
|
||||
key = user + ":" + SHARED_SESSION;
|
||||
}
|
||||
|
||||
logger.debug("Interpreter instance key: {}", key);
|
||||
return key;
|
||||
}
|
||||
|
||||
private List<Interpreter> createOrGetInterpreterList(String user, String noteId,
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ import java.util.Map;
|
|||
import java.util.Properties;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.zeppelin.dep.Dependency;
|
||||
|
||||
|
|
@ -35,6 +37,7 @@ import static org.apache.zeppelin.notebook.utility.IdHashes.generateId;
|
|||
* Interpreter settings
|
||||
*/
|
||||
public class InterpreterSetting {
|
||||
private static final Logger logger = LoggerFactory.getLogger(InterpreterSetting.class);
|
||||
private static final String SHARED_PROCESS = "shared_process";
|
||||
private String id;
|
||||
private String name;
|
||||
|
|
@ -96,18 +99,22 @@ public class InterpreterSetting {
|
|||
return group;
|
||||
}
|
||||
|
||||
private String getInterpreterProcessKey(String noteId) {
|
||||
private String getInterpreterProcessKey(String user, String noteId) {
|
||||
String key;
|
||||
if (getOption().isExistingProcess) {
|
||||
return Constants.EXISTING_PROCESS;
|
||||
key = user + ":" + Constants.EXISTING_PROCESS;
|
||||
} else if (getOption().isPerNoteProcess()) {
|
||||
return noteId;
|
||||
key = user + ":" + noteId;
|
||||
} else {
|
||||
return SHARED_PROCESS;
|
||||
key = user + ":" + SHARED_PROCESS;
|
||||
}
|
||||
|
||||
logger.debug("getInterpreterProcessKey: {}", key);
|
||||
return key;
|
||||
}
|
||||
|
||||
public InterpreterGroup getInterpreterGroup(String noteId) {
|
||||
String key = getInterpreterProcessKey(noteId);
|
||||
public InterpreterGroup getInterpreterGroup(String user, String noteId) {
|
||||
String key = getInterpreterProcessKey(user, noteId);
|
||||
synchronized (interpreterGroupRef) {
|
||||
if (!interpreterGroupRef.containsKey(key)) {
|
||||
String interpreterGroupId = getId() + ":" + key;
|
||||
|
|
@ -126,10 +133,14 @@ public class InterpreterSetting {
|
|||
}
|
||||
|
||||
void closeAndRemoveInterpreterGroup(String noteId) {
|
||||
String key = getInterpreterProcessKey(noteId);
|
||||
InterpreterGroup groupToRemove;
|
||||
String key = getInterpreterProcessKey("", noteId);
|
||||
InterpreterGroup groupToRemove = null;
|
||||
synchronized (interpreterGroupRef) {
|
||||
groupToRemove = interpreterGroupRef.remove(key);
|
||||
for(String intpKey: interpreterGroupRef.keySet()) {
|
||||
if(intpKey.contains(key)) {
|
||||
groupToRemove = interpreterGroupRef.remove(intpKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (groupToRemove != null) {
|
||||
|
|
|
|||
|
|
@ -350,8 +350,8 @@ public class Note implements Serializable, ParagraphJobListener {
|
|||
|
||||
if (index < 0 || index >= paragraphs.size()) {
|
||||
if (throwWhenIndexIsOutOfBound) {
|
||||
throw new IndexOutOfBoundsException(
|
||||
"paragraph size is " + paragraphs.size() + " , index is " + index);
|
||||
throw new IndexOutOfBoundsException("paragraph size is " + paragraphs.size() +
|
||||
" , index is " + index);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue