ml.shifu.guagua.master
接口 MasterComputable<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable>

类型参数:
MASTER_RESULT - master result for computation in each iteration.
WORKER_RESULT - worker result for computation in each iteration.

public interface MasterComputable<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable>

MasterComputable defines master computation for any guagua application. All guagua application should define its own master logic and to configure it by using guagua client configuration.

Any context parameters like current iteration, worker results can be got from MasterContext.

To get global properties like Hadoop and YARN configuration properties, MasterContext.getProps() is a wrapper for Hadoop Configuration. Anything configured by using '-D' in command line can be got from these properties.

MasterContext.getWorkerResults() is the worker results from all the workers in current iteration. It can be used for master computation logic.

Iteration starts from 1, ends with MasterContext.getTotalIteration(). Total iteration number can be set in command line through '-c' parameter.

MasterContext.getAppId() denotes the job ID for a map-reduce job in Hadoop, or YARN application ID for a YARN application. MasterContext.getContainerId() denotes current master container. It is task partition index in Hadoop map-reduce job or split index in YARN guagua application. Container ID is unique for each master task, if current master task is restarted after failure, it should use the same container id to make sure guagua know who it is.


方法摘要
 MASTER_RESULT compute(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
          Master computation for each iteration.
 

方法详细信息

compute

MASTER_RESULT compute(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
Master computation for each iteration.

参数:
context - the master context instance which includes worker results and other useful parameters.
返回:
the master result of each iteration.


Copyright © 2014. All Rights Reserved.