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 theExecutionGraph
. If the creation fails, then the state transitions toFinished
. If the creation succeeds, then the system tries to assign the required slots. If the set of available slots has changed so that the createdExecutionGraph
cannot be executed, the state transitions back intoWaitingForResources
. If there are enough slots for theExecutionGraph
to run, the state transitions toExecuting
.
-
-
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
All Methods Instance Methods Concrete Methods Default Methods 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
cancel()
ArchivedExecutionGraph
getJob()
JobID
getJobId()
JobStatus
getJobStatus()
org.slf4j.Logger
getLogger()
void
handleGlobalFailure(Throwable cause, CompletableFuture<Map<String,String>> failureLabels)
An adapted version ofGlobalFailureHandler
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
suspend(Throwable cause)
default <T,V,E extends Exception>
Optional<V>tryCall(Class<? extends T> clazz, FunctionWithException<T,V,E> action, String debugMessage)
Tries to run the action if this state is of type clazz.default <T,E extends Exception>
voidtryRun(Class<? extends T> clazz, ThrowingConsumer<T,E> action, String debugMessage)
Tries to run the action if this state is of type clazz.default <T,E extends Exception>
voidtryRun(Class<? extends T> clazz, ThrowingConsumer<T,E> action, Consumer<org.slf4j.Logger> invalidStateCallback)
Tries to run the action if this state is of type clazz.
-
-
-
Constructor Detail
-
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 Detail
-
getJobStatus
public JobStatus getJobStatus()
-
cancel
public void cancel()
-
suspend
public void suspend(Throwable cause)
-
getJobId
public 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 ofGlobalFailureHandler
that handles and associates global failures with enricher labels.- Specified by:
handleGlobalFailure
in interfaceLabeledGlobalFailureHandler
- 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
public 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
public 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; otherwiseOptional.empty()
-
tryRun
public default <T,E extends Exception> void tryRun(Class<? extends T> clazz, ThrowingConsumer<T,E> action, String debugMessage) throws E extends Exception
Tries to run the action if this state is of type clazz.- Type Parameters:
T
- target typeE
- error type- Parameters:
clazz
- clazz describes the target typeaction
- action to run if this state is of the target typedebugMessage
- debugMessage which is printed if this state is not the target type- Throws:
E
- an exception if the action failsE extends Exception
-
tryRun
public default <T,E extends Exception> void tryRun(Class<? extends T> clazz, ThrowingConsumer<T,E> action, Consumer<org.slf4j.Logger> invalidStateCallback) throws E extends Exception
Tries to run the action if this state is of type clazz.- Type Parameters:
T
- target typeE
- error type- Parameters:
clazz
- clazz describes the target typeaction
- action to run if this state is of the target typeinvalidStateCallback
- that is called if the state isn't matching the expected one.- Throws:
E
- an exception if the action failsE extends Exception
-
tryCall
public default <T,V,E extends Exception> Optional<V> tryCall(Class<? extends T> clazz, FunctionWithException<T,V,E> action, String debugMessage) throws E extends Exception
Tries to run the action if this state is of type clazz.- Type Parameters:
T
- target typeV
- value typeE
- error type- Parameters:
clazz
- clazz describes the target typeaction
- action to run if this state is of the target typedebugMessage
- debugMessage which is printed if this state is not the target type- Returns:
Optional.of(T)
the action result if it is successfully executed; otherwiseOptional.empty()
- Throws:
E
- an exception if the action failsE extends Exception
-
-