Class CreatingExecutionGraph

java.lang.Object
org.apache.flink.runtime.scheduler.adaptive.CreatingExecutionGraph
All Implemented Interfaces:
LabeledGlobalFailureHandler

public class CreatingExecutionGraph extends Object
State which waits for the creation of the ExecutionGraph. If the creation fails, then the state transitions to Finished. If the creation succeeds, then the system tries to assign the required slots. If the set of available slots has changed so that the created ExecutionGraph cannot be executed, the state transitions back into WaitingForResources. If there are enough slots for the ExecutionGraph to run, the state transitions to Executing.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CreatingExecutionGraph(org.apache.flink.runtime.scheduler.adaptive.CreatingExecutionGraph.Context context, CompletableFuture<org.apache.flink.runtime.scheduler.adaptive.CreatingExecutionGraph.ExecutionGraphWithVertexParallelism> executionGraphWithParallelismFuture, org.slf4j.Logger logger, org.apache.flink.runtime.scheduler.adaptive.CreatingExecutionGraph.OperatorCoordinatorHandlerFactory operatorCoordinatorFactory, ExecutionGraph previousExecutionGraph)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default <T> Optional<T>
    as(Class<? extends T> clazz)
    Tries to cast this state into a type of the given clazz.
    void
     
     
    org.apache.flink.api.common.JobID
     
    org.apache.flink.api.common.JobStatus
     
    org.slf4j.Logger
     
    void
    An adapted version of GlobalFailureHandler that handles and associates global failures with enricher labels.
    default void
    onLeave(Class<? extends org.apache.flink.runtime.scheduler.adaptive.State> newState)
    This method is called whenever one transitions out of this state.
    void
     
    default <T, V, E extends Exception>
    Optional<V>
    tryCall(Class<? extends T> clazz, org.apache.flink.util.function.FunctionWithException<T,V,E> action, String debugMessage)
    Tries to run the action if this state is of type clazz.
    default <T, E extends Exception>
    void
    tryRun(Class<? extends T> clazz, org.apache.flink.util.function.ThrowingConsumer<T,E> action, String debugMessage)
    Tries to run the action if this state is of type clazz.
    default <T, E extends Exception>
    void
    tryRun(Class<? extends T> clazz, org.apache.flink.util.function.ThrowingConsumer<T,E> action, Consumer<org.slf4j.Logger> invalidStateCallback)
    Tries to run the action if this state is of type clazz.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CreatingExecutionGraph

      public CreatingExecutionGraph(org.apache.flink.runtime.scheduler.adaptive.CreatingExecutionGraph.Context context, CompletableFuture<org.apache.flink.runtime.scheduler.adaptive.CreatingExecutionGraph.ExecutionGraphWithVertexParallelism> executionGraphWithParallelismFuture, org.slf4j.Logger logger, org.apache.flink.runtime.scheduler.adaptive.CreatingExecutionGraph.OperatorCoordinatorHandlerFactory operatorCoordinatorFactory, @Nullable ExecutionGraph previousExecutionGraph)
  • Method Details

    • getJobStatus

      public org.apache.flink.api.common.JobStatus getJobStatus()
    • cancel

      public void cancel()
    • suspend

      public void suspend(Throwable cause)
    • getJobId

      public org.apache.flink.api.common.JobID getJobId()
    • getJob

      public ArchivedExecutionGraph getJob()
    • handleGlobalFailure

      public void handleGlobalFailure(Throwable cause, CompletableFuture<Map<String,String>> failureLabels)
      Description copied from interface: LabeledGlobalFailureHandler
      An adapted version of GlobalFailureHandler that handles and associates global failures with enricher labels.
      Specified by:
      handleGlobalFailure in interface LabeledGlobalFailureHandler
      Parameters:
      cause - A cause that describes the global failure.
      failureLabels - Labels providing an additional context about the failure.
    • getLogger

      public org.slf4j.Logger getLogger()
    • onLeave

      default void onLeave(Class<? extends org.apache.flink.runtime.scheduler.adaptive.State> newState)
      This method is called whenever one transitions out of this state.
      Parameters:
      newState - newState is the state into which the scheduler transitions
    • as

      default <T> Optional<T> as(Class<? extends T> clazz)
      Tries to cast this state into a type of the given clazz.
      Type Parameters:
      T - target type
      Parameters:
      clazz - clazz describes the target type
      Returns:
      Optional.of(T) target type if the underlying type can be cast into clazz; otherwise Optional.empty()
    • tryRun

      default <T, E extends Exception> void tryRun(Class<? extends T> clazz, org.apache.flink.util.function.ThrowingConsumer<T,E> action, String debugMessage) throws E
      Tries to run the action if this state is of type clazz.
      Type Parameters:
      T - target type
      E - error type
      Parameters:
      clazz - clazz describes the target type
      action - action to run if this state is of the target type
      debugMessage - debugMessage which is printed if this state is not the target type
      Throws:
      E - an exception if the action fails
    • tryRun

      default <T, E extends Exception> void tryRun(Class<? extends T> clazz, org.apache.flink.util.function.ThrowingConsumer<T,E> action, Consumer<org.slf4j.Logger> invalidStateCallback) throws E
      Tries to run the action if this state is of type clazz.
      Type Parameters:
      T - target type
      E - error type
      Parameters:
      clazz - clazz describes the target type
      action - action to run if this state is of the target type
      invalidStateCallback - that is called if the state isn't matching the expected one.
      Throws:
      E - an exception if the action fails
    • tryCall

      default <T, V, E extends Exception> Optional<V> tryCall(Class<? extends T> clazz, org.apache.flink.util.function.FunctionWithException<T,V,E> action, String debugMessage) throws E
      Tries to run the action if this state is of type clazz.
      Type Parameters:
      T - target type
      V - value type
      E - error type
      Parameters:
      clazz - clazz describes the target type
      action - action to run if this state is of the target type
      debugMessage - debugMessage which is printed if this state is not the target type
      Returns:
      Optional.of(T) the action result if it is successfully executed; otherwise Optional.empty()
      Throws:
      E - an exception if the action fails