Package org.apache.flink.runtime.execution

Examples of org.apache.flink.runtime.execution.ExecutionState


    //  ----- Request was sent from an input channel (receiver side), requesting the output channel (sender side) ------
    //  -----                               This is the case for backwards events                                 ------

    if (sourceChannelID.equals(edge.getInputChannelId())) {
      final ExecutionVertex targetVertex = edge.getSource().getProducer();
      final ExecutionState executionState = targetVertex.getExecutionState();
     
      // common case - found task running
      if (executionState == ExecutionState.RUNNING) {
        Instance location = targetVertex.getCurrentAssignedResource().getInstance();
       
        if (location.getInstanceConnectionInfo().equals(caller)) {
          // Receiver runs on the same task manager
          return ConnectionInfoLookupResponse.createReceiverFoundAndReady(edge.getOutputChannelId());
        }
        else {
          // 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();
View Full Code Here


    }
  }
 
  public void markFailed(Throwable error) {
    while (true) {
      ExecutionState current = this.executionState;
     
      // if canceled, fine. we are done, and the jobmanager has been told
      if (current == ExecutionState.CANCELED) {
        return;
      }
View Full Code Here

    }
  }
 
  public void cancelExecution() {
    while (true) {
      ExecutionState current = this.executionState;
     
      // if the task is already canceled (or canceling) or finished or failed,
      // then we need not do anything
      if (current == ExecutionState.FINISHED || current == ExecutionState.CANCELED ||
          current == ExecutionState.CANCELING || current == ExecutionState.FAILED)
View Full Code Here

   *
   * @param cause The exception to report in the error message
   */
  public void failExternally(Throwable cause) {
    while (true) {
      ExecutionState current = this.executionState;
     
      // if the task is already canceled (or canceling) or finished or failed,
      // then we need not do anything
      if (current == ExecutionState.FINISHED || current == ExecutionState.CANCELED ||
          current == ExecutionState.CANCELING || current == ExecutionState.FAILED)
View Full Code Here

    }
  }
 
  public void cancelingDone() {
    while (true) {
      ExecutionState current = this.executionState;
     
      if (current == ExecutionState.CANCELED || current == ExecutionState.FAILED) {
        return;
      }
      if (!(current == ExecutionState.RUNNING || current == ExecutionState.CANCELING)) {
View Full Code Here

      throw new JobException("Traget slot for deployment is not alive.");
    }
   
    // make sure exactly one deployment call happens from the correct state
    // note: the transition from CREATED to DEPLOYING is for testing purposes only
    ExecutionState previous = this.state;
    if (previous == SCHEDULED || previous == CREATED) {
      if (!transitionState(previous, DEPLOYING)) {
        // race condition, someone else beat us to the deploying call.
        // this should actually not happen and indicates a race somewhere else
        throw new IllegalStateException("Cannot deploy task: Concurrent deployment call race.");
View Full Code Here

   
    // because of several possibly previous states, we need to again loop until we make a
    // successful atomic state transition
    while (true) {
     
      ExecutionState current = this.state;
     
      if (current == CANCELING || current == CANCELED) {
        // already taken care of, no need to cancel again
        return;
      }
       
      // these two are the common cases where we need to send a cancel call
      else if (current == RUNNING || current == DEPLOYING) {
        // try to transition to canceling, if successful, send the cancel call
        if (transitionState(current, CANCELING)) {
          sendCancelRpcCall();
          return;
        }
        // else: fall through the loop
      }
     
      else if (current == FINISHED || current == FAILED) {
        // nothing to do any more. finished failed before it could be cancelled.
        // in any case, the task is removed from the TaskManager already
        return;
      }
      else if (current == CREATED || current == SCHEDULED) {
        // from here, we can directly switch to cancelled, because the no task has been deployed
        if (transitionState(current, CANCELED)) {
         
          // we skip the canceling state. set the timestamp, for a consistent appearance
          markTimestamp(CANCELING, getStateTimestamp(CANCELED));
         
          try {
            vertex.executionCanceled();
          }
          finally {
            vertex.getExecutionGraph().deregisterExecution(this);
            if (assignedResource != null) {
              assignedResource.releaseSlot();
            }
          }
          return;
        }
        // else: fall through the loop
      }
      else {
        throw new IllegalStateException(current.name());
      }
    }
  }
View Full Code Here

 
  void markFinished() {
   
    // this call usually comes during RUNNING, but may also come while still in deploying (very fast tasks!)
    while (true) {
      ExecutionState current = this.state;
     
      if (current == RUNNING || current == DEPLOYING) {
     
        if (transitionState(current, FINISHED)) {
          try {
View Full Code Here

    // network stack is canceled (for example by a failing / canceling receiver or sender
    // this is an artifact of the old network runtime, but for now we need to support task transitions
    // from running directly to canceled
   
    while (true) {
      ExecutionState current = this.state;
     
      if (current == CANCELED) {
        return;
      }
      else if (current == CANCELING || current == RUNNING || current == DEPLOYING) {
View Full Code Here

    // the actual computation on the task manager is cleaned up by the TaskManager that noticed the failure
   
    // we may need to loop multiple times (in the presence of concurrent calls) in order to
    // atomically switch to failed
    while (true) {
      ExecutionState current = this.state;
     
      if (current == FAILED) {
        // already failed. It is enough to remember once that we failed (its sad enough)
        return false;
      }
View Full Code Here

TOP

Related Classes of org.apache.flink.runtime.execution.ExecutionState

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.