|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectml.shifu.guagua.worker.GuaguaWorkerService<MASTER_RESULT,WORKER_RESULT>
MASTER_RESULT - master computation result in each iteration.WORKER_RESULT - worker computation result in each iteration.public class GuaguaWorkerService<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable>
GuaguaWorkerService is the basic implementation as a worker for whole application process.
All the properties used to create computable instance, interceptor instances are set in props.
After workerComputable, workerInterceptors are constructed, they will be used in start(),
run(Progressable), stop() to do the whole iteration logic.
GuaguaWorkerService is only a skeleton and all implementations are in the interceptors and computable classes
defined by user.
The execution order of preXXXX is different with postXXXX. For preXXX, the order is FIFO, but for postXXX, the order is FILO.
| 构造方法摘要 | |
|---|---|
GuaguaWorkerService()
|
|
| 方法摘要 | |
|---|---|
String |
getAppId()
|
String |
getContainerId()
|
InMemoryCoordinator<MASTER_RESULT,WORKER_RESULT> |
getCoordinator()
|
String |
getMasterResultClassName()
|
Properties |
getProps()
|
List<GuaguaFileSplit> |
getSplits()
|
int |
getTotalIteration()
|
WorkerComputable<MASTER_RESULT,WORKER_RESULT> |
getWorkerComputable()
|
List<WorkerInterceptor<MASTER_RESULT,WORKER_RESULT>> |
getWorkerInterceptors()
|
String |
getWorkerResultClassName()
|
void |
init(Properties props)
Parameter initialization, such as set result class name, iteration number and so on. |
protected WORKER_RESULT |
iterate(WorkerContext<MASTER_RESULT,WORKER_RESULT> context,
int initialIteration,
Progressable progress)
Call each iteration computation and preIteration, postIteration in interceptors. |
void |
run(Progressable progress)
Iterate WorkerComputable.compute(WorkerContext), and set hook point before and after each iteration. |
void |
setAppId(String appId)
App id for whole application. |
void |
setContainerId(String containerId)
Set the unique container id for master or worker. |
void |
setCoordinator(InMemoryCoordinator<MASTER_RESULT,WORKER_RESULT> coordinator)
|
void |
setMasterResultClassName(String masterResultClassName)
|
void |
setProps(Properties props)
|
void |
setSplits(List<GuaguaFileSplit> splits)
Assign splits to each worker to make them load that data. |
void |
setTotalIteration(int totalIteration)
|
void |
setWorkerComputable(WorkerComputable<MASTER_RESULT,WORKER_RESULT> workerComputable)
|
void |
setWorkerInterceptors(List<WorkerInterceptor<MASTER_RESULT,WORKER_RESULT>> workerInterceptors)
|
void |
setWorkerResultClassName(String workerResultClassName)
|
void |
start()
Start services from interceptors, all services started logic should be wrapperd in WorkerInterceptor.preApplication(WorkerContext); |
void |
stop()
Stop services from interceptors which is used for resource cleaning or servers shutting down. |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public GuaguaWorkerService()
| 方法详细信息 |
|---|
public void start()
WorkerInterceptor.preApplication(WorkerContext);
GuaguaService 中的 startpublic void stop()
GuaguaService 中的 stoppublic void run(Progressable progress)
WorkerComputable.compute(WorkerContext), and set hook point before and after each iteration.
GuaguaService 中的 run
protected WORKER_RESULT iterate(WorkerContext<MASTER_RESULT,WORKER_RESULT> context,
int initialIteration,
Progressable progress)
public void init(Properties props)
GuaguaService 中的 initprops - which contains different properties for master and workers to use.public Properties getProps()
public void setProps(Properties props)
public List<GuaguaFileSplit> getSplits()
public void setSplits(List<GuaguaFileSplit> splits)
GuaguaService 复制的描述
GuaguaService 中的 setSplitspublic String getAppId()
public void setAppId(String appId)
GuaguaService 复制的描述
GuaguaService 中的 setAppIdpublic String getContainerId()
public void setContainerId(String containerId)
GuaguaService 复制的描述
GuaguaService 中的 setContainerIdpublic WorkerComputable<MASTER_RESULT,WORKER_RESULT> getWorkerComputable()
public void setWorkerComputable(WorkerComputable<MASTER_RESULT,WORKER_RESULT> workerComputable)
public int getTotalIteration()
public void setTotalIteration(int totalIteration)
public List<WorkerInterceptor<MASTER_RESULT,WORKER_RESULT>> getWorkerInterceptors()
public void setWorkerInterceptors(List<WorkerInterceptor<MASTER_RESULT,WORKER_RESULT>> workerInterceptors)
public String getMasterResultClassName()
public void setMasterResultClassName(String masterResultClassName)
public String getWorkerResultClassName()
public void setWorkerResultClassName(String workerResultClassName)
public InMemoryCoordinator<MASTER_RESULT,WORKER_RESULT> getCoordinator()
public void setCoordinator(InMemoryCoordinator<MASTER_RESULT,WORKER_RESULT> coordinator)
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||