We have flink-conf.yaml
for local runs in our project. We'd like to be able to run flink locally for testing. Part of our team uses Macs and the other part, PCs. We'd like to set state.checkpoint.dir
to some universally acceptable path, preferably under user's home directory. Question is, is it possible to set it programmatically according to the OS we are running on, and if not, is there a universally valid shortcut for current user's home directory in this setting, like '~' on *NIX?
Asked
Active
Viewed 833 times
2

Yar
- 629
- 6
- 17
1 Answers
5
Here's an example showing how you can set Flink's configuration settings programmatically:
Configuration conf = new Configuration();
conf.setString("state.checkpoints.dir", "file:///tmp/checkpoints");
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(conf);
System.getProperty("os.name")
will tell you on which OS the client is being run, which for local runs should be good enough.
You can also set any of the configuration parameters from the command line, e.g.,
flink run -Dstate.checkpoints.dir="/tmp/checkpoints" foo.jar
Settings in the code take precedence over the command line, which takes precedence over flink-conf.yaml
.

David Anderson
- 39,434
- 4
- 33
- 60