Package org.apache.flink.client
Enum ClientUtils
- java.lang.Object
-
- java.lang.Enum<ClientUtils>
-
- org.apache.flink.client.ClientUtils
-
- All Implemented Interfaces:
Serializable,Comparable<ClientUtils>
public enum ClientUtils extends Enum<ClientUtils>
Utility functions for Flink client.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static URLClassLoaderbuildUserCodeClassLoader(List<URL> jars, List<URL> classpaths, ClassLoader parent, org.apache.flink.configuration.Configuration configuration)static voidexecuteProgram(org.apache.flink.core.execution.PipelineExecutorServiceLoader executorServiceLoader, org.apache.flink.configuration.Configuration configuration, PackagedProgram program, boolean enforceSingleJobExecution, boolean suppressSysout)static Collection<org.apache.flink.runtime.rest.HttpHeader>readHeadersFromEnvironmentVariable(String envVarName)static ScheduledExecutorServicereportHeartbeatPeriodically(org.apache.flink.core.execution.JobClient jobClient, long interval, long timeout)The client reports the heartbeat to the dispatcher for aliveness.static ClientUtilsvalueOf(String name)Returns the enum constant of this type with the specified name.static ClientUtils[]values()Returns an array containing the constants of this enum type, in the order they are declared.static voidwaitUntilJobInitializationFinished(org.apache.flink.util.function.SupplierWithException<org.apache.flink.api.common.JobStatus,Exception> jobStatusSupplier, org.apache.flink.util.function.SupplierWithException<org.apache.flink.runtime.jobmaster.JobResult,Exception> jobResultSupplier, ClassLoader userCodeClassloader)This method blocks until the job status is not INITIALIZING anymore.
-
-
-
Method Detail
-
values
public static ClientUtils[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ClientUtils c : ClientUtils.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ClientUtils valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
buildUserCodeClassLoader
public static URLClassLoader buildUserCodeClassLoader(List<URL> jars, List<URL> classpaths, ClassLoader parent, org.apache.flink.configuration.Configuration configuration)
-
executeProgram
public static void executeProgram(org.apache.flink.core.execution.PipelineExecutorServiceLoader executorServiceLoader, org.apache.flink.configuration.Configuration configuration, PackagedProgram program, boolean enforceSingleJobExecution, boolean suppressSysout) throws ProgramInvocationException- Throws:
ProgramInvocationException
-
waitUntilJobInitializationFinished
public static void waitUntilJobInitializationFinished(org.apache.flink.util.function.SupplierWithException<org.apache.flink.api.common.JobStatus,Exception> jobStatusSupplier, org.apache.flink.util.function.SupplierWithException<org.apache.flink.runtime.jobmaster.JobResult,Exception> jobResultSupplier, ClassLoader userCodeClassloader) throws org.apache.flink.runtime.client.JobInitializationException
This method blocks until the job status is not INITIALIZING anymore.- Parameters:
jobStatusSupplier- supplier returning the job status.jobResultSupplier- supplier returning the job result. This will only be called if the job reaches the FAILED state.- Throws:
org.apache.flink.runtime.client.JobInitializationException- If the initialization failed
-
reportHeartbeatPeriodically
public static ScheduledExecutorService reportHeartbeatPeriodically(org.apache.flink.core.execution.JobClient jobClient, long interval, long timeout)
The client reports the heartbeat to the dispatcher for aliveness.- Parameters:
jobClient- The job client.interval- The heartbeat interval.timeout- The heartbeat timeout.- Returns:
- The ScheduledExecutorService which reports heartbeat periodically.
-
readHeadersFromEnvironmentVariable
public static Collection<org.apache.flink.runtime.rest.HttpHeader> readHeadersFromEnvironmentVariable(String envVarName)
-
-