MASTER_RESULT - master result for computation in each iteration.WORKER_RESULT - worker result for computation in each iteration.public class AsyncWorkerCoordinator<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable> extends AbstractWorkerCoordinator<MASTER_RESULT,WORKER_RESULT>
AsyncWorkerCoordinator is used to as a worker barrier for each iteration.
For each iteration, AsyncWorkerCoordinator will wait until master's signal.
To start a new iteration, SyncMasterCoordinator will write a znode for each iteration like
'/_guagua/job_201312041304_189025/master/{currentIteration}' with with MasterComputable result as its data.
AsyncWorkerCoordinator is trying to detect whether it exists, if yes, to start a new iteration.
Worker result will be written into each worker iteration znode for master to get.
AbstractWorkerCoordinator.FailOverCoordinatorCommandBasicCoordinator.BasicCoordinatorCommand, BasicCoordinator.CoordinatorCommand, BasicCoordinator.GetSplitBytes, BasicCoordinator.RetryCoordinatorCommand, BasicCoordinator.SaveResultToZookeeper| Modifier and Type | Field and Description |
|---|---|
protected ProgressLock |
masterInitLock
Lock is used to check register info from master.
|
protected ProgressLock |
masterIterationLock
Lock is used to check iteration info from master.
|
WAIT_SLOT_MILLS| Constructor and Description |
|---|
AsyncWorkerCoordinator() |
| Modifier and Type | Method and Description |
|---|---|
String |
getAppId() |
int |
getCurrentIteration() |
void |
postIteration(WorkerContext<MASTER_RESULT,WORKER_RESULT> context)
The hook point after computation of each iteration.
|
void |
preApplication(WorkerContext<MASTER_RESULT,WORKER_RESULT> context)
The hook point before any computation logic.
|
void |
preIteration(WorkerContext<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) |
postApplication, setMasterResultcheckAndSetZooKeeper, close, 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 masterInitLock
protected ProgressLock masterIterationLock
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(WorkerContext<MASTER_RESULT,WORKER_RESULT> context)
WorkerInterceptorcontext - the worker context instance which includes master result and other useful parameters.public void preIteration(WorkerContext<MASTER_RESULT,WORKER_RESULT> context)
WorkerInterceptorpreIteration in interface WorkerInterceptor<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable>preIteration in class AbstractWorkerCoordinator<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable>context - the worker context instance which includes master result and other useful parameters.public void postIteration(WorkerContext<MASTER_RESULT,WORKER_RESULT> context)
WorkerInterceptorcontext - the worker context instance which includes master result and other useful parameters.Copyright © 2018. All Rights Reserved.