Search in sources :

Example 1 with FeaturestoreCode

use of io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode in project hopsworks by logicalclocks.

the class CodeBuilder method build.

public CodeDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Project project, Users user, Featurestore featurestore, Featuregroup featuregroup, JupyterController.NotebookConversion format) throws ServiceException, FeaturestoreException {
    CodeDTO dto = new CodeDTO();
    dto.setHref(uri(uriInfo, project, featurestore, featuregroup));
    dto.setExpand(expand(resourceRequest));
    if (dto.isExpand()) {
        AbstractFacade.CollectionInfo<FeaturestoreCode> collectionInfo = codeFacade.findByFeaturegroup(resourceRequest.getOffset(), resourceRequest.getLimit(), resourceRequest.getSort(), resourceRequest.getFilter(), featuregroup);
        dto.setCount(collectionInfo.getCount());
        for (FeaturestoreCode s : collectionInfo.getItems()) {
            dto.addItem(build(uriInfo, resourceRequest, project, user, featuregroup, s, format));
        }
    }
    return dto;
}
Also used : AbstractFacade(io.hops.hopsworks.common.dao.AbstractFacade) FeaturestoreCode(io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode)

Example 2 with FeaturestoreCode

use of io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode in project hopsworks by logicalclocks.

the class CodeBuilder method build.

public CodeDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Project project, Users user, Featurestore featurestore, TrainingDataset trainingDataset, JupyterController.NotebookConversion format) throws ServiceException, FeaturestoreException {
    CodeDTO dto = new CodeDTO();
    dto.setHref(uri(uriInfo, project, featurestore, trainingDataset));
    dto.setExpand(expand(resourceRequest));
    if (dto.isExpand()) {
        AbstractFacade.CollectionInfo<FeaturestoreCode> collectionInfo = codeFacade.findByTrainingDataset(resourceRequest.getOffset(), resourceRequest.getLimit(), resourceRequest.getSort(), resourceRequest.getFilter(), trainingDataset);
        dto.setCount(collectionInfo.getCount());
        for (FeaturestoreCode s : collectionInfo.getItems()) {
            dto.addItem(build(uriInfo, resourceRequest, project, user, trainingDataset, s, format));
        }
    }
    return dto;
}
Also used : AbstractFacade(io.hops.hopsworks.common.dao.AbstractFacade) FeaturestoreCode(io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode)

Example 3 with FeaturestoreCode

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, Long fgCommitId, String applicationId, Featuregroup featuregroup, String entityId, String databricksNotebook, byte[] databricksArchive, CodeActions.RunType type) throws ServiceException, FeaturestoreException {
    Inode codeInode = saveCode(project, user, applicationId, featuregroup, entityId, databricksNotebook, databricksArchive, type);
    Timestamp commitTime = new Timestamp(codeCommitTimeStamp);
    FeaturestoreCode featurestoreCode = new FeaturestoreCode(commitTime, codeInode, featuregroup, applicationId);
    if (featuregroup.getFeaturegroupType() == FeaturegroupType.CACHED_FEATURE_GROUP && featuregroup.getCachedFeaturegroup().getTimeTravelFormat() == TimeTravelFormat.HUDI) {
        FeatureGroupCommit featureGroupCommit = featureGroupCommitCommitController.findCommitByDate(featuregroup, fgCommitId);
        featurestoreCode.setFeatureGroupCommit(featureGroupCommit);
    }
    return featurestoreCodeFacade.update(featurestoreCode);
}
Also used : Inode(io.hops.hopsworks.persistence.entity.hdfs.inode.Inode) FeaturestoreCode(io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode) FeatureGroupCommit(io.hops.hopsworks.persistence.entity.featurestore.featuregroup.cached.FeatureGroupCommit) Timestamp(java.sql.Timestamp)

Example 4 with FeaturestoreCode

use of io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode in project hopsworks by logicalclocks.

the class FeaturestoreCodeFacade method findByFeaturegroup.

public CollectionInfo<FeaturestoreCode> findByFeaturegroup(Integer offset, Integer limit, Set<? extends SortBy> sorts, Set<? extends FilterBy> filters, Featuregroup featuregroup) {
    String queryStr = buildQuery("SELECT s from FeaturestoreCode s ", filters, sorts, "s.featureGroup = :featureGroup");
    String queryCountStr = buildQuery("SELECT COUNT(s.id) from FeaturestoreCode s ", filters, sorts, "s.featureGroup = :featureGroup");
    Query query = em.createQuery(queryStr, FeaturestoreCode.class).setParameter("featureGroup", featuregroup);
    Query queryCount = em.createQuery(queryCountStr, FeaturestoreCode.class).setParameter("featureGroup", featuregroup);
    setFilter(filters, query);
    setFilter(filters, queryCount);
    setOffsetAndLim(offset, limit, query);
    return new CollectionInfo((Long) queryCount.getSingleResult(), query.getResultList());
}
Also used : Query(javax.persistence.Query) FeaturestoreCode(io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode)

Example 5 with FeaturestoreCode

use of io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode in project hopsworks by logicalclocks.

the class FeaturestoreCodeFacade method findByTrainingDataset.

public CollectionInfo<FeaturestoreCode> findByTrainingDataset(Integer offset, Integer limit, Set<? extends SortBy> sorts, Set<? extends FilterBy> filters, TrainingDataset trainingDataset) {
    String queryStr = buildQuery("SELECT s from FeaturestoreCode s ", filters, sorts, "s.trainingDataset = :trainingDataset");
    String queryCountStr = buildQuery("SELECT COUNT(s.id) from FeaturestoreCode s ", filters, sorts, "s.trainingDataset = :trainingDataset");
    Query query = em.createQuery(queryStr, FeaturestoreCode.class).setParameter("trainingDataset", trainingDataset);
    Query queryCount = em.createQuery(queryCountStr, FeaturestoreCode.class).setParameter("trainingDataset", trainingDataset);
    setFilter(filters, query);
    setFilter(filters, queryCount);
    setOffsetAndLim(offset, limit, query);
    return new CollectionInfo((Long) queryCount.getSingleResult(), query.getResultList());
}
Also used : Query(javax.persistence.Query) FeaturestoreCode(io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode)

Aggregations

FeaturestoreCode (io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode)7 AbstractFacade (io.hops.hopsworks.common.dao.AbstractFacade)2 Inode (io.hops.hopsworks.persistence.entity.hdfs.inode.Inode)2 Timestamp (java.sql.Timestamp)2 Query (javax.persistence.Query)2 AllowedProjectRoles (io.hops.hopsworks.api.filter.AllowedProjectRoles)1 ApiKeyRequired (io.hops.hopsworks.api.filter.apiKey.ApiKeyRequired)1 ResourceRequest (io.hops.hopsworks.common.api.ResourceRequest)1 JWTRequired (io.hops.hopsworks.jwt.annotation.JWTRequired)1 FeatureGroupCommit (io.hops.hopsworks.persistence.entity.featurestore.featuregroup.cached.FeatureGroupCommit)1 Users (io.hops.hopsworks.persistence.entity.user.Users)1 ApiOperation (io.swagger.annotations.ApiOperation)1 POST (javax.ws.rs.POST)1 Produces (javax.ws.rs.Produces)1