Search in sources :

Example 1 with Bsp4Master

use of com.baidu.hugegraph.computer.core.bsp.Bsp4Master in project hugegraph-computer by hugegraph.

the class MasterService method init.

/**
 * Init master service, create the managers used by master.
 */
public void init(Config config) {
    E.checkArgument(!this.inited, "The %s has been initialized", this);
    LOG.info("{} Start to initialize master", this);
    this.serviceThread = Thread.currentThread();
    this.registerShutdownHook();
    this.config = config;
    this.maxSuperStep = this.config.get(ComputerOptions.BSP_MAX_SUPER_STEP);
    InetSocketAddress rpcAddress = this.initManagers();
    this.masterInfo = new ContainerInfo(ContainerInfo.MASTER_ID, TransportUtil.host(rpcAddress), rpcAddress.getPort());
    /*
         * Connect to BSP server and clean the old data may be left by the
         * previous job with same job id.
         */
    this.bsp4Master = new Bsp4Master(this.config);
    this.bsp4Master.clean();
    this.masterComputation = this.config.createObject(ComputerOptions.MASTER_COMPUTATION_CLASS);
    this.masterComputation.init(new DefaultMasterContext());
    this.managers.initedAll(config);
    LOG.info("{} register MasterService", this);
    this.bsp4Master.masterInitDone(this.masterInfo);
    this.workers = this.bsp4Master.waitWorkersInitDone();
    LOG.info("{} waited all workers registered, workers count: {}", this, this.workers.size());
    LOG.info("{} MasterService initialized", this);
    this.inited = true;
}
Also used : Bsp4Master(com.baidu.hugegraph.computer.core.bsp.Bsp4Master) InetSocketAddress(java.net.InetSocketAddress) ContainerInfo(com.baidu.hugegraph.computer.core.common.ContainerInfo)

Aggregations

Bsp4Master (com.baidu.hugegraph.computer.core.bsp.Bsp4Master)1 ContainerInfo (com.baidu.hugegraph.computer.core.common.ContainerInfo)1 InetSocketAddress (java.net.InetSocketAddress)1