public class JobStateServiceImpl extends java.lang.Object implements JobStateService
Modifier and Type | Field and Description |
---|---|
protected GenieEventBus |
genieEventBus |
protected io.micrometer.core.instrument.MeterRegistry |
registry |
protected org.springframework.scheduling.TaskScheduler |
scheduler |
Constructor and Description |
---|
JobStateServiceImpl(JobSubmitterService jobSubmitterService,
org.springframework.scheduling.TaskScheduler scheduler,
GenieEventBus genieEventBus,
io.micrometer.core.instrument.MeterRegistry registry)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
done(java.lang.String jobId)
Called when the job is done.
|
int |
getNumActiveJobs()
Get the number of jobs active on this node.
|
int |
getUsedMemory()
Get the amount of memory currently used by jobs in MB.
|
void |
init(java.lang.String jobId)
Initialize the job.
|
boolean |
jobExists(java.lang.String jobId)
Returns true if the job exists locally.
|
void |
schedule(java.lang.String jobId,
JobRequest jobRequest,
Cluster cluster,
Command command,
java.util.List<Application> applications,
int memory)
Schedules the job.
|
protected void |
setMemoryAndTask(java.lang.String jobId,
int memory,
java.util.concurrent.Future<?> task) |
protected final org.springframework.scheduling.TaskScheduler scheduler
protected final io.micrometer.core.instrument.MeterRegistry registry
protected final GenieEventBus genieEventBus
public JobStateServiceImpl(JobSubmitterService jobSubmitterService, org.springframework.scheduling.TaskScheduler scheduler, GenieEventBus genieEventBus, io.micrometer.core.instrument.MeterRegistry registry)
jobSubmitterService
- implementation of the job submitter servicescheduler
- The task scheduler to use to register scheduling of job checkersgenieEventBus
- The event bus to use to publish eventsregistry
- The metrics registrypublic void init(java.lang.String jobId)
init
in interface JobStateService
jobId
- job idpublic void schedule(java.lang.String jobId, JobRequest jobRequest, Cluster cluster, Command command, java.util.List<Application> applications, int memory)
schedule
in interface JobStateService
jobId
- job idjobRequest
- job requestcluster
- cluster for the job request based on the tags specifiedcommand
- command for the job request based on command tags and cluster chosenapplications
- applications to use based on the command that was selectedmemory
- job memorypublic void done(java.lang.String jobId) throws GenieException
done
in interface JobStateService
jobId
- job idGenieException
- on unrecoverable errorpublic boolean jobExists(java.lang.String jobId)
jobExists
in interface JobStateService
jobId
- job idprotected void setMemoryAndTask(java.lang.String jobId, int memory, java.util.concurrent.Future<?> task)
public int getNumActiveJobs()
getNumActiveJobs
in interface JobMetricsService
public int getUsedMemory()
getUsedMemory
in interface JobMetricsService