mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Sync with secondary storage when reload notebooks
This commit is contained in:
parent
b26dabf818
commit
b03cde2679
5 changed files with 13 additions and 12 deletions
|
|
@ -70,7 +70,7 @@ public class ZeppelinServer extends Application {
|
|||
|
||||
private SchedulerFactory schedulerFactory;
|
||||
private InterpreterFactory replFactory;
|
||||
private NotebookRepo notebookRepo;
|
||||
private NotebookRepoSync notebookRepo;
|
||||
private SearchService notebookIndex;
|
||||
|
||||
public ZeppelinServer() throws Exception {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import org.apache.zeppelin.interpreter.InterpreterFactory;
|
|||
import org.apache.zeppelin.interpreter.InterpreterGroup;
|
||||
import org.apache.zeppelin.interpreter.InterpreterSetting;
|
||||
import org.apache.zeppelin.interpreter.remote.RemoteAngularObjectRegistry;
|
||||
import org.apache.zeppelin.notebook.repo.NotebookRepo;
|
||||
import org.apache.zeppelin.notebook.repo.NotebookRepoSync;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.apache.zeppelin.search.SearchService;
|
||||
import org.quartz.CronScheduleBuilder;
|
||||
|
|
@ -69,7 +69,7 @@ public class Notebook {
|
|||
private StdSchedulerFactory quertzSchedFact;
|
||||
private org.quartz.Scheduler quartzSched;
|
||||
private JobListenerFactory jobListenerFactory;
|
||||
private NotebookRepo notebookRepo;
|
||||
private NotebookRepoSync notebookRepo;
|
||||
private SearchService notebookIndex;
|
||||
|
||||
/**
|
||||
|
|
@ -85,7 +85,7 @@ public class Notebook {
|
|||
* @throws IOException
|
||||
* @throws SchedulerException
|
||||
*/
|
||||
public Notebook(ZeppelinConfiguration conf, NotebookRepo notebookRepo,
|
||||
public Notebook(ZeppelinConfiguration conf, NotebookRepoSync notebookRepo,
|
||||
SchedulerFactory schedulerFactory,
|
||||
InterpreterFactory replFactory, JobListenerFactory jobListenerFactory,
|
||||
SearchService notebookIndex) throws IOException, SchedulerException {
|
||||
|
|
@ -334,6 +334,9 @@ public class Notebook {
|
|||
synchronized (notes) {
|
||||
notes.clear();
|
||||
}
|
||||
if (notebookRepo.getRepoCount() > 1) {
|
||||
notebookRepo.sync();
|
||||
}
|
||||
List<NoteInfo> noteInfos = notebookRepo.list();
|
||||
for (NoteInfo info : noteInfos) {
|
||||
loadNoteFromRepo(info.getId());
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ public class NotebookRepoSync implements NotebookRepo {
|
|||
}
|
||||
}
|
||||
|
||||
int getRepoCount() {
|
||||
public int getRepoCount() {
|
||||
return repos.size();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ import org.apache.zeppelin.interpreter.InterpreterFactory;
|
|||
import org.apache.zeppelin.interpreter.InterpreterOption;
|
||||
import org.apache.zeppelin.interpreter.mock.MockInterpreter1;
|
||||
import org.apache.zeppelin.interpreter.mock.MockInterpreter2;
|
||||
import org.apache.zeppelin.notebook.repo.NotebookRepo;
|
||||
import org.apache.zeppelin.notebook.repo.VFSNotebookRepo;
|
||||
import org.apache.zeppelin.notebook.repo.NotebookRepoSync;
|
||||
import org.apache.zeppelin.scheduler.Job;
|
||||
import org.apache.zeppelin.scheduler.Job.Status;
|
||||
import org.apache.zeppelin.scheduler.JobListener;
|
||||
|
|
@ -60,7 +59,7 @@ public class NotebookTest implements JobListenerFactory{
|
|||
private SchedulerFactory schedulerFactory;
|
||||
private File notebookDir;
|
||||
private Notebook notebook;
|
||||
private NotebookRepo notebookRepo;
|
||||
private NotebookRepoSync notebookRepo;
|
||||
private InterpreterFactory factory;
|
||||
|
||||
@Before
|
||||
|
|
@ -85,7 +84,7 @@ public class NotebookTest implements JobListenerFactory{
|
|||
factory = new InterpreterFactory(conf, new InterpreterOption(false), null);
|
||||
|
||||
SearchService search = mock(SearchService.class);
|
||||
notebookRepo = new VFSNotebookRepo(conf);
|
||||
notebookRepo = new NotebookRepoSync(conf);
|
||||
notebook = new Notebook(conf, notebookRepo, schedulerFactory, factory, this, search);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ import org.apache.zeppelin.notebook.Paragraph;
|
|||
import org.apache.zeppelin.scheduler.JobListener;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.apache.zeppelin.search.SearchService;
|
||||
import org.apache.zeppelin.search.LuceneSearch;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
@ -49,7 +48,7 @@ public class VFSNotebookRepoTest implements JobListenerFactory {
|
|||
private ZeppelinConfiguration conf;
|
||||
private SchedulerFactory schedulerFactory;
|
||||
private Notebook notebook;
|
||||
private NotebookRepo notebookRepo;
|
||||
private NotebookRepoSync notebookRepo;
|
||||
private InterpreterFactory factory;
|
||||
|
||||
private File mainZepDir;
|
||||
|
|
@ -79,7 +78,7 @@ public class VFSNotebookRepoTest implements JobListenerFactory {
|
|||
factory = new InterpreterFactory(conf, new InterpreterOption(false), null);
|
||||
|
||||
SearchService search = mock(SearchService.class);
|
||||
notebookRepo = new VFSNotebookRepo(conf);
|
||||
notebookRepo = new NotebookRepoSync(conf);
|
||||
notebook = new Notebook(conf, notebookRepo, schedulerFactory, factory, this, search);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue