Package org.apache.giraph.worker

Examples of org.apache.giraph.worker.WorkerInfo


        new SimpleLongRangePartitionerFactory<Writable, Writable>();
    factory.setConf(new ImmutableClassesGiraphConfiguration(conf));

    ArrayList<WorkerInfo> infos = new ArrayList<WorkerInfo>();
    for (int i = 0; i < numWorkers; i++) {
      WorkerInfo info = new WorkerInfo();
      info.setInetSocketAddress(new InetSocketAddress(8080));
      info.setTaskId(i);
      infos.add(info);
    }

    Collection<PartitionOwner> owners =
        factory.createMasterGraphPartitioner().createInitialPartitionOwners(infos, -1);

    int[] tasks = new int[owners.size()];
    for (PartitionOwner owner : owners) {
      WorkerInfo worker = owner.getWorkerInfo();
      assertEquals(0, tasks[owner.getPartitionId()]);
      tasks[owner.getPartitionId()] = worker.getTaskId() + 1;
    }
    checkMapping(tasks, allowedWorkerDiff, emptyWorkers);

    WorkerGraphPartitioner<LongWritable, Writable, Writable> workerPartitioner =
        factory.createWorkerGraphPartitioner();
View Full Code Here


    SaslServerHandler mockedSaslServerHandler =
        Mockito.mock(SaslServerHandler.class);
    when(mockedSaslServerFactory.newHandler(conf)).
        thenReturn(mockedSaslServerHandler);

    WorkerInfo workerInfo = new WorkerInfo();
    workerInfo.setTaskId(-1);
    NettyServer server =
        new NettyServer(conf,
            new WorkerRequestServerHandler.Factory(serverData),
            workerInfo,
            context,
            mockedSaslServerFactory,
            new MockExceptionHandler());
    server.start();
    workerInfo.setInetSocketAddress(server.getMyAddress());

    NettyClient client = new NettyClient(context, conf, new WorkerInfo(),
        new MockExceptionHandler());
    client.connectAllAddresses(Lists.<WorkerInfo>newArrayList(workerInfo));

    client.stop();
    server.stop();
View Full Code Here

   * @param message The message sent to the target
   */
  public void sendMessageRequest(I destVertexId, M message) {
    PartitionOwner owner =
      getServiceWorker().getVertexPartitionOwner(destVertexId);
    WorkerInfo workerInfo = owner.getWorkerInfo();
    final int partitionId = owner.getPartitionId();
    if (LOG.isTraceEnabled()) {
      LOG.trace("sendMessageRequest: Send bytes (" + message.toString() +
        ") to " + destVertexId + " on worker " + workerInfo);
    }
View Full Code Here

  }

  @Override
  public void sendToOwner(String name, GlobalCommType sendType, Writable object)
    throws IOException {
    WorkerInfo owner =
        AggregatorUtils.getOwner(name, service.getWorkerInfoList());
    int currentSize = sendGlobalCommCache.addValue(owner.getTaskId(),
        name, sendType, object);
    if (currentSize >= maxBytesPerAggregatorRequest) {
      flushAggregatorsToWorker(owner);
    }
  }
View Full Code Here

    resetIdSerializers();
    resetIdCounter();
    // Count messages
    int currentMachineId = 0;
    PartitionOwner owner = null;
    WorkerInfo workerInfo = null;
    I vertexId = null;
    while (vertexIdIterator.hasNext()) {
      vertexId = vertexIdIterator.next();
      owner = getServiceWorker().getVertexPartitionOwner(vertexId);
      workerInfo = owner.getWorkerInfo();
      currentMachineId = workerInfo.getTaskId();
      // Serialize this target vertex id
      try {
        vertexId.write(idSerializer[currentMachineId]);
      } catch (IOException e) {
        throw new IllegalStateException(
View Full Code Here

  @Override
  public boolean sendEdgeRequest(I sourceVertexId, Edge<I, E> edge)
    throws IOException {
    PartitionOwner owner =
        serviceWorker.getVertexPartitionOwner(sourceVertexId);
    WorkerInfo workerInfo = owner.getWorkerInfo();
    final int partitionId = owner.getPartitionId();
    if (LOG.isTraceEnabled()) {
      LOG.trace("sendEdgeRequest: Send bytes (" + edge.toString() +
          ") to " + sourceVertexId + " on worker " + workerInfo);
    }
View Full Code Here

  }

  @Override
  public boolean sendReducedValue(String name,
      Writable reducedValue) throws IOException {
    WorkerInfo owner =
        AggregatorUtils.getOwner(name,
            serviceWorker.getWorkerInfoList());
    if (isThisWorker(owner)) {
      return false;
    } else {
      int currentSize = sendReducedValuesCache.addValue(owner.getTaskId(),
          name, GlobalCommType.REDUCED_VALUE, reducedValue);
      if (currentSize >= maxBytesPerAggregatorRequest) {
        flushAggregatorsToWorker(owner);
      }
      return true;
View Full Code Here

TOP

Related Classes of org.apache.giraph.worker.WorkerInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.