I have to continue the evaluation so I managed to patch a fix to my local
build. In case someone cannot wait here is what I did:

1. In the flink-core's ConfigConstants.java add 

public static final String FLINK_JVM_OPTIONS = "env.java.opts"; <-- existing
public static final String FLINK_CUSTOM_ENV_VARS = "env.custom.env.vars"; 

2. In the flink-conf.yaml now you can add environment variables separated by
"|":

env.custom.env.vars: name1=value1|name2=value2|name3=value3 ....

3. In the flink-yarn's YarnJobManager.scala's createContainerLaunchContext()
method add the following between the two existing lines:

    Utils.setupEnv(yarnConf, containerEnv) <-- existing
    
    val customEnvOpts =
flinkConfiguration.getString(ConfigConstants.FLINK_CUSTOM_ENV_VARS, "")
    
if(customEnvOpts!=null)
{
val variables = customEnvOpts.split("\\|");
if(variables!=null&&variables.length>0)
{
for(variable <- variables)
{
val pair = variable.split("=");
containerEnv.put(pair(0), pair(1));
}
}
}
    containerEnv.put(FlinkYarnClientBase.ENV_CLIENT_USERNAME,
yarnClientUsername) <-- existing

Now the container running my program sees the env variables. 

Note this is temp work around for local personally and should be discarded
once Flink 1.0 comes out.




--
View this message in context: 
http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/passing-environment-variables-to-flink-program-tp3337p3367.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at 
Nabble.com.

Reply via email to