use of io.hops.hopsworks.common.dataset.util.DatasetPath in project hopsworks by logicalclocks.
the class DatasetBuilder method datasetSharedWithItems.
// create dto from a list of DatasetSharedWith objects
private DatasetDTO datasetSharedWithItems(DatasetDTO dto, UriInfo uriInfo, ResourceRequest resourceRequest, Project accessProject, Users user, List<DatasetSharedWith> datasetSharedWithList, String parentPath, Users dirOwner) throws DatasetException, MetadataException, SchematizedTagException {
if (datasetSharedWithList != null && !datasetSharedWithList.isEmpty()) {
for (DatasetSharedWith datasetSharedWith : datasetSharedWithList) {
DatasetPath datasetPath = datasetHelper.getTopLevelDatasetPath(accessProject, datasetSharedWith);
dto.addItem(buildItems(uriInfo, resourceRequest, user, datasetPath, parentPath, dirOwner));
}
}
return dto;
}
use of io.hops.hopsworks.common.dataset.util.DatasetPath in project hopsworks by logicalclocks.
the class DatasetBuilder method datasetItems.
// create dto from a list of dataset
private DatasetDTO datasetItems(DatasetDTO dto, UriInfo uriInfo, ResourceRequest resourceRequest, List<Dataset> datasets, Project accessProject, Users user, String parentPath, Users dirOwner) throws DatasetException, MetadataException, SchematizedTagException {
if (datasets != null && !datasets.isEmpty()) {
for (Dataset dataset : datasets) {
DatasetPath datasetPath = datasetHelper.getTopLevelDatasetPath(accessProject, dataset);
dto.addItem(buildItems(uriInfo, resourceRequest, user, datasetPath, parentPath, dirOwner));
}
}
return dto;
}
use of io.hops.hopsworks.common.dataset.util.DatasetPath in project hopsworks by logicalclocks.
the class ModelsBuilder method build.
// Build specific
public ModelDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Users user, Project userProject, Project modelRegistryProject, ProvStateDTO fileProvenanceHit, String modelsFolder) throws DatasetException, ModelRegistryException, SchematizedTagException, MetadataException {
ModelDTO modelDTO = new ModelDTO();
uri(modelDTO, uriInfo, userProject, modelRegistryProject, fileProvenanceHit);
if (expand(modelDTO, resourceRequest).isExpand()) {
if (fileProvenanceHit.getXattrs() != null && fileProvenanceHit.getXattrs().containsKey(MODEL_SUMMARY_XATTR_NAME)) {
ModelDTO modelSummary = modelUtils.convertProvenanceHitToModel(fileProvenanceHit);
modelDTO.setId(fileProvenanceHit.getMlId());
modelDTO.setName(modelSummary.getName());
modelDTO.setVersion(modelSummary.getVersion());
modelDTO.setUserFullName(modelSummary.getUserFullName());
modelDTO.setCreated(fileProvenanceHit.getCreateTime());
modelDTO.setMetrics(modelSummary.getMetrics());
modelDTO.setDescription(modelSummary.getDescription());
modelDTO.setProgram(modelSummary.getProgram());
modelDTO.setFramework(modelSummary.getFramework());
modelDTO.setTags(tagsBuilder.build(uriInfo, resourceRequest, user, userProject, modelRegistryProject, modelDTO));
String modelVersionPath = modelsFolder + "/" + modelDTO.getName() + "/" + modelDTO.getVersion() + "/";
DatasetPath modelSchemaPath = datasetHelper.getDatasetPath(userProject, modelVersionPath + Settings.HOPS_MODELS_SCHEMA, DatasetType.DATASET);
if (resourceRequest.contains(ResourceRequest.Name.MODELSCHEMA) && modelSchemaPath.getInode() != null) {
InodeDTO modelSchemaDTO = inodeBuilder.buildBlob(uriInfo, new ResourceRequest(ResourceRequest.Name.INODES), user, modelSchemaPath, modelSchemaPath.getInode(), FilePreviewMode.HEAD);
modelDTO.setModelSchema(modelSchemaDTO);
} else {
InodeDTO modelSchemaDTO = inodeBuilder.buildResource(uriInfo, modelRegistryProject, modelSchemaPath);
modelDTO.setModelSchema(modelSchemaDTO);
}
DatasetPath inputExamplePath = datasetHelper.getDatasetPath(userProject, modelVersionPath + Settings.HOPS_MODELS_INPUT_EXAMPLE, DatasetType.DATASET);
if (resourceRequest.contains(ResourceRequest.Name.INPUTEXAMPLE) && inputExamplePath.getInode() != null) {
InodeDTO inputExampleDTO = inodeBuilder.buildBlob(uriInfo, new ResourceRequest(ResourceRequest.Name.INODES), user, inputExamplePath, inputExamplePath.getInode(), FilePreviewMode.HEAD);
modelDTO.setInputExample(inputExampleDTO);
} else {
InodeDTO inputExampleDTO = inodeBuilder.buildResource(uriInfo, modelRegistryProject, inputExamplePath);
modelDTO.setInputExample(inputExampleDTO);
}
modelDTO.setEnvironment(modelSummary.getEnvironment());
modelDTO.setExperimentId(modelSummary.getExperimentId());
modelDTO.setExperimentProjectName(modelSummary.getExperimentProjectName());
modelDTO.setProjectName(modelSummary.getProjectName());
modelDTO.setModelRegistryId(modelRegistryProject.getId());
}
}
return modelDTO;
}
use of io.hops.hopsworks.common.dataset.util.DatasetPath in project hopsworks by logicalclocks.
the class ModelTagsBuilder method build.
public TagsDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Users user, Project userProject, Project modelRegistryProject, ModelDTO model) throws SchematizedTagException, DatasetException, MetadataException {
DatasetPath modelDsPath = datasetHelper.getDatasetPath(userProject, modelUtils.getModelFullPath(modelRegistryProject, model.getName(), model.getVersion()), DatasetType.DATASET);
TagsDTO dto = tagsBuilder.build(uriInfo, resourceRequest, user, modelDsPath);
uriAll(dto, uriInfo, userProject, modelRegistryProject, model.getId());
return dto;
}
use of io.hops.hopsworks.common.dataset.util.DatasetPath in project hopsworks by logicalclocks.
the class ModelsController method deleteInternal.
private void deleteInternal(Users user, Project project, String path) throws DatasetException {
DatasetPath datasetPath = datasetHelper.getDatasetPath(project, path, DatasetType.DATASET);
datasetController.delete(project, user, datasetPath.getFullPath(), datasetPath.getDataset(), datasetPath.isTopLevelDataset());
}
Aggregations