Interface JpaClusterRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<ClusterEntity,Long>, JpaBaseRepository<ClusterEntity>, org.springframework.data.jpa.repository.JpaRepository<ClusterEntity,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<ClusterEntity>, org.springframework.data.repository.PagingAndSortingRepository<ClusterEntity,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<ClusterEntity>, org.springframework.data.repository.Repository<ClusterEntity,Long>

public interface JpaClusterRepository extends JpaBaseRepository<ClusterEntity>
Cluster repository.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The SQL to find all clusters that aren't attached to any jobs still in the database and were created before a certain point in time.
  • Method Summary

    Modifier and Type
    Method
    Description
    findUnusedClusters(Set<String> unusedStatuses, Instant clusterCreatedThreshold, int limit)
    Find all the clusters that aren't attached to any jobs in the database, were created before the given time and have one of the given statuses.
    Find the cluster with the given id but also eagerly load all data needed for a cluster DTO.

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface com.netflix.genie.web.data.services.impl.jpa.repositories.JpaBaseRepository

    deleteByIdIn, existsByUniqueId, findByUniqueId, findByUniqueId

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getById, getOne, getReferenceById, saveAll, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor

    count, exists, findAll, findAll, findAll, findOne

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Field Details

    • FIND_UNUSED_CLUSTERS_SQL

      static final String FIND_UNUSED_CLUSTERS_SQL
      The SQL to find all clusters that aren't attached to any jobs still in the database and were created before a certain point in time.
      See Also:
  • Method Details

    • findUnusedClusters

      @Query(value="SELECT id FROM clusters WHERE status IN (:unusedStatuses) AND created < :clusterCreatedThreshold AND id NOT IN (SELECT DISTINCT(cluster_id) FROM jobs WHERE cluster_id IS NOT NULL) LIMIT :limit", nativeQuery=true) Set<Long> findUnusedClusters(@Param("unusedStatuses") Set<String> unusedStatuses, @Param("clusterCreatedThreshold") Instant clusterCreatedThreshold, @Param("limit") int limit)
      Find all the clusters that aren't attached to any jobs in the database, were created before the given time and have one of the given statuses.
      Parameters:
      unusedStatuses - The set of statuses a cluster must have to be considered unused
      clusterCreatedThreshold - The instant in time which a cluster must have been created before to be considered unused. Exclusive.
      limit - Maximum number of IDs to return
      Returns:
      The ids of the clusters that are considered unused
    • getClusterDto

      @Query("SELECT c FROM ClusterEntity c WHERE c.uniqueId = :id") @EntityGraph(value="Cluster.dto", type=LOAD) Optional<ClusterEntity> getClusterDto(@Param("id") String id)
      Find the cluster with the given id but also eagerly load all data needed for a cluster DTO.
      Parameters:
      id - The id of the command to get
      Returns:
      The ClusterEntity with all DTO data loaded or Optional.empty() if there is no cluster with the given id