Examples of PartitionOwner


Examples of org.apache.giraph.partition.PartitionOwner

      for (PartitionOwner partitionOwner :
        getCurrentPartitionOwners()) {
        WorkerInfo prevWorkerinfo =
          partitionOwner.getWorkerInfo().equals(chosenWorkerInfo) ?
            null : partitionOwner.getWorkerInfo();
        PartitionOwner tmpPartitionOwner =
          new BasicPartitionOwner(partitionOwner.getPartitionId(),
                                  chosenWorkerInfo,
                                  prevWorkerinfo,
                                  null);
        partitionOwnerList.add(tmpPartitionOwner);
View Full Code Here

Examples of org.apache.giraph.partition.PartitionOwner

    LongWritable longWritable = new LongWritable();

    int[] partitions = new int[keySpaceSize];
    for (int i = 0; i < keySpaceSize; i++) {
      longWritable.set(i);
      PartitionOwner owner = workerPartitioner.getPartitionOwner(longWritable);
      partitions[i] = owner.getPartitionId();
    }
    checkMapping(partitions, 1, emptyWorkers);
  }
View Full Code Here

Examples of org.apache.giraph.partition.PartitionOwner

    return workerGraphPartitioner.getPartitionOwners();
  }

  @Override
  public int getPartitionId(I vertexId) {
    PartitionOwner partitionOwner = getVertexPartitionOwner(vertexId);
    return partitionOwner.getPartitionId();
  }
View Full Code Here

Examples of org.apache.giraph.partition.PartitionOwner

   *
   * @param destVertexId Target vertex id
   * @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);
    }
    ++totalMsgsSentInSuperstep;
View Full Code Here

Examples of org.apache.giraph.partition.PartitionOwner

   *
   * @param iterator vertex id iterator
   * @return pointer list
   */
  protected L getOrCreateList(VertexIdIterator<I> iterator) {
    PartitionOwner owner =
        service.getVertexPartitionOwner(iterator.getCurrentVertexId());
    int partitionId = owner.getPartitionId();
    ConcurrentMap<I, L> partitionMap = getOrCreatePartitionMap(partitionId);
    L list = partitionMap.get(iterator.getCurrentVertexId());
    if (list == null) {
      L newList = createList();
      list = partitionMap.putIfAbsent(
View Full Code Here

Examples of org.apache.giraph.partition.PartitionOwner

    // This is going to be reused through every message sending
    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(
          "Failed to serialize the target vertex id.");
      }
      idCounter[currentMachineId]++;
      // Record the first partition id in the worker which message send to.
      // If idCounter shows there is only one target on this worker
      // then this is the partition number of the target vertex.
      if (idCounter[currentMachineId] == 1) {
        firstPartitionMap[currentMachineId] = owner.getPartitionId();
      }
    }
    // Add the message to the cache
    int idSerializerPos = 0;
    int workerMessageSize = 0;
View Full Code Here

Examples of org.apache.giraph.partition.PartitionOwner

  }

  @Override
  public void addEdgeRequest(I vertexIndex, Edge<I, E> edge) throws
      IOException {
    PartitionOwner partitionOwner =
        serviceWorker.getVertexPartitionOwner(vertexIndex);
    int partitionId = partitionOwner.getPartitionId();
    if (LOG.isTraceEnabled()) {
      LOG.trace("addEdgeRequest: Sending edge " + edge + " for index " +
          vertexIndex + " with partition " + partitionId);
    }
View Full Code Here

Examples of org.apache.giraph.partition.PartitionOwner

  }

  @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

Examples of org.apache.giraph.partition.PartitionOwner

  }

  @Override
  public void removeEdgesRequest(I vertexIndex,
                                 I destinationVertexIndex) throws IOException {
    PartitionOwner partitionOwner =
        serviceWorker.getVertexPartitionOwner(vertexIndex);
    int partitionId = partitionOwner.getPartitionId();
    if (LOG.isTraceEnabled()) {
      LOG.trace("removeEdgesRequest: Removing edge " +
          destinationVertexIndex +
          " for index " + vertexIndex + " with partition " + partitionId);
    }
View Full Code Here

Examples of org.apache.giraph.partition.PartitionOwner

        partitionId, partitionOwner, partitionMutationCount);
  }

  @Override
  public void addVertexRequest(Vertex<I, V, E> vertex) throws IOException {
    PartitionOwner partitionOwner =
        serviceWorker.getVertexPartitionOwner(vertex.getId());
    int partitionId = partitionOwner.getPartitionId();
    if (LOG.isTraceEnabled()) {
      LOG.trace("addVertexRequest: Sending vertex " + vertex +
          " to partition " + partitionId);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.