use of io.hops.hopsworks.api.experiments.dto.results.ExperimentResultsDTO in project hopsworks by logicalclocks.
the class ExperimentResultsBuilder method build.
public ExperimentResultSummaryDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Project project, String mlId) throws ExperimentsException {
ExperimentResultSummaryDTO dto = new ExperimentResultSummaryDTO();
uri(dto, uriInfo, project, mlId);
expand(dto, resourceRequest);
dto.setCount(0l);
if (dto.isExpand()) {
DistributedFileSystemOps dfso = null;
try {
dfso = dfs.getDfsOps();
String summaryPath = Utils.getProjectPath(project.getName()) + Settings.HOPS_EXPERIMENTS_DATASET + "/" + mlId + "/.summary.json";
if (dfso.exists(summaryPath)) {
String summaryJson = dfso.cat(new Path(summaryPath));
if (!Strings.isNullOrEmpty(summaryJson)) {
ExperimentResultsDTO[] results = experimentConverter.unmarshalResults(summaryJson).getCombinations();
if (results != null) {
dto.setCount((long) results.length);
results = apply(results, resourceRequest);
dto.setCombinations(results);
}
}
}
} catch (Exception e) {
throw new ExperimentsException(RESTCodes.ExperimentsErrorCode.RESULTS_RETRIEVAL_ERROR, Level.SEVERE, "Unable to get results for experiment", e.getMessage(), e);
} finally {
if (dfso != null) {
dfs.closeDfsClient(dfso);
}
}
}
return dto;
}
Aggregations