@Transactional(readOnly=true) public class JpaJobSearchServiceImpl extends java.lang.Object implements JobSearchService
Constructor and Description |
---|
JpaJobSearchServiceImpl(JpaJobRepository jobRepository,
JpaClusterRepository clusterRepository,
JpaCommandRepository commandRepository)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
org.springframework.data.domain.Page<JobSearchResult> |
findJobs(java.lang.String id,
java.lang.String jobName,
java.lang.String user,
java.util.Set<JobStatus> statuses,
java.util.Set<java.lang.String> tags,
java.lang.String clusterName,
java.lang.String clusterId,
java.lang.String commandName,
java.lang.String commandId,
java.time.Instant minStarted,
java.time.Instant maxStarted,
java.time.Instant minFinished,
java.time.Instant maxFinished,
java.lang.String grouping,
java.lang.String groupingInstance,
@NotNull org.springframework.data.domain.Pageable page)
Search for jobs which match the given filter criteria.
|
java.util.Set<java.lang.String> |
getActiveDisconnectedAgentJobs()
Get the IDs of all agent jobs that are active but currently not connected to any node.
|
long |
getActiveJobCountForUser(@NotBlank java.lang.String user)
Get the count of 'active' jobs for a given user across all instances.
|
long |
getActiveJobCountOnHost(java.lang.String hostname)
Get the number of active Genie jobs on a given host.
|
java.util.Set<Job> |
getAllActiveJobsOnHost(@NotBlank java.lang.String hostname)
Given a hostname return a set of all the jobs currently active on that host.
|
java.util.Set<java.lang.String> |
getAllHostsWithActiveJobs()
Get a set of host names which are currently have active jobs in the Genie cluster.
|
long |
getAllocatedMemoryOnHost(java.lang.String hostname)
Get the amount of memory currently allocated on the given host by Genie jobs that are currently active.
|
Job |
getJob(@NotBlank(message="No id entered. Unable to get job.") java.lang.String id)
Get job information for given job id.
|
java.util.List<Application> |
getJobApplications(@NotBlank java.lang.String id)
Get the applications the job was run with or exception if not found.
|
Cluster |
getJobCluster(@NotBlank java.lang.String id)
Get the cluster the job was run on or exception if not found.
|
Command |
getJobCommand(@NotBlank java.lang.String id)
Get the command the job was run with or exception if not found.
|
JobExecution |
getJobExecution(@NotBlank java.lang.String id)
Get job execution for given job id.
|
java.lang.String |
getJobHost(@NotBlank java.lang.String jobId)
Get the hostname a job is running on.
|
JobMetadata |
getJobMetadata(@NotBlank java.lang.String id)
Get the metadata about a job.
|
JobRequest |
getJobRequest(@NotBlank java.lang.String id)
Get job request for given job id.
|
JobStatus |
getJobStatus(@NotBlank java.lang.String id)
Deprecated.
|
long |
getUsedMemoryOnHost(java.lang.String hostname)
Get the amount of memory currently used on the given host by Genie jobs in any of the following states.
|
java.util.Map<java.lang.String,UserResourcesSummary> |
getUserResourcesSummaries()
Get a map of summaries of resources usage for each user with at least one running job.
|
public JpaJobSearchServiceImpl(JpaJobRepository jobRepository, JpaClusterRepository clusterRepository, JpaCommandRepository commandRepository)
jobRepository
- The repository to use for job entitiesclusterRepository
- The repository to use for cluster entitiescommandRepository
- The repository to use for command entitiespublic org.springframework.data.domain.Page<JobSearchResult> findJobs(@Nullable java.lang.String id, @Nullable java.lang.String jobName, @Nullable java.lang.String user, @Nullable java.util.Set<JobStatus> statuses, @Nullable java.util.Set<java.lang.String> tags, @Nullable java.lang.String clusterName, @Nullable java.lang.String clusterId, @Nullable java.lang.String commandName, @Nullable java.lang.String commandId, @Nullable java.time.Instant minStarted, @Nullable java.time.Instant maxStarted, @Nullable java.time.Instant minFinished, @Nullable java.time.Instant maxFinished, @Nullable java.lang.String grouping, @Nullable java.lang.String groupingInstance, @NotNull @NotNull org.springframework.data.domain.Pageable page)
findJobs
in interface JobSearchService
id
- id for jobjobName
- name of job (can be a SQL-style pattern such as HIVE%)user
- user who submitted jobstatuses
- statuses of jobtags
- tags for the jobclusterName
- name of cluster for jobclusterId
- id of cluster for jobcommandName
- name of the command run in the jobcommandId
- id of the command run in the jobminStarted
- The time which the job had to start after in order to be return (inclusive)maxStarted
- The time which the job had to start before in order to be returned (exclusive)minFinished
- The time which the job had to finish after in order to be return (inclusive)maxFinished
- The time which the job had to finish before in order to be returned (exclusive)grouping
- The job grouping to search forgroupingInstance
- The job grouping instance to search forpage
- Page information of job to getpublic java.util.Set<Job> getAllActiveJobsOnHost(@NotBlank @NotBlank java.lang.String hostname)
getAllActiveJobsOnHost
in interface JobSearchService
hostname
- The host name to search for. Not null or empty.public java.util.Set<java.lang.String> getAllHostsWithActiveJobs()
getAllHostsWithActiveJobs
in interface JobSearchService
public Job getJob(@NotBlank(message="No id entered. Unable to get job.") @NotBlank(message="No id entered. Unable to get job.") java.lang.String id) throws GenieNotFoundException
getJob
in interface JobSearchService
id
- id of job to look upGenieNotFoundException
@Deprecated public JobStatus getJobStatus(@NotBlank @NotBlank java.lang.String id) throws GenieException
getJobStatus
in interface JobSearchService
id
- The id of the job to get status forGenieException
- When any error, including not found, is encounteredpublic JobRequest getJobRequest(@NotBlank @NotBlank java.lang.String id) throws GenieException
getJobRequest
in interface JobSearchService
id
- id of job request to look upGenieException
- if there is an errorpublic JobExecution getJobExecution(@NotBlank @NotBlank java.lang.String id) throws GenieException
getJobExecution
in interface JobSearchService
id
- id of job execution to look upGenieException
- if there is an errorpublic Cluster getJobCluster(@NotBlank @NotBlank java.lang.String id) throws GenieException
getJobCluster
in interface JobSearchService
id
- The id of the job to get the cluster forGenieException
- If either the job or the cluster is not foundpublic Command getJobCommand(@NotBlank @NotBlank java.lang.String id) throws GenieException
getJobCommand
in interface JobSearchService
id
- The id of the job to get the command forGenieException
- If either the job or the command is not foundpublic java.util.List<Application> getJobApplications(@NotBlank @NotBlank java.lang.String id) throws GenieException
getJobApplications
in interface JobSearchService
id
- The id of the job to get the applications forGenieException
- If either the job or the applications were not foundpublic java.lang.String getJobHost(@NotBlank @NotBlank java.lang.String jobId) throws GenieNotFoundException
getJobHost
in interface JobSearchService
jobId
- The id of the job to get the hostname forGenieNotFoundException
- If the job host cannot be foundpublic long getActiveJobCountForUser(@NotBlank @NotBlank java.lang.String user) throws GenieException
getActiveJobCountForUser
in interface JobSearchService
user
- The user nameGenieException
- If any error occurspublic JobMetadata getJobMetadata(@NotBlank @NotBlank java.lang.String id) throws GenieException
getJobMetadata
in interface JobSearchService
id
- The id of the job to get metadata forGenieException
- If any error occurspublic java.util.Map<java.lang.String,UserResourcesSummary> getUserResourcesSummaries()
getUserResourcesSummaries
in interface JobSearchService
public java.util.Set<java.lang.String> getActiveDisconnectedAgentJobs()
getActiveDisconnectedAgentJobs
in interface JobSearchService
public long getAllocatedMemoryOnHost(java.lang.String hostname)
getAllocatedMemoryOnHost
in interface JobSearchService
hostname
- The hostname to get the memory forJobStatus.getActiveStatuses()
public long getUsedMemoryOnHost(java.lang.String hostname)
getUsedMemoryOnHost
in interface JobSearchService
hostname
- The hostname to get the memory forpublic long getActiveJobCountOnHost(java.lang.String hostname)
getActiveJobCountOnHost
in interface JobSearchService
hostname
- The host to get the count forJobStatus.getActiveStatuses()