public class JMWorkerController extends java.lang.Object implements IWorkerController, MessageHandler
Constructor and Description |
---|
JMWorkerController(Config config,
JobMasterAPI.WorkerInfo workerInfo,
int numberOfWorkers,
int restartCount,
RRClient rrClient,
CheckpointingClient checkpointingClient) |
Modifier and Type | Method and Description |
---|---|
static java.net.InetAddress |
convertStringToIP(java.lang.String ipStr)
convert the given string to ip address object
|
java.util.List<JobMasterAPI.WorkerInfo> |
getAllWorkers()
get all workers in the job.
|
CheckpointingClient |
getCheckpointingClient() |
java.util.List<JobMasterAPI.WorkerInfo> |
getJoinedWorkers()
get all joined workers in this job, including the ones finished execution
if there are some workers that have not joined yet, they may not be included in this list.
|
int |
getNumberOfWorkers()
return the number of all workers in this job,
including non-started ones and finished ones
|
JobMasterAPI.WorkerInfo |
getWorkerInfo()
return the WorkerInfo object for this worker
|
JobMasterAPI.WorkerInfo |
getWorkerInfoForID(int id)
return the WorkerInfo object for the given ID
|
void |
onMessage(RequestID id,
int workerId,
Message message)
Handles a specific message type
|
void |
scaled(int change,
int numOfWorkers)
when the job is scaled, we update the number of workers
|
void |
waitOnBarrier()
wait for all workers in the job to arrive at this barrier
After waiting for the timeout specified in ControllerContext.maxWaitTimeOnBarrier
if some workers still could not arrive at the barrier, throw an exception
|
void |
waitOnBarrier(long timeLimit)
wait for all workers in the job to arrive at this barrier
After waiting for the timeLimit,
if some workers still could not arrive at the barrier, throw an exception
|
void |
waitOnInitBarrier()
this barrier is used when initializing the workers.
|
int |
workerRestartCount()
get worker restartCount
zero means starting for the first time
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFailureListener
public JMWorkerController(Config config, JobMasterAPI.WorkerInfo workerInfo, int numberOfWorkers, int restartCount, RRClient rrClient, CheckpointingClient checkpointingClient)
public JobMasterAPI.WorkerInfo getWorkerInfo()
IWorkerController
getWorkerInfo
in interface IWorkerController
public void scaled(int change, int numOfWorkers)
public JobMasterAPI.WorkerInfo getWorkerInfoForID(int id)
IWorkerController
getWorkerInfoForID
in interface IWorkerController
public int getNumberOfWorkers()
IWorkerController
getNumberOfWorkers
in interface IWorkerController
public java.util.List<JobMasterAPI.WorkerInfo> getJoinedWorkers()
IWorkerController
getJoinedWorkers
in interface IWorkerController
public java.util.List<JobMasterAPI.WorkerInfo> getAllWorkers() throws TimeoutException
IWorkerController
return all workers in the job including the ones that have already left, if any
getAllWorkers
in interface IWorkerController
TimeoutException
public void onMessage(RequestID id, int workerId, Message message)
MessageHandler
onMessage
in interface MessageHandler
id
- request idworkerId
- worker idmessage
- protbuf messagepublic void waitOnBarrier() throws TimeoutException
IWorkerController
waitOnBarrier
in interface IWorkerController
TimeoutException
public void waitOnBarrier(long timeLimit) throws TimeoutException
IWorkerController
waitOnBarrier
in interface IWorkerController
TimeoutException
public void waitOnInitBarrier() throws TimeoutException
IWorkerController
waitOnInitBarrier
in interface IWorkerController
TimeoutException
public static java.net.InetAddress convertStringToIP(java.lang.String ipStr)
public CheckpointingClient getCheckpointingClient()
getCheckpointingClient
in interface IWorkerController
public int workerRestartCount()
IWorkerController
workerRestartCount
in interface IWorkerController