use of com.baidu.hugegraph.computer.core.config.Config in project hugegraph-computer by hugegraph.
the class InputSplitDataTest method setup.
@BeforeClass
public static void setup() {
Config config = context().config();
masterInputManager = new MockMasterInputManager();
masterInputManager.init(config);
MockRpcClient rpcClient = new MockRpcClient(masterInputManager.handler());
workerInputManager = new MockWorkerInputManager(rpcClient);
workerInputManager.init(config);
}
use of com.baidu.hugegraph.computer.core.config.Config in project hugegraph-computer by hugegraph.
the class HashPartitionerTest method testDist.
@Test
public void testDist() {
int workerCount = 2;
int partitionCount = 10;
Config config = UnitTestBase.updateWithRequiredOptions(ComputerOptions.JOB_WORKERS_COUNT, Integer.toString(workerCount), ComputerOptions.JOB_PARTITIONS_COUNT, Integer.toString(partitionCount));
Partitioner partitioner = config.createObject(ComputerOptions.WORKER_PARTITIONER);
partitioner.init(config);
int[] partitionStat = new int[partitionCount];
int[] workerStat = new int[workerCount];
Random random = new Random();
int hashTimes = 1024;
for (int i = 0; i < hashTimes; i++) {
int partitionId = partitioner.partitionId(BytesId.of(random.nextLong()));
partitionStat[partitionId]++;
int workerId = partitioner.workerId(partitionId);
workerStat[--workerId]++;
}
LOG.info("Partition distribution: {}", Arrays.toString(partitionStat));
LOG.info("Worker distribution: {}", Arrays.toString(workerStat));
Assert.assertEquals(hashTimes, Arrays.stream(partitionStat).sum());
Assert.assertEquals(hashTimes, Arrays.stream(workerStat).sum());
}
use of com.baidu.hugegraph.computer.core.config.Config in project hugegraph-computer by hugegraph.
the class SortManager method createMessageCombiner.
private PointerCombiner createMessageCombiner() {
Config config = this.context.config();
Combiner<Value> valueCombiner = config.createObject(ComputerOptions.WORKER_COMBINER_CLASS, false);
if (valueCombiner == null) {
return null;
}
return new MessageValueCombiner(this.context);
}
Aggregations