Class ClusterEntrypointUtils

java.lang.Object
org.apache.flink.runtime.entrypoint.ClusterEntrypointUtils

public final class ClusterEntrypointUtils extends Object
Utility class for ClusterEntrypoint.
  • Field Details

    • LOG

      protected static final org.slf4j.Logger LOG
  • Method Details

    • parseParametersOrExit

      public static <T> T parseParametersOrExit(String[] args, ParserResultFactory<T> parserResultFactory, Class<?> mainClass)
      Parses passed String array using the parameter definitions of the passed ParserResultFactory. The method will call System.exit and print the usage information to stdout in case of a parsing error.
      Type Parameters:
      T - The parsing result type.
      Parameters:
      args - The String array that shall be parsed.
      parserResultFactory - The ParserResultFactory that collects the parameter parsing instructions.
      mainClass - The main class initiating the parameter parsing.
      Returns:
      The parsing result.
    • tryFindUserLibDirectory

      public static Optional<File> tryFindUserLibDirectory()
      Tries to find the user library directory.
      Returns:
      the user library directory if it exits, returns Optional.empty() if there is none
    • getPoolSize

      public static int getPoolSize(org.apache.flink.configuration.Configuration config)
      Gets and verify the io-executor pool size based on configuration.
      Parameters:
      config - The configuration to read.
      Returns:
      The legal io-executor pool size.
    • configureUncaughtExceptionHandler

      public static void configureUncaughtExceptionHandler(org.apache.flink.configuration.Configuration config)
      Sets the uncaught exception handler for current thread based on configuration.
      Parameters:
      config - the configuration to read.
    • createTaskManagerWorkingDirectory

      public static DeterminismEnvelope<WorkingDirectory> createTaskManagerWorkingDirectory(org.apache.flink.configuration.Configuration configuration, DeterminismEnvelope<ResourceID> envelopedResourceId) throws IOException
      Creates the working directory for the TaskManager process. This method ensures that the working directory exists.
      Parameters:
      configuration - to extract the required settings from
      envelopedResourceId - identifying the TaskManager process
      Returns:
      working directory
      Throws:
      IOException - if the working directory could not be created
    • generateTaskManagerWorkingDirectoryFile

      @VisibleForTesting public static File generateTaskManagerWorkingDirectoryFile(org.apache.flink.configuration.Configuration configuration, ResourceID resourceId)
      Generates the working directory File for the TaskManager process. This method does not ensure that the working directory exists.
      Parameters:
      configuration - to extract the required settings from
      resourceId - identifying the TaskManager process
      Returns:
      working directory file
    • generateJobManagerWorkingDirectoryFile

      @VisibleForTesting public static File generateJobManagerWorkingDirectoryFile(org.apache.flink.configuration.Configuration configuration, ResourceID resourceId)
      Generates the working directory File for the JobManager process. This method does not ensure that the working directory exists.
      Parameters:
      configuration - to extract the required settings from
      resourceId - identifying the JobManager process
      Returns:
      working directory file
    • generateWorkingDirectoryFile

      public static File generateWorkingDirectoryFile(org.apache.flink.configuration.Configuration configuration, Optional<org.apache.flink.configuration.ConfigOption<String>> workingDirOption, String workingDirectoryName)
      Generate the working directory from the given configuration. If a working dir option is specified, then this config option will be read first. At last, CoreOptions.TMP_DIRS will be used to extract the working directory base from.
      Parameters:
      configuration - to extract the working directory from
      workingDirOption - optional working dir option
      workingDirectoryName - name of the working directory to create
      Returns:
      working directory
    • createJobManagerWorkingDirectory

      public static DeterminismEnvelope<WorkingDirectory> createJobManagerWorkingDirectory(org.apache.flink.configuration.Configuration configuration, DeterminismEnvelope<ResourceID> envelopedResourceId) throws IOException
      Creates the working directory for the JobManager process. This method ensures that the working diretory exists.
      Parameters:
      configuration - to extract the required settings from
      envelopedResourceId - identifying the TaskManager process
      Returns:
      working directory
      Throws:
      IOException - if the working directory could not be created