Package org.apache.flink.runtime.util
Class ConfigurationParserUtils
- java.lang.Object
-
- org.apache.flink.runtime.util.ConfigurationParserUtils
-
public class ConfigurationParserUtils extends Object
Utility class to extract related parameters fromConfiguration
and to sanity check them.
-
-
Constructor Summary
Constructors Constructor Description ConfigurationParserUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkConfigParameter(boolean condition, Object parameter, String name, String errorMessage)
Validates a condition for a config parameter and displays a standard exception, if the condition does not hold.static int
getPageSize(Configuration configuration)
Parses the configuration to get the page size and validates the value.static int
getSlot(Configuration configuration)
Parses the configuration to get the number of slots and validates the value.static List<String>
loadAndModifyConfiguration(String[] args, String cmdLineSyntax)
static Configuration
loadCommonConfiguration(String[] args, String cmdLineSyntax)
Generate configuration from only the config file and dynamic properties.static List<String>
migrateLegacyConfigurationToStandardYaml(String[] args, String cmdLineSyntax)
-
-
-
Method Detail
-
getSlot
public static int getSlot(Configuration configuration)
Parses the configuration to get the number of slots and validates the value.- Parameters:
configuration
- configuration object- Returns:
- the number of slots in task manager
-
checkConfigParameter
public static void checkConfigParameter(boolean condition, Object parameter, String name, String errorMessage) throws IllegalConfigurationException
Validates a condition for a config parameter and displays a standard exception, if the condition does not hold.- Parameters:
condition
- The condition that must hold. If the condition is false, an exception is thrown.parameter
- The parameter value. Will be shown in the exception message.name
- The name of the config parameter. Will be shown in the exception message.errorMessage
- The optional custom error message to append to the exception message.- Throws:
IllegalConfigurationException
- if the condition does not hold
-
getPageSize
public static int getPageSize(Configuration configuration)
Parses the configuration to get the page size and validates the value.- Parameters:
configuration
- configuration object- Returns:
- size of memory segment
-
loadCommonConfiguration
public static Configuration loadCommonConfiguration(String[] args, String cmdLineSyntax) throws FlinkParseException
Generate configuration from only the config file and dynamic properties.- Parameters:
args
- the commandline argumentscmdLineSyntax
- the syntax for this application- Returns:
- generated configuration
- Throws:
FlinkParseException
- if the configuration cannot be generated
-
loadAndModifyConfiguration
public static List<String> loadAndModifyConfiguration(String[] args, String cmdLineSyntax) throws FlinkParseException
- Throws:
FlinkParseException
-
migrateLegacyConfigurationToStandardYaml
public static List<String> migrateLegacyConfigurationToStandardYaml(String[] args, String cmdLineSyntax) throws FlinkParseException
- Throws:
FlinkParseException
-
-