use of io.hops.hopsworks.common.jupyter.NotebookDTO in project hopsworks by logicalclocks.
the class NotebookBuilder method buildNotebook.
private void buildNotebook(SearchHit hit, NotebookDTO notebooks) {
NotebookDTO item = new NotebookDTO();
Map xattrMap = (Map) hit.getSourceAsMap().get("xattr");
Long inodeId = Long.parseLong(hit.getId());
Inode inode = inodeFacade.findById(inodeId);
if (inode != null) {
item.setPath(inodeController.getPath(inode));
}
Map jupyterConfigMap = (Map) xattrMap.get(Settings.META_NOTEBOOK_JUPYTER_CONFIG_XATTR_NAME);
if (jupyterConfigMap != null && !jupyterConfigMap.isEmpty()) {
try {
String jupyterSettingsStr = jupyterConfigMap.get(Settings.META_NOTEBOOK_JUPYTER_CONFIG_XATTR_NAME).toString();
item.setJupyterSettings(objectMapper.readValue(jupyterSettingsStr, JupyterSettings.class));
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Could not parse JupyterSettings for notebook at path: " + item.getPath(), e);
}
item.setDate(new Date(Long.parseLong(jupyterConfigMap.get(Settings.META_USAGE_TIME).toString())));
}
notebooks.addItem(item);
}
use of io.hops.hopsworks.common.jupyter.NotebookDTO in project hopsworks by logicalclocks.
the class NotebookBuilder method build.
public NotebookDTO build(UriInfo uriInfo, Project project, int count) throws ElasticException {
NotebookDTO dto = new NotebookDTO();
dto.setHref(uri(uriInfo, project, count));
SearchHit[] elasticHits = elasticController.recentJupyterNotebookSearch(count, project.getId());
for (SearchHit hit : elasticHits) {
buildNotebook(hit, dto);
}
return dto;
}
Aggregations