MASTER_RESULT - master result for computation in each iteration.WORKER_RESULT - worker result for computation in each iteration.public class AsyncMasterCoordinator<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable> extends AbstractMasterCoordinator<MASTER_RESULT,WORKER_RESULT>
AsyncMasterCoordinator is used to as a barrier for each iteration.
For each iteration, AsyncMasterCoordinator will wait until all workers are done.
To start a new iteration, AsyncMasterCoordinator will write a znode for each iteration like
'/_guagua/job_201312041304_189025/master/{currentIteration}' with with MasterComputable result as its data.
This is like a signal to notify workers.
Workers are waiting on current master znode, if got current master znode, it will start another iteration.
AbstractMasterCoordinator.FailOverCommand, AbstractMasterCoordinator.MasterElectionCommandBasicCoordinator.BasicCoordinatorCommand, BasicCoordinator.CoordinatorCommand, BasicCoordinator.RetryCoordinatorCommand| Modifier and Type | Field and Description |
|---|---|
protected ProgressLock |
workerInitLock
Lock is used to check register info from all workers.
|
protected ProgressLock |
workerIterationLock
Lock is used to check iteration info from all workers.
|
WAIT_SLOT_MILLS| Constructor and Description |
|---|
AsyncMasterCoordinator() |
| Modifier and Type | Method and Description |
|---|---|
String |
getAppId() |
int |
getCurrentIteration() |
void |
preApplication(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
The hook point before any computation logic.
|
void |
preIteration(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
The hook point before computation of each iteration.
|
void |
process(org.apache.zookeeper.WatchedEvent event) |
void |
setAppId(String appId) |
void |
setCurrentIteration(int currentIteration) |
getMyBid, isAllWorkersHalt, postApplication, postIteration, setMasterResult, setMyBid, setWorkerResults, updateMasterHaltStatuscheckAndSetZooKeeper, closeZooKeeper, getAppNode, getBaseMasterElectionNode, getBytesFromZNode, getCurrentMasterNode, getCurrentMasterSplitNode, getCurrentWorkerNode, getCurrentWorkerSplitNode, getLastMasterNode, getLastWorkerNode, getMasterBaseNode, getMasterElectionNode, getMasterNode, getMasterSerializer, getRootNode, getSleepTime, getWorkerBaseNode, getWorkerBaseNode, getWorkerNode, getWorkerSerializer, getZkConnLatch, getZooKeeper, initialize, isFixedTime, setBytesToZNode, setFixedTime, setMasterSerializer, setSleepTime, setWorkerSerializer, setZooKeeper, startHeartbeat, stopHeartBeatprotected ProgressLock workerInitLock
protected ProgressLock workerIterationLock
public void process(org.apache.zookeeper.WatchedEvent event)
process in interface org.apache.zookeeper.Watcherprocess in class BasicCoordinator<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable>public int getCurrentIteration()
public void setCurrentIteration(int currentIteration)
public String getAppId()
public void setAppId(String appId)
public void preApplication(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
MasterInterceptorcontext - the master context instance which includes worker results and other useful parameters.public void preIteration(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
MasterInterceptorcontext - the master context instance which includes worker results and other useful parameters.Copyright © 2015. All Rights Reserved.