minor update

This commit is contained in:
Jeff Zhang 2017-09-01 12:50:46 +08:00
parent 74bcb9119a
commit fa0d435dd7
5 changed files with 33 additions and 90 deletions

View file

@ -198,6 +198,8 @@ public class InterpreterSettingManager {
// merge InterpreterInfo
savedInterpreterSetting.setInterpreterInfos(
interpreterSettingTemplate.getInterpreterInfos());
savedInterpreterSetting.setInterpreterRunner(
interpreterSettingTemplate.getInterpreterRunner());
} else {
LOGGER.warn("No InterpreterSetting Template found for InterpreterSetting: "
+ savedInterpreterSetting.getGroup());

View file

@ -321,14 +321,14 @@ public class RemoteScheduler implements Scheduler {
if (job.isAborted()) {
job.setStatus(Status.ABORT);
} else if (job.getException() != null) {
// logger.info("Job ABORT, " + job.getId());
logger.debug("Job ABORT, " + job.getId());
job.setStatus(Status.ERROR);
} else if (jobResult != null && jobResult instanceof InterpreterResult
&& ((InterpreterResult) jobResult).code() == Code.ERROR) {
// logger.info("Job Error, " + job.getId());
logger.debug("Job Error, " + job.getId());
job.setStatus(Status.ERROR);
} else {
// logger.info("Job Finished, " + job.getId());
logger.debug("Job Finished, " + job.getId());
job.setStatus(Status.FINISHED);
}
@ -365,7 +365,6 @@ public class RemoteScheduler implements Scheduler {
} else if (after == Status.RUNNING) {
jobSubmittedRemotely = true;
job.setStatus(Status.RUNNING);
// logger.info("Job RUNNING, " + job.getId());
}
} else {
jobSubmittedRemotely = true;
@ -374,7 +373,6 @@ public class RemoteScheduler implements Scheduler {
// only set status when it is RUNNING
// We would set other status based on the interpret result
if (after == Status.RUNNING) {
// logger.info("Job RUNNING, " + job.getId());
job.setStatus(Status.RUNNING);
}
}

View file

@ -66,6 +66,7 @@ public class InterpreterSettingManagerTest extends AbstractInterpreterTest {
assertNotNull(interpreterSetting.getAppEventListener());
assertNotNull(interpreterSetting.getDependencyResolver());
assertNotNull(interpreterSetting.getInterpreterSettingManager());
assertEquals("linux_runner", interpreterSetting.getInterpreterRunner().getPath());
List<RemoteRepository> repositories = interpreterSettingManager.getRepositories();
assertEquals(2, repositories.size());
@ -85,6 +86,7 @@ public class InterpreterSettingManagerTest extends AbstractInterpreterTest {
assertEquals("value_3", interpreterSetting.getJavaProperties().getProperty("property_3"));
assertEquals("shared", interpreterSetting.getOption().perNote);
assertEquals("shared", interpreterSetting.getOption().perUser);
assertEquals("linux_runner", interpreterSetting.getInterpreterRunner().getPath());
assertEquals(0, interpreterSetting.getDependencies().size());
repositories = interpreterSettingManager2.getRepositories();
@ -266,4 +268,19 @@ public class InterpreterSettingManagerTest extends AbstractInterpreterTest {
assertEquals(1, defaultInterpreterSetting.getAllInterpreterGroups().get(0).getSessionNum());
}
@Test
public void testGetEditor() throws IOException {
interpreterSettingManager.setInterpreterBinding("user1", "note1", interpreterSettingManager.getInterpreterSettingIds());
Interpreter echoInterpreter = interpreterFactory.getInterpreter("user1", "note1", "test.echo");
// get editor setting from interpreter-setting.json
Map<String, Object> editor = interpreterSettingManager.getEditorSetting(echoInterpreter, "user1", "note1", "test.echo");
assertEquals("java", editor.get("language"));
// when editor setting doesn't exit, return the default editor
Interpreter mock1Interpreter = interpreterFactory.getInterpreter("user1", "note1", "mock1");
editor = interpreterSettingManager.getEditorSetting(mock1Interpreter,"user1", "note1", "mock1");
assertEquals("text", editor.get("language"));
}
}

View file

@ -1,85 +0,0 @@
/*
* 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.
*/
package org.apache.zeppelin.interpreter.mock;
import org.apache.zeppelin.interpreter.Interpreter;
import org.apache.zeppelin.interpreter.InterpreterContext;
import org.apache.zeppelin.interpreter.InterpreterResult;
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
import org.apache.zeppelin.scheduler.Scheduler;
import org.apache.zeppelin.scheduler.SchedulerFactory;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
public class MockInterpreter11 extends Interpreter {
Map<String, Object> vars = new HashMap<>();
public MockInterpreter11(Properties property) {
super(property);
}
boolean open;
@Override
public void open() {
open = true;
}
@Override
public void close() {
open = false;
}
public boolean isOpen() {
return open;
}
@Override
public InterpreterResult interpret(String st, InterpreterContext context) {
return new InterpreterResult(InterpreterResult.Code.SUCCESS, "repl11: " + st);
}
@Override
public void cancel(InterpreterContext context) {
}
@Override
public FormType getFormType() {
return FormType.SIMPLE;
}
@Override
public int getProgress(InterpreterContext context) {
return 0;
}
@Override
public Scheduler getScheduler() {
return SchedulerFactory.singleton().createOrGetFIFOScheduler("test_" + this.hashCode());
}
@Override
public List<InterpreterCompletion> completion(String buf, int cursor,
InterpreterContext interpreterContext) {
return null;
}
}

View file

@ -16,6 +16,10 @@
"defaultValue": "value_2",
"description": "desc_2"
}
},
"editor": {
"language": "java",
"editOnDblClick": false
}
},
@ -37,6 +41,13 @@
"defaultValue": "value_2",
"description": "desc_2"
}
},
"runner": {
"linux": "linux_runner"
},
"editor": {
"language": "java",
"editOnDblClick": false
}
}
]