Package org.apache.flink.runtime.io.network

Examples of org.apache.flink.runtime.io.network.RemoteReceiver


          // Receiver runs on a different task manager
          final InstanceConnectionInfo ici = location.getInstanceConnectionInfo();
          final InetSocketAddress isa = new InetSocketAddress(ici.address(), ici.dataPort());

          int connectionIdx = edge.getSource().getIntermediateResult().getConnectionIndex();
          return ConnectionInfoLookupResponse.createReceiverFoundAndReady(new RemoteReceiver(isa, connectionIdx));
        }
      }
      else if (executionState == ExecutionState.FINISHED) {
        // that should not happen. if there is data pending, the sender cannot yet be done
        // we need to fail the whole affair
        LOG.error("Receiver " + targetVertex + " set to FINISHED even though data is pending");
        fail(new Exception("Channels are not correctly registered"));
        return ConnectionInfoLookupResponse.createReceiverNotFound();
      }
      else if (executionState == ExecutionState.FAILED || executionState == ExecutionState.CANCELED ||
          executionState == ExecutionState.CANCELING)
      {
        return ConnectionInfoLookupResponse.createJobIsAborting();
      }
      else {
        // all other states should not be, because the sender cannot be in CREATED, SCHEDULED, or DEPLOYING
        // state when the receiver is already running
        LOG.error("Channel lookup (backwards) - sender " + targetVertex + " found in inconsistent state " + executionState);
        fail(new Exception("Channels are not correctly registered"));
        return ConnectionInfoLookupResponse.createReceiverNotFound();
      }
    }
   
    //  ----- Request was sent from an output channel (sender side), requesting the input channel (receiver side) ------
    //  -----                                 This is the case for forward data                                   ------
   
    final ExecutionVertex targetVertex = edge.getTarget();
    final ExecutionState executionState = targetVertex.getExecutionState();

    if (executionState == ExecutionState.RUNNING) {
     
      // already online
      Instance location = targetVertex.getCurrentAssignedResource().getInstance();
     
      if (location.getInstanceConnectionInfo().equals(caller)) {
        // Receiver runs on the same task manager
        return ConnectionInfoLookupResponse.createReceiverFoundAndReady(edge.getInputChannelId());
      }
      else {
        // Receiver runs on a different task manager
        final InstanceConnectionInfo ici = location.getInstanceConnectionInfo();
        final InetSocketAddress isa = new InetSocketAddress(ici.address(), ici.dataPort());

        final int connectionIdx = edge.getSource().getIntermediateResult().getConnectionIndex();
        return ConnectionInfoLookupResponse.createReceiverFoundAndReady(new RemoteReceiver(isa, connectionIdx));
      }
    }
    else if (executionState == ExecutionState.DEPLOYING || executionState == ExecutionState.SCHEDULED) {
      return ConnectionInfoLookupResponse.createReceiverNotReady();
    }
View Full Code Here


    // start sender threads
    // --------------------------------------------------------------------
    RemoteReceiver[] receivers = new RemoteReceiver[numChannels];

    for (int i = 0; i < numChannels; i++) {
      receivers[i] = new RemoteReceiver(new InetSocketAddress(localhost, BIND_PORT + 1), i);
    }

    for (int i = 0; i < numSubtasks; i++) {
      final RemoteReceiver receiver = receivers[random.nextInt(numChannels)];

      final AtomicInteger seqNum = new AtomicInteger(0);
      final JobID jobId = new JobID();
      final ChannelID channelId = new ChannelID();
View Full Code Here

    StringBuilder str = new StringBuilder();

    str.append(String.format("==== %d outgoing connections ===\n", this.outConnections.size()));

    for (Map.Entry<RemoteReceiver, Object> entry : this.outConnections.entrySet()) {
      RemoteReceiver receiver = entry.getKey();

      Object value = entry.getValue();
      if (value instanceof OutboundConnectionQueue) {
        OutboundConnectionQueue queue = (OutboundConnectionQueue) value;
        if (queue.getNumQueuedEnvelopes() > 0) {
View Full Code Here

TOP

Related Classes of org.apache.flink.runtime.io.network.RemoteReceiver

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.