@ThreadSafe public final class JobCoordinator extends Object
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels the current job.
|
static JobCoordinator |
create(CommandManager commandManager,
JobServerContext jobServerContext,
List<WorkerInfo> workerInfoList,
Long jobId,
JobConfig jobConfig,
java.util.function.Consumer<JobInfo> statusChangeCallback)
Creates a new instance of the
JobCoordinator . |
boolean |
equals(Object o) |
void |
failTasksForWorker(long workerId)
Fails any incomplete tasks being run on the specified worker.
|
long |
getJobId() |
JobInfo |
getJobInfoWire() |
int |
hashCode() |
boolean |
isJobFinished() |
void |
setJobAsFailed(String errorMessage)
Sets the job as failed with given error message.
|
void |
updateTasks(List<TaskInfo> taskInfoList)
Updates internal status with given tasks.
|
public static JobCoordinator create(CommandManager commandManager, JobServerContext jobServerContext, List<WorkerInfo> workerInfoList, Long jobId, JobConfig jobConfig, java.util.function.Consumer<JobInfo> statusChangeCallback) throws JobDoesNotExistException
JobCoordinator
.commandManager
- the command managerjobServerContext
- the context with information used to select executorsworkerInfoList
- the list of workers to usejobId
- the job IdjobConfig
- configuration for the jobstatusChangeCallback
- Callback to be called for status changes on the jobJobDoesNotExistException
- when the job definition doesn't existpublic void cancel()
public void updateTasks(List<TaskInfo> taskInfoList)
taskInfoList
- List of @TaskInfo instances to updatepublic boolean isJobFinished()
public long getJobId()
public void setJobAsFailed(String errorMessage)
errorMessage
- Error message to set for failurepublic void failTasksForWorker(long workerId)
workerId
- the id of the worker to fail tasks forpublic JobInfo getJobInfoWire()
Copyright © 2023. All Rights Reserved.