use of io.hops.hopsworks.exceptions.GenericException in project hopsworks by logicalclocks.
the class ElasticService method featurestoreSearch.
/**
* Searches for content inside all featurestore. Hits 'featurestore' index
* <p/>
* @param searchTerm
* @param sc
* @return
*/
@ApiOperation(value = "Search all featurestores", notes = "featurestore documents: featuregroups, features, training datasets", response = ElasticFeaturestoreDTO.class)
@GET
@Path("featurestore/{searchTerm}")
@Produces(MediaType.APPLICATION_JSON)
public Response featurestoreSearch(@PathParam("searchTerm") String searchTerm, @QueryParam("docType") @DefaultValue("ALL") FeaturestoreDocType docType, @QueryParam("from") @ApiParam(value = "search pointer position, if none given, it defaults to 0") Integer from, @QueryParam("size") @ApiParam(value = "search page size, if none give, it defaults to 100." + "Cannot be negative and cannot be bigger than 10000") Integer size, @Context SecurityContext sc) throws ServiceException, ElasticException, GenericException {
if (Strings.isNullOrEmpty(searchTerm)) {
throw new GenericException(RESTCodes.GenericErrorCode.ILLEGAL_ARGUMENT, Level.WARNING, "no search term provided");
}
Users user = jWTHelper.getUserPrincipal(sc);
if (from == null) {
from = 0;
}
if (size == null) {
size = 100;
}
ElasticFeaturestoreDTO dto = elasticFeaturestoreBuilder.build(user, new ElasticFeaturestoreRequest(searchTerm, docType, from, size));
return Response.ok().entity(dto).build();
}
use of io.hops.hopsworks.exceptions.GenericException in project hopsworks by logicalclocks.
the class TrainingDatasetService method provenance.
@Path("/{trainingDatasetId}/provenance")
public ProvArtifactResource provenance(@PathParam("trainingDatasetId") Integer trainingDatasetId) throws FeaturestoreException, GenericException {
String tdName = featurestore.getProject().getName() + "_" + Settings.ServiceDataset.TRAININGDATASETS.getName();
DatasetPath targetEndpointPath;
try {
Dataset targetEndpoint = datasetController.getByName(featurestore.getProject(), tdName);
targetEndpointPath = datasetHelper.getTopLevelDatasetPath(project, targetEndpoint);
} catch (DatasetException ex) {
throw new GenericException(RESTCodes.GenericErrorCode.ILLEGAL_ARGUMENT, Level.FINE, "training dataset not found");
}
this.provenanceResource.setContext(project, targetEndpointPath);
TrainingDataset td = trainingDatasetController.getTrainingDatasetById(featurestore, trainingDatasetId);
this.provenanceResource.setArtifactId(td.getName(), td.getVersion());
return provenanceResource;
}
use of io.hops.hopsworks.exceptions.GenericException in project hopsworks by logicalclocks.
the class FeaturegroupService method provenance.
@Path("/{featureGroupId}/provenance")
public ProvArtifactResource provenance(@PathParam("featureGroupId") Integer featureGroupId) throws FeaturestoreException, GenericException {
DatasetPath targetEndpointPath;
try {
Dataset targetEndpoint = featurestoreController.getProjectFeaturestoreDataset(featurestore.getProject());
targetEndpointPath = datasetHelper.getTopLevelDatasetPath(project, targetEndpoint);
} catch (DatasetException ex) {
throw new GenericException(RESTCodes.GenericErrorCode.ILLEGAL_ARGUMENT, Level.FINE, "training dataset not found");
}
this.provenanceResource.setContext(project, targetEndpointPath);
Featuregroup fg = featuregroupController.getFeaturegroupById(featurestore, featureGroupId);
this.provenanceResource.setArtifactId(fg.getName(), fg.getVersion());
return provenanceResource;
}
Aggregations