Search in sources :

Example 6 with RecvSortManager

use of com.baidu.hugegraph.computer.core.sort.sorting.RecvSortManager in project hugegraph-computer by hugegraph.

the class ComputeMessageRecvPartitionTest method testCombineMessageRecvPartition.

@Test
public void testCombineMessageRecvPartition() throws IOException {
    Config config = UnitTestBase.updateWithRequiredOptions(ComputerOptions.JOB_ID, "local_001", ComputerOptions.JOB_WORKERS_COUNT, "1", ComputerOptions.JOB_PARTITIONS_COUNT, "1", // Make sure all buffers within this limit.
    ComputerOptions.WORKER_RECEIVED_BUFFERS_BYTES_LIMIT, "1000", ComputerOptions.WORKER_COMBINER_CLASS, DoubleValueSumCombiner.class.getName(), ComputerOptions.WORKER_DATA_DIRS, "[data_dir1, data_dir2]", ComputerOptions.WORKER_RECEIVED_BUFFERS_BYTES_LIMIT, "10", ComputerOptions.ALGORITHM_MESSAGE_CLASS, DoubleValue.class.getName(), ComputerOptions.TRANSPORT_RECV_FILE_MODE, "false");
    FileUtils.deleteQuietly(new File("data_dir1"));
    FileUtils.deleteQuietly(new File("data_dir2"));
    FileManager fileManager = new FileManager();
    fileManager.init(config);
    SortManager sortManager = new RecvSortManager(context());
    sortManager.init(config);
    SuperstepFileGenerator fileGenerator = new SuperstepFileGenerator(fileManager, 0);
    ComputeMessageRecvPartition partition = new ComputeMessageRecvPartition(context(), fileGenerator, sortManager);
    Assert.assertEquals("msg", partition.type());
    addTwentyCombineMessageBuffer(partition::addBuffer);
    checkTenCombineMessages(partition.iterator());
    fileManager.close(config);
    sortManager.close(config);
}
Also used : SuperstepFileGenerator(com.baidu.hugegraph.computer.core.store.SuperstepFileGenerator) DoubleValue(com.baidu.hugegraph.computer.core.graph.value.DoubleValue) Config(com.baidu.hugegraph.computer.core.config.Config) DoubleValueSumCombiner(com.baidu.hugegraph.computer.core.combiner.DoubleValueSumCombiner) File(java.io.File) FileManager(com.baidu.hugegraph.computer.core.store.FileManager) RecvSortManager(com.baidu.hugegraph.computer.core.sort.sorting.RecvSortManager) SortManager(com.baidu.hugegraph.computer.core.sort.sorting.SortManager) RecvSortManager(com.baidu.hugegraph.computer.core.sort.sorting.RecvSortManager) Test(org.junit.Test)

Example 7 with RecvSortManager

use of com.baidu.hugegraph.computer.core.sort.sorting.RecvSortManager in project hugegraph-computer by hugegraph.

the class MessageInputTest method setup.

@Before
public void setup() {
    this.config = UnitTestBase.updateWithRequiredOptions(ComputerOptions.JOB_ID, "local_001", ComputerOptions.JOB_WORKERS_COUNT, "1", ComputerOptions.JOB_PARTITIONS_COUNT, "2", ComputerOptions.BSP_MAX_SUPER_STEP, "2", ComputerOptions.WORKER_COMBINER_CLASS, // Can't combine
    Null.class.getName(), ComputerOptions.ALGORITHM_RESULT_CLASS, IdListList.class.getName(), ComputerOptions.ALGORITHM_MESSAGE_CLASS, IdList.class.getName(), ComputerOptions.WORKER_DATA_DIRS, "[data_dir1, data_dir2]", ComputerOptions.WORKER_RECEIVED_BUFFERS_BYTES_LIMIT, "10000", ComputerOptions.WORKER_WAIT_FINISH_MESSAGES_TIMEOUT, "1000", ComputerOptions.INPUT_MAX_EDGES_IN_ONE_VERTEX, "10", ComputerOptions.WORKER_COMPUTATION_CLASS, MockComputation.class.getName(), ComputerOptions.TRANSPORT_RECV_FILE_MODE, "false");
    this.managers = new Managers();
    FileManager fileManager = new FileManager();
    this.managers.add(fileManager);
    SortManager sortManager = new RecvSortManager(context());
    this.managers.add(sortManager);
    MessageRecvManager receiveManager = new MessageRecvManager(context(), fileManager, sortManager);
    this.managers.add(receiveManager);
    this.managers.initAll(this.config);
    this.connectionId = new ConnectionId(new InetSocketAddress("localhost", 8081), 0);
}
Also used : MessageRecvManager(com.baidu.hugegraph.computer.core.receiver.MessageRecvManager) ConnectionId(com.baidu.hugegraph.computer.core.network.ConnectionId) Managers(com.baidu.hugegraph.computer.core.manager.Managers) InetSocketAddress(java.net.InetSocketAddress) FileManager(com.baidu.hugegraph.computer.core.store.FileManager) RecvSortManager(com.baidu.hugegraph.computer.core.sort.sorting.RecvSortManager) SortManager(com.baidu.hugegraph.computer.core.sort.sorting.SortManager) RecvSortManager(com.baidu.hugegraph.computer.core.sort.sorting.RecvSortManager) Before(org.junit.Before)

Example 8 with RecvSortManager

use of com.baidu.hugegraph.computer.core.sort.sorting.RecvSortManager in project hugegraph-computer by hugegraph.

the class MessageRecvManagerTest method setup.

@Before
public void setup() {
    this.config = UnitTestBase.updateWithRequiredOptions(ComputerOptions.JOB_ID, "local_001", ComputerOptions.JOB_WORKERS_COUNT, "1", ComputerOptions.BSP_MAX_SUPER_STEP, "1", ComputerOptions.WORKER_COMBINER_CLASS, DoubleValueSumCombiner.class.getName(), ComputerOptions.WORKER_DATA_DIRS, "[data_dir1, data_dir2]", ComputerOptions.WORKER_RECEIVED_BUFFERS_BYTES_LIMIT, "100", ComputerOptions.WORKER_WAIT_FINISH_MESSAGES_TIMEOUT, "100", ComputerOptions.ALGORITHM_MESSAGE_CLASS, DoubleValue.class.getName(), ComputerOptions.TRANSPORT_RECV_FILE_MODE, "false");
    this.fileManager = new FileManager();
    this.fileManager.init(this.config);
    this.sortManager = new RecvSortManager(context());
    this.sortManager.init(this.config);
    this.receiveManager = new MessageRecvManager(context(), this.fileManager, this.sortManager);
    this.receiveManager.init(this.config);
    this.connectionId = new ConnectionId(new InetSocketAddress("localhost", 8081), 0);
}
Also used : ConnectionId(com.baidu.hugegraph.computer.core.network.ConnectionId) InetSocketAddress(java.net.InetSocketAddress) FileManager(com.baidu.hugegraph.computer.core.store.FileManager) RecvSortManager(com.baidu.hugegraph.computer.core.sort.sorting.RecvSortManager) Before(org.junit.Before)

Aggregations

RecvSortManager (com.baidu.hugegraph.computer.core.sort.sorting.RecvSortManager)8 FileManager (com.baidu.hugegraph.computer.core.store.FileManager)8 SortManager (com.baidu.hugegraph.computer.core.sort.sorting.SortManager)5 SuperstepFileGenerator (com.baidu.hugegraph.computer.core.store.SuperstepFileGenerator)4 File (java.io.File)4 InetSocketAddress (java.net.InetSocketAddress)4 Before (org.junit.Before)4 Config (com.baidu.hugegraph.computer.core.config.Config)3 MessageRecvManager (com.baidu.hugegraph.computer.core.receiver.MessageRecvManager)3 Test (org.junit.Test)3 ConnectionId (com.baidu.hugegraph.computer.core.network.ConnectionId)2 ConnectionManager (com.baidu.hugegraph.computer.core.network.connection.ConnectionManager)2 TransportConnectionManager (com.baidu.hugegraph.computer.core.network.connection.TransportConnectionManager)2 WorkerAggrManager (com.baidu.hugegraph.computer.core.aggregator.WorkerAggrManager)1 DoubleValueSumCombiner (com.baidu.hugegraph.computer.core.combiner.DoubleValueSumCombiner)1 TransportException (com.baidu.hugegraph.computer.core.common.exception.TransportException)1 Null (com.baidu.hugegraph.computer.core.config.Null)1 DoubleValue (com.baidu.hugegraph.computer.core.graph.value.DoubleValue)1 IdList (com.baidu.hugegraph.computer.core.graph.value.IdList)1 WorkerInputManager (com.baidu.hugegraph.computer.core.input.WorkerInputManager)1