use of io.hops.hopsworks.persistence.entity.dataset.DatasetSharedWith in project hopsworks by logicalclocks.
the class DatasetHelper method updateDataset.
public DatasetPath updateDataset(Project project, DatasetPath datasetPath, Dataset dataset) {
datasetPath.setDataset(dataset);
if (dataset != null && dataset.isShared(project)) {
DatasetSharedWith datasetSharedWith = datasetSharedWithFacade.findByProjectAndDataset(project, dataset);
datasetPath.setDatasetSharedWith(datasetSharedWith);
}
return datasetPath;
}
use of io.hops.hopsworks.persistence.entity.dataset.DatasetSharedWith in project hopsworks by logicalclocks.
the class DatasetHelper method getTopLevelDatasetPath.
public DatasetPath getTopLevelDatasetPath(Project project, Dataset dataset) throws DatasetException {
DatasetPath datasetPath;
if (dataset.isShared(project)) {
DatasetSharedWith datasetSharedWith = datasetSharedWithFacade.findByProjectAndDataset(project, dataset);
datasetPath = getTopLevelDatasetPath(project, datasetSharedWith);
} else {
datasetPath = getNewDatasetPath(project, dataset.getName(), dataset.getDsType());
datasetPath.setDataset(dataset);
datasetPath.setInode(dataset.getInode());
}
return datasetPath;
}
use of io.hops.hopsworks.persistence.entity.dataset.DatasetSharedWith in project hopsworks by logicalclocks.
the class ElasticController method projectSearchInSharedDatasets.
private SearchHit[] projectSearchInSharedDatasets(Integer projectId, String searchTerm, SearchHit[] elasticHits) throws ElasticException {
Project project = projectFacade.find(projectId);
Collection<DatasetSharedWith> datasetSharedWithCollection = project.getDatasetSharedWithCollection();
for (DatasetSharedWith ds : datasetSharedWithCollection) {
long datasetId = ds.getDataset().getInode().getId();
elasticHits = executeProjectSearchQuery(searchSpecificDataset(datasetId, searchTerm), elasticHits);
elasticHits = executeProjectSearchQuery(datasetSearchQuery(datasetId, searchTerm), elasticHits);
}
return elasticHits;
}
use of io.hops.hopsworks.persistence.entity.dataset.DatasetSharedWith in project hopsworks by logicalclocks.
the class HopsFSProvenanceController method getDatasetsProvType.
public List<ProvDatasetDTO> getDatasetsProvType(Users user, Project project) throws ProvenanceException {
String hdfsUsername = hdfsUsersController.getHdfsUserName(project, user);
DistributedFileSystemOps udfso = dfs.getDfsOps(hdfsUsername);
try {
List<ProvDatasetDTO> result = new ArrayList<>();
for (Dataset dataset : project.getDatasetCollection()) {
String datasetPath = Utils.getFileSystemDatasetPath(dataset, settings);
ProvCoreDTO provCore = getProvCoreXAttr(datasetPath, udfso);
if (provCore == null) {
throw new ProvenanceException(RESTCodes.ProvenanceErrorCode.INTERNAL_ERROR, Level.WARNING, "malformed dataset - provenance", "no provenance core xattr");
}
ProvDatasetDTO dsState = new ProvDatasetDTO(dataset.getName(), dataset.getInode().getId(), provCore.getType());
result.add(dsState);
}
for (DatasetSharedWith dataset : project.getDatasetSharedWithCollection()) {
String datasetPath = Utils.getFileSystemDatasetPath(dataset.getDataset(), settings);
ProvCoreDTO provCore = getProvCoreXAttr(datasetPath, udfso);
if (provCore == null) {
throw new ProvenanceException(RESTCodes.ProvenanceErrorCode.INTERNAL_ERROR, Level.WARNING, "malformed dataset - provenance", "no provenance core xattr");
}
ProvDatasetDTO dsState = new ProvDatasetDTO(dataset.getDataset().getProject().getName() + "::" + dataset.getDataset().getName(), dataset.getDataset().getInode().getId(), provCore.getType());
result.add(dsState);
}
return result;
} finally {
if (udfso != null) {
dfs.closeDfsClient(udfso);
}
}
}
use of io.hops.hopsworks.persistence.entity.dataset.DatasetSharedWith in project hopsworks by logicalclocks.
the class DatasetFacade method findProjectSharedWith.
public List<Project> findProjectSharedWith(Project project, Inode inode) {
Dataset dataset = findByInode(inode);
List<Project> projects = new ArrayList<>();
if (dataset == null) {
return projects;
}
for (DatasetSharedWith ds : dataset.getDatasetSharedWithCollection()) {
if (!ds.getProject().equals(project)) {
projects.add(ds.getProject());
}
}
return projects;
}
Aggregations