public interface JpaJobRepository extends JpaBaseRepository<JobEntity>
Modifier and Type | Method and Description |
---|---|
long |
countByAgentHostnameAndStatusIn(java.lang.String agentHostname,
java.util.Set<JobStatus> statuses)
Get the number of agent jobs on a given host with the given statuses.
|
java.lang.Long |
countJobsByUserAndStatusIn(@NotBlank java.lang.String user,
@NotEmpty java.util.Set<JobStatus> statuses)
Count all jobs that belong to a given user and are in any of the given states.
|
java.lang.Long |
deleteByIdIn(@NotNull java.util.List<java.lang.Long> ids)
Deletes all jobs for the given ids.
|
java.util.Set<JobProjection> |
findByAgentHostnameAndStatusIn(java.lang.String agentHostname,
java.util.Set<JobStatus> statuses)
Find jobs by host name and status.
|
org.springframework.data.domain.Slice<IdProjection> |
findByCreatedBefore(@NotNull java.time.Instant date,
@NotNull org.springframework.data.domain.Pageable pageable)
Returns the slice of ids for job requests created before the given date.
|
java.util.Set<AgentHostnameProjection> |
findDistinctByStatusInAndV4IsFalse(java.util.Set<JobStatus> statuses)
Find the jobs with one of the statuses entered.
|
java.util.Set<UniqueIdProjection> |
getAgentJobIdsWithNoConnectionInState(@NotEmpty java.util.Set<JobStatus> statuses)
Find agent jobs in the given set of states that don't have an entry in the connections table.
|
long |
getTotalMemoryUsedOnHost(java.lang.String agentHostname,
java.util.Set<JobStatus> statuses)
Given the hostname that agents are running on return the total memory their jobs are currently using.
|
java.util.Set<UserJobResourcesAggregate> |
getUserJobResourcesAggregates()
Returns resources usage for each user that has a running job.
|
existsByUniqueId, findByUniqueId, findByUniqueId
deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getOne, saveAll, saveAndFlush
findAll
count, delete, deleteAll, deleteAll, deleteById, existsById, findById, save
java.util.Set<JobProjection> findByAgentHostnameAndStatusIn(java.lang.String agentHostname, java.util.Set<JobStatus> statuses)
agentHostname
- The host name to search forstatuses
- The job statuses to filter bylong countByAgentHostnameAndStatusIn(java.lang.String agentHostname, java.util.Set<JobStatus> statuses)
agentHostname
- The hostname of the agentstatuses
- The statuses the job should be in e.g. JobStatus.getActiveStatuses()
@Query(value="SELECT COALESCE(SUM(j.memoryUsed), 0) FROM JobEntity j WHERE j.agentHostname = :agentHostname AND j.status IN (:statuses)") long getTotalMemoryUsedOnHost(@Param(value="agentHostname") java.lang.String agentHostname, @Param(value="statuses") java.util.Set<JobStatus> statuses)
agentHostname
- The agent hostnamestatuses
- The job statuses to filter by e.g. JobStatus.getActiveStatuses()
java.util.Set<AgentHostnameProjection> findDistinctByStatusInAndV4IsFalse(java.util.Set<JobStatus> statuses)
statuses
- The statuses to search@Modifying java.lang.Long deleteByIdIn(@NotNull @NotNull java.util.List<java.lang.Long> ids)
ids
- list of ids for which the jobs should be deletedjava.lang.Long countJobsByUserAndStatusIn(@NotBlank @NotBlank java.lang.String user, @NotEmpty @NotEmpty java.util.Set<JobStatus> statuses)
user
- the user namestatuses
- the set of statusesorg.springframework.data.domain.Slice<IdProjection> findByCreatedBefore(@NotNull @NotNull java.time.Instant date, @NotNull @NotNull org.springframework.data.domain.Pageable pageable)
date
- The date before which the job requests were createdpageable
- The page of data to get@Query(value="SELECT j.user AS user, COUNT(j) as runningJobsCount, SUM(j.memoryUsed) as usedMemory FROM JobEntity j WHERE j.status = \'RUNNING\' AND j.v4 = FALSE GROUP BY j.user") java.util.Set<UserJobResourcesAggregate> getUserJobResourcesAggregates()
@Query(value="SELECT j FROM JobEntity j WHERE j.status IN (:statuses) AND j.v4 = TRUE AND j.uniqueId NOT IN (SELECT c.jobId FROM AgentConnectionEntity c)") java.util.Set<UniqueIdProjection> getAgentJobIdsWithNoConnectionInState(@Param(value="statuses") @NotEmpty @NotEmpty java.util.Set<JobStatus> statuses)
statuses
- the job statuses filter