Search in sources :

Example 16 with DatasetSharedWith

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;
}
Also used : DatasetSharedWith(io.hops.hopsworks.persistence.entity.dataset.DatasetSharedWith)

Example 17 with DatasetSharedWith

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;
}
Also used : DatasetSharedWith(io.hops.hopsworks.persistence.entity.dataset.DatasetSharedWith)

Example 18 with DatasetSharedWith

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;
}
Also used : Project(io.hops.hopsworks.persistence.entity.project.Project) DatasetSharedWith(io.hops.hopsworks.persistence.entity.dataset.DatasetSharedWith)

Example 19 with DatasetSharedWith

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);
        }
    }
}
Also used : ProvDatasetDTO(io.hops.hopsworks.common.provenance.core.dto.ProvDatasetDTO) ProvenanceException(io.hops.hopsworks.exceptions.ProvenanceException) ProvCoreDTO(io.hops.hopsworks.common.provenance.core.dto.ProvCoreDTO) Dataset(io.hops.hopsworks.persistence.entity.dataset.Dataset) DatasetSharedWith(io.hops.hopsworks.persistence.entity.dataset.DatasetSharedWith) DistributedFileSystemOps(io.hops.hopsworks.common.hdfs.DistributedFileSystemOps) ArrayList(java.util.ArrayList)

Example 20 with DatasetSharedWith

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;
}
Also used : Project(io.hops.hopsworks.persistence.entity.project.Project) Dataset(io.hops.hopsworks.persistence.entity.dataset.Dataset) DatasetSharedWith(io.hops.hopsworks.persistence.entity.dataset.DatasetSharedWith) ArrayList(java.util.ArrayList)

Aggregations

DatasetSharedWith (io.hops.hopsworks.persistence.entity.dataset.DatasetSharedWith)28 DatasetException (io.hops.hopsworks.exceptions.DatasetException)12 Dataset (io.hops.hopsworks.persistence.entity.dataset.Dataset)12 Project (io.hops.hopsworks.persistence.entity.project.Project)11 ArrayList (java.util.ArrayList)7 ProjectException (io.hops.hopsworks.exceptions.ProjectException)6 Inode (io.hops.hopsworks.persistence.entity.hdfs.inode.Inode)5 DistributedFileSystemOps (io.hops.hopsworks.common.hdfs.DistributedFileSystemOps)4 PermissionTransition (io.hops.hopsworks.persistence.entity.dataset.PermissionTransition)4 ProjectTeam (io.hops.hopsworks.persistence.entity.project.team.ProjectTeam)3 TransactionAttribute (javax.ejb.TransactionAttribute)3 Path (org.apache.hadoop.fs.Path)3 HopsSecurityException (io.hops.hopsworks.exceptions.HopsSecurityException)2 ServiceException (io.hops.hopsworks.exceptions.ServiceException)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 AccessControlException (org.apache.hadoop.security.AccessControlException)2 Pair (io.hops.common.Pair)1 ModelRegistryDTO (io.hops.hopsworks.api.modelregistry.dto.ModelRegistryDTO)1 ModelsBuilder (io.hops.hopsworks.api.modelregistry.models.ModelsBuilder)1