@ThreadSafe public class PlanTracker extends Object
PlanTracker
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 |
---|
PlanTracker(long capacity,
long retentionMs,
long maxJobPurgeCount,
WorkflowTracker workflowTracker)
Create a new instance of
PlanTracker . |
Modifier and Type | Method and Description |
---|---|
Collection<PlanCoordinator> |
coordinators()
A collection of all
PlanCoordinator currently tracked by the job master. |
java.util.stream.Stream<PlanInfo> |
failed() |
PlanCoordinator |
getCoordinator(long jobId)
Gets a
PlanCoordinator associated with the given job Id. |
Collection<Long> |
list()
A collection of all job Ids currently tracked in the job master.
|
void |
run(PlanConfig jobConfig,
CommandManager manager,
JobServerContext ctx,
List<WorkerInfo> workers,
long jobId)
Adds a job with the given
JobConfig to the job tracker. |
public PlanTracker(long capacity, long retentionMs, long maxJobPurgeCount, WorkflowTracker workflowTracker)
PlanTracker
.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 capacityworkflowTracker
- the workflow tracker instance@Nullable public PlanCoordinator getCoordinator(long jobId)
PlanCoordinator
associated with the given job Id.jobId
- the job id associated with the PlanCoordinator
PlanCoordinator
associated with the id, or null if there is no associationpublic void run(PlanConfig jobConfig, CommandManager manager, JobServerContext ctx, List<WorkerInfo> workers, long jobId) 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 workersjobId
- job id of the newly added jobJobDoesNotExistException
- if the job type does not existResourceExhaustedException
- if there is no more space available in the job masterpublic Collection<Long> list()
public Collection<PlanCoordinator> coordinators()
PlanCoordinator
currently tracked by the job master. May contain
coordinators for jobs which have finished.PlanCoordinator
public java.util.stream.Stream<PlanInfo> failed()
Copyright © 2023. All Rights Reserved.