You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Jian Jiang <ja...@equifax.com> on 2015/12/06 15:45:21 UTC

RE: [IE] Re: [IE] Re: passing environment variables to flink program

Thanks Robert –

I will update you when get time.

jackie
From: rmetzger0 [via Apache Flink User Mailing List archive.] [mailto:ml-node+s2336050n3935h57@n4.nabble.com]
Sent: Saturday, December 05, 2015 9:12 AM
To: Jian Jiang
Subject: [IE] Re: [IE] Re: passing environment variables to flink program

Just a little note, the feature requested in FLINK-2954<https://issues.apache.org/jira/browse/FLINK-2954> has been implemented and is available in 1.0-SNAPSHOT now.

Please let me know if its working as expected.

On Wed, Nov 4, 2015 at 6:35 PM, Jian Jiang <[hidden email]</user/SendEmail.jtp?type=node&node=3935&i=0>> wrote:
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.


________________________________
If you reply to this email, your message will be added to the discussion below:
http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/passing-environment-variables-to-flink-program-tp3337p3935.html
To unsubscribe from passing environment variables to flink program, click here<http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3337&code=amFja2llLmppYW5nQGVxdWlmYXguY29tfDMzMzd8LTExNDA0ODY5NzI=>.
NAML<http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
This message contains proprietary information from Equifax which may be confidential. If you are not an intended recipient, please refrain from any disclosure, copying, distribution or use of this information and note that such actions are prohibited. If you have received this transmission in error, please notify by e-mail postmaster@equifax.com. Equifax® is a registered trademark of Equifax Inc. All rights reserved.




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