@ThreadSafe public class JobTracker extends Object
JobTracker
is used to create, remove, and provide access to the set of currently
scheduled or finished jobs.
All modification of the status of jobs should occur within this class,Constructor and Description |
---|
JobTracker(long capacity,
long retentionMs,
long maxJobPurgeCount)
Create a new instance of
JobTracker . |
Modifier and Type | Method and Description |
---|---|
long |
addJob(JobConfig jobConfig,
CommandManager manager,
JobServerContext ctx,
List<WorkerInfo> workers)
Adds a job with the given
JobConfig to the job tracker. |
Collection<JobCoordinator> |
coordinators()
A collection of all
JobCoordinator currently tracked by the job master. |
JobCoordinator |
getCoordinator(long jobId)
Gets a
JobCoordinator associated with the given job Id. |
Collection<Long> |
jobs()
A collection of all job Ids currently tracked in the job master.
|
public JobTracker(long capacity, long retentionMs, long maxJobPurgeCount)
JobTracker
.capacity
- the capacity of jobs that can be handledretentionMs
- the minimum amount of time to retain jobsmaxJobPurgeCount
- the max amount of jobs to purge when reaching max capacity@Nullable public JobCoordinator getCoordinator(long jobId)
JobCoordinator
associated with the given job Id.jobId
- the job id associated with the JobCoordinator
JobCoordinator
associated with the id, or null if there is no associationpublic long addJob(JobConfig jobConfig, CommandManager manager, JobServerContext ctx, List<WorkerInfo> workers) throws JobDoesNotExistException, ResourceExhaustedException
JobConfig
to the job tracker.jobConfig
- configuration for the jobmanager
- command manager for jobsctx
- the JobServerContext
from the job masterworkers
- a list of available workersJobDoesNotExistException
- if the job type does not existResourceExhaustedException
- if there is no more space available in the job masterpublic Collection<Long> jobs()
public Collection<JobCoordinator> coordinators()
JobCoordinator
currently tracked by the job master. May contain
coordinators for jobs which have finished.JobCoordinator
Copyright © 2023. All Rights Reserved.