use of io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode in project hopsworks by logicalclocks.
the class CodeController method registerCode.
public FeaturestoreCode registerCode(Project project, Users user, Long codeCommitTimeStamp, String applicationId, TrainingDataset trainingDataset, String entityId, String databricksNotebook, byte[] databricksArchive, CodeActions.RunType type) throws ServiceException, FeaturestoreException {
Inode codeInode = saveCode(project, user, applicationId, trainingDataset, entityId, databricksNotebook, databricksArchive, type);
Timestamp commitTime = new Timestamp(codeCommitTimeStamp);
FeaturestoreCode featurestoreCode = new FeaturestoreCode(commitTime, codeInode, trainingDataset, applicationId);
return featurestoreCodeFacade.update(featurestoreCode);
}
use of io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode in project hopsworks by logicalclocks.
the class CodeResource method post.
@POST
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Save new code")
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.DATASET_VIEW, ApiScope.FEATURESTORE }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response post(@Context UriInfo uriInfo, @Context SecurityContext sc, @QueryParam("entityId") String entityId, @QueryParam("type") CodeActions.RunType type, @QueryParam("databricksClusterId") String databricksClusterId, CodeDTO codeDTO) throws FeaturestoreException, DatasetException, HopsSecurityException, ServiceException, UserException {
Users user = jWTHelper.getUserPrincipal(sc);
String databricksNotebook = null;
byte[] databricksArchive = null;
CodeDTO dto;
if (featuregroup != null) {
FeaturestoreCode featurestoreCode = codeController.registerCode(project, user, codeDTO.getCommitTime(), codeDTO.getFeatureGroupCommitId(), codeDTO.getApplicationId(), featuregroup, entityId, databricksNotebook, databricksArchive, type);
dto = codeBuilder.build(uriInfo, new ResourceRequest(ResourceRequest.Name.CODE), project, user, featuregroup, featurestoreCode, JupyterController.NotebookConversion.HTML);
} else {
FeaturestoreCode featurestoreCode = codeController.registerCode(project, user, codeDTO.getCommitTime(), codeDTO.getApplicationId(), trainingDataset, entityId, databricksNotebook, databricksArchive, type);
dto = codeBuilder.build(uriInfo, new ResourceRequest(ResourceRequest.Name.CODE), project, user, trainingDataset, featurestoreCode, JupyterController.NotebookConversion.HTML);
}
return Response.ok().entity(dto).build();
}
Aggregations