use of org.apache.zeppelin.notebook.scheduler.QuartzSchedulerService in project zeppelin by apache.
the class ClusterEventTest method init.
@BeforeClass
public static void init() throws Exception {
ZeppelinConfiguration zconf = genZeppelinConf();
ZeppelinServerMock.startUp("ClusterEventTest", zconf);
notebook = TestUtils.getInstance(Notebook.class);
authorizationService = TestUtils.getInstance(AuthorizationService.class);
schedulerService = new QuartzSchedulerService(zconf, notebook);
schedulerService.waitForFinishInit();
notebookServer = spy(NotebookServer.getInstance());
notebookService = new NotebookService(notebook, authorizationService, zconf, schedulerService);
ConfigurationService configurationService = new ConfigurationService(notebook.getConf());
when(notebookServer.getNotebookService()).thenReturn(notebookService);
when(notebookServer.getConfigurationService()).thenReturn(configurationService);
startOtherZeppelinClusterNode(zconf);
// wait zeppelin cluster startup
Thread.sleep(10000);
// mock cluster manager client
clusterClient = ClusterManagerClient.getInstance(zconf);
clusterClient.start(metaKey);
// Waiting for cluster startup
int wait = 0;
while (wait++ < 100) {
if (clusterIsStartup() && clusterClient.raftInitialized()) {
LOGGER.info("wait {}(ms) found cluster leader", wait * 500);
break;
}
try {
Thread.sleep(500);
} catch (InterruptedException e) {
LOGGER.error(e.getMessage(), e);
}
}
Thread.sleep(3000);
assertEquals(true, clusterIsStartup());
getClusterServerMeta();
}
use of org.apache.zeppelin.notebook.scheduler.QuartzSchedulerService in project zeppelin by apache.
the class NotebookServiceTest method setUp.
@Before
public void setUp() throws Exception {
notebookDir = Files.createTempDirectory("notebookDir").toAbsolutePath().toFile();
System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName(), notebookDir.getAbsolutePath());
ZeppelinConfiguration zeppelinConfiguration = ZeppelinConfiguration.create();
NotebookRepo notebookRepo = new VFSNotebookRepo();
notebookRepo.init(zeppelinConfiguration);
InterpreterSettingManager mockInterpreterSettingManager = mock(InterpreterSettingManager.class);
InterpreterFactory mockInterpreterFactory = mock(InterpreterFactory.class);
Interpreter mockInterpreter = mock(Interpreter.class);
when(mockInterpreterFactory.getInterpreter(any(), any())).thenReturn(mockInterpreter);
when(mockInterpreter.interpret(eq("invalid_code"), any())).thenReturn(new InterpreterResult(Code.ERROR, "failed"));
when(mockInterpreter.interpret(eq("1+1"), any())).thenReturn(new InterpreterResult(Code.SUCCESS, "succeed"));
doCallRealMethod().when(mockInterpreter).getScheduler();
when(mockInterpreter.getFormType()).thenReturn(FormType.NATIVE);
ManagedInterpreterGroup mockInterpreterGroup = mock(ManagedInterpreterGroup.class);
when(mockInterpreter.getInterpreterGroup()).thenReturn(mockInterpreterGroup);
InterpreterSetting mockInterpreterSetting = mock(InterpreterSetting.class);
when(mockInterpreterSetting.isUserAuthorized(any())).thenReturn(true);
when(mockInterpreterGroup.getInterpreterSetting()).thenReturn(mockInterpreterSetting);
when(mockInterpreterSetting.getStatus()).thenReturn(InterpreterSetting.Status.READY);
Credentials credentials = new Credentials();
NoteManager noteManager = new NoteManager(notebookRepo, zeppelinConfiguration);
AuthorizationService authorizationService = new AuthorizationService(noteManager, zeppelinConfiguration);
notebook = new Notebook(zeppelinConfiguration, authorizationService, notebookRepo, noteManager, mockInterpreterFactory, mockInterpreterSettingManager, credentials, null);
searchService = new LuceneSearch(zeppelinConfiguration, notebook);
QuartzSchedulerService schedulerService = new QuartzSchedulerService(zeppelinConfiguration, notebook);
schedulerService.waitForFinishInit();
notebookService = new NotebookService(notebook, authorizationService, zeppelinConfiguration, schedulerService);
String interpreterName = "test";
when(mockInterpreterSetting.getName()).thenReturn(interpreterName);
when(mockInterpreterSettingManager.getDefaultInterpreterSetting()).thenReturn(mockInterpreterSetting);
}
use of org.apache.zeppelin.notebook.scheduler.QuartzSchedulerService in project zeppelin by apache.
the class NotebookTest method setUp.
@Override
@Before
public void setUp() throws Exception {
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_PUBLIC.getVarName(), "true");
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_CRON_ENABLE.getVarName(), "true");
super.setUp();
notebookRepo = new VFSNotebookRepo();
notebookRepo.init(conf);
noteManager = new NoteManager(notebookRepo, conf);
authorizationService = new AuthorizationService(noteManager, conf);
credentials = new Credentials(conf);
notebook = new Notebook(conf, authorizationService, notebookRepo, noteManager, interpreterFactory, interpreterSettingManager, credentials, null);
notebook.setParagraphJobListener(this);
schedulerService = new QuartzSchedulerService(conf, notebook);
schedulerService.waitForFinishInit();
}
Aggregations