flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabian Hueske <fhue...@gmail.com>
Subject Re: Accessing configuration in RichFunction
Date Wed, 13 Jan 2016 09:52:56 GMT
Hi Christian,

the open method is called by the Flink workers when the parallel tasks are
initialized.
The configuration parameter is the configuration object of the operator.
You can set parameters in the operator config as follows:

DataSet<String> text = ...
DataSet<Tuple2<String, Integer> wc = text.flatMap(new
Tokenizer()).getParameters().setString("myKey", "myVal");

Best, Fabian


2016-01-13 10:29 GMT+01:00 Christian Kreutzfeldt <mnxfst@gmail.com>:

> Hi
>
> While working on a RichFilterFunction implementation I was wondering, if
> there is a much better way to access configuration
> options read from file during startup. Actually, I am
> using getRuntimeContext().getExecutionConfig().getGlobalJobParameters()
> to get access to my settings.
>
> Reason for that is, that the Configuration parameter provided to the open
> function does not carry my settings. That is probably
> the case as I
> use this.executionEnvironment.getConfig().setGlobalJobParameters(cfg) to
> pass my configuration into the environment
> which in turn is not passed on as part of the open call - I found no other
> way to handle configuration ;-)
>
> My question is: who is responsible for calling the open function, where
> does the configuration parameter has its origins aka where
> is its content taken from and is it possible to define somewhere in the
> main program which configuration to pass into a specific operator?
>
> Best
>   Christian
>

Mime
View raw message