public interface JpaClusterRepository extends JpaBaseRepository<ClusterEntity>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.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.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<java.lang.Long> |
findUnusedClusters(java.util.Set<java.lang.String> unusedStatuses,
java.time.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.
|
java.util.Optional<ClusterEntity> |
getClusterDto(java.lang.String id)
Find the cluster with the given id but also eagerly load all data needed for a cluster DTO.
|
deleteByIdIn, existsByUniqueId, findByUniqueId, findByUniqueIddeleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getOne, saveAll, saveAndFlushfindAllcount, delete, deleteAll, deleteAll, deleteById, existsById, findById, savestatic final java.lang.String FIND_UNUSED_CLUSTERS_SQL
@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)
java.util.Set<java.lang.Long> findUnusedClusters(@Param(value="unusedStatuses")
java.util.Set<java.lang.String> unusedStatuses,
@Param(value="clusterCreatedThreshold")
java.time.Instant clusterCreatedThreshold,
@Param(value="limit")
int limit)
unusedStatuses - The set of statuses a cluster must have to be considered unusedclusterCreatedThreshold - The instant in time which a cluster must have been created before to be considered
unused. Exclusive.limit - Maximum number of IDs to return@Query(value="SELECT c FROM ClusterEntity c WHERE c.uniqueId = :id")
@EntityGraph(value="Cluster.dto",
type=LOAD)
java.util.Optional<ClusterEntity> getClusterDto(@Param(value="id")
java.lang.String id)
id - The id of the command to getClusterEntity with all DTO data loaded or Optional.empty() if there is no
cluster with the given id