public class BootstrapTools extends Object
Modifier and Type | Method and Description |
---|---|
static Configuration |
cloneConfiguration(Configuration configuration)
Clones the given configuration and resets instance specific config options.
|
static String |
escapeForDifferentOS(String value)
Escape all the dynamic property values.
|
static String |
escapeWithDoubleQuote(String value) |
static String |
escapeWithSingleQuote(String value) |
static String |
getDynamicPropertiesAsString(Configuration baseConfig,
Configuration targetConfig)
Get dynamic properties based on two Flink configurations.
|
static String |
getStartCommand(String template,
Map<String,String> startCommandValues)
Replaces placeholders in the template start command with values from startCommandValues.
|
static String |
getTaskManagerShellCommand(Configuration flinkConfig,
ContaineredTaskManagerParameters tmParams,
String configDirectory,
String logDirectory,
boolean hasLogback,
boolean hasLog4j,
boolean hasKrb5,
Class<?> mainClass,
String mainArgs)
Generates the shell command to start a task manager.
|
static org.apache.commons.cli.Option |
newDynamicPropertiesOption()
Get an instance of the dynamic properties option.
|
static Configuration |
parseDynamicProperties(org.apache.commons.cli.CommandLine cmd)
Parse the dynamic properties (passed on the command line).
|
static void |
substituteDeprecatedConfigKey(Configuration config,
String deprecated,
String designated)
Sets the value of a new config key to the value of a deprecated config key.
|
static void |
substituteDeprecatedConfigPrefix(Configuration config,
String deprecatedPrefix,
String designatedPrefix)
Sets the value of a new config key to the value of a deprecated config key.
|
static void |
updateTmpDirectoriesInConfiguration(Configuration configuration,
String defaultDirs)
Set temporary configuration directories if necessary.
|
static void |
writeConfiguration(Configuration cfg,
File file)
Writes a Flink YAML config file from a Flink Configuration object.
|
public static void writeConfiguration(Configuration cfg, File file) throws IOException
cfg
- The Flink configfile
- The File to write toIOException
public static void substituteDeprecatedConfigKey(Configuration config, String deprecated, String designated)
config
- Config to writedeprecated
- The old config keydesignated
- The new config keypublic static void substituteDeprecatedConfigPrefix(Configuration config, String deprecatedPrefix, String designatedPrefix)
config
- Config to writedeprecatedPrefix
- Old prefix of keydesignatedPrefix
- New prefix of keypublic static org.apache.commons.cli.Option newDynamicPropertiesOption()
Dynamic properties allow the user to specify additional configuration values with -D, such as -Dfs.overwrite-files=true -Dtaskmanager.memory.network.min=536346624
public static Configuration parseDynamicProperties(org.apache.commons.cli.CommandLine cmd)
public static String getTaskManagerShellCommand(Configuration flinkConfig, ContaineredTaskManagerParameters tmParams, String configDirectory, String logDirectory, boolean hasLogback, boolean hasLog4j, boolean hasKrb5, Class<?> mainClass, String mainArgs)
flinkConfig
- The Flink configuration.tmParams
- Parameters for the task manager.configDirectory
- The configuration directory for the flink-conf.yamllogDirectory
- The log directory.hasLogback
- Uses logback?hasLog4j
- Uses log4j?mainClass
- The main class to start with.public static String getStartCommand(String template, Map<String,String> startCommandValues)
If the default template ConfigConstants.DEFAULT_YARN_CONTAINER_START_COMMAND_TEMPLATE
is used, the following keys
must be present in the map or the resulting command will still contain placeholders:
template
- a template start command with placeholdersstartCommandValues
- a replacement map placeholder -> valuepublic static void updateTmpDirectoriesInConfiguration(Configuration configuration, @Nullable String defaultDirs)
configuration
- flink config to patchdefaultDirs
- in case no tmp directories is set, next directories will be appliedpublic static Configuration cloneConfiguration(Configuration configuration)
configuration
- to clonepublic static String getDynamicPropertiesAsString(Configuration baseConfig, Configuration targetConfig)
baseConfig
- The base configuration.targetConfig
- The target configuration.public static String escapeForDifferentOS(String value)
For Windows OS, each value will be surrounded with double quotes. The double quote itself needs to be escaped with back slash. Also the caret symbol need to be escaped with double carets since Windows uses it to escape characters. See https://en.wikibooks.org/wiki/Windows_Batch_Scripting for more information about Windows escaping.
value
- value to be escapedCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.