use of com.baidu.hugegraph.computer.core.common.ContainerInfo in project hugegraph-computer by hugegraph.
the class Bsp4Master method waitWorkersInitDone.
/**
* Wait workers registered.
*/
public List<ContainerInfo> waitWorkersInitDone() {
LOG.info("Master is waiting for workers init-done");
String path = this.constructPath(BspEvent.BSP_WORKER_INIT_DONE);
List<byte[]> serializedContainers = this.waitOnWorkersEvent(path, this.registerTimeout());
List<ContainerInfo> containers = new ArrayList<>(this.workerCount());
for (byte[] serializedContainer : serializedContainers) {
ContainerInfo container = new ContainerInfo();
SerializeUtil.fromBytes(serializedContainer, container);
containers.add(container);
}
LOG.info("Master waited all workers init-done, workers: {}", containers);
this.assignIdForWorkers(containers);
this.masterAllInitDone(containers);
return containers;
}
use of com.baidu.hugegraph.computer.core.common.ContainerInfo in project hugegraph-computer by hugegraph.
the class Bsp4Worker method assignThisWorkerId.
// Note: The workerInfo in Bsp4Worker is the same object in WorkerService.
private void assignThisWorkerId(List<ContainerInfo> workersFromMaster) {
for (ContainerInfo container : workersFromMaster) {
if (this.workerInfo.uniqueName().equals(container.uniqueName())) {
this.workerInfo.id(container.id());
LOG.info("Worker({}) assigned id {} from master", this.workerInfo.uniqueName(), this.workerInfo.id());
break;
}
}
}
Aggregations