Example usage for org.apache.hadoop.yarn.util Apps addToEnvironment

List of usage examples for org.apache.hadoop.yarn.util Apps addToEnvironment

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.util Apps addToEnvironment.

Prototype

@Public
    @Unstable
    public static void addToEnvironment(Map<String, String> environment, String variable, String value,
            String classPathSeparator) 

Source Link

Usage

From source file:alluxio.yarn.Client.java

License:Apache License

private void setupAppMasterEnv(Map<String, String> appMasterEnv) throws IOException {
    String classpath = ApplicationConstants.Environment.CLASSPATH.name();
    for (String path : mYarnConf.getStrings(YarnConfiguration.YARN_APPLICATION_CLASSPATH,
            YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH)) {
        Apps.addToEnvironment(appMasterEnv, classpath, path.trim(), ApplicationConstants.CLASS_PATH_SEPARATOR);
    }//from  w  w w .  j a v a  2s.  c  o  m
    Apps.addToEnvironment(appMasterEnv, classpath, PathUtils.concatPath(Environment.PWD.$(), "*"),
            ApplicationConstants.CLASS_PATH_SEPARATOR);

    appMasterEnv.put("ALLUXIO_HOME", ApplicationConstants.Environment.PWD.$());

    if (UserGroupInformation.isSecurityEnabled()) {
        appMasterEnv.put("ALLUXIO_USER", UserGroupInformation.getCurrentUser().getShortUserName());
    }
}

From source file:com.hazelcast.yarn.HazelcastYarnClient.java

License:Open Source License

private void setEnv(Map<String, String> envs, YarnConfiguration conf) {
    for (String property : conf.getStrings(YarnConfiguration.YARN_APPLICATION_CLASSPATH,
            YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH)) {
        Apps.addToEnvironment(envs, Environment.CLASSPATH.name(), property.trim(), File.pathSeparator);
    }/*from w w w .ja  v  a2 s . com*/

    Apps.addToEnvironment(envs, Environment.CLASSPATH.name(), Environment.PWD.$() + File.separator + "*",
            File.pathSeparator);
}

From source file:org.apache.ignite.yarn.IgniteYarnClient.java

License:Apache License

/**
 * @param envs Environment variables./*ww w  .  j  ava2 s  . com*/
 * @param conf Yarn configuration.
 */
private static void setupAppMasterEnv(Map<String, String> envs, YarnConfiguration conf) {
    for (String c : conf.getStrings(YarnConfiguration.YARN_APPLICATION_CLASSPATH,
            YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH))
        Apps.addToEnvironment(envs, Environment.CLASSPATH.name(), c.trim(), File.pathSeparator);

    Apps.addToEnvironment(envs, Environment.CLASSPATH.name(), Environment.PWD.$() + File.separator + "*",
            File.pathSeparator);
}

From source file:tachyon.yarn.Client.java

License:Apache License

private void setupAppMasterEnv(Map<String, String> appMasterEnv) {
    String classpath = ApplicationConstants.Environment.CLASSPATH.name();
    for (String path : mYarnConf.getStrings(YarnConfiguration.YARN_APPLICATION_CLASSPATH,
            YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH)) {
        Apps.addToEnvironment(appMasterEnv, classpath, path.trim(), ApplicationConstants.CLASS_PATH_SEPARATOR);
    }/*  www.  j  a v  a  2 s  . c  om*/
    Apps.addToEnvironment(appMasterEnv, classpath, PathUtils.concatPath(Environment.PWD.$(), "*"),
            ApplicationConstants.CLASS_PATH_SEPARATOR);
    Apps.addToEnvironment(appMasterEnv, classpath, PathUtils.concatPath(mTachyonHome, "conf") + File.separator,
            ApplicationConstants.CLASS_PATH_SEPARATOR);
    Apps.addToEnvironment(appMasterEnv, classpath, PathUtils.concatPath(mTachyonHome, "bin") + File.separator,
            ApplicationConstants.CLASS_PATH_SEPARATOR);
}

From source file:yarnkit.utils.YarnUtils.java

License:Apache License

public static void configureClasspath(@Nonnull final Map<String, String> env,
        @Nonnull final Configuration conf) {
    for (String c : conf.getStrings(YarnConfiguration.YARN_APPLICATION_CLASSPATH,
            YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH)) {
        Apps.addToEnvironment(env, ApplicationConstants.Environment.CLASSPATH.name(), c.trim(), ":");
    }//from w  ww. j  ava2s.  c o  m
    Apps.addToEnvironment(env, ApplicationConstants.Environment.CLASSPATH.name(),
            ApplicationConstants.Environment.PWD.$() + File.separator + "*", ":");
}

From source file:yrun.YarnRunner.java

License:Apache License

private void setupAppMasterEnv(Map<String, String> appMasterEnv, String appJarFile) {
    String dirSep = File.separator;
    String pathSep = File.pathSeparator;
    for (String c : _configuration.getStrings(YarnConfiguration.YARN_APPLICATION_CLASSPATH,
            YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH)) {
        Apps.addToEnvironment(appMasterEnv, Environment.CLASSPATH.name(), c.trim(), pathSep);
    }/*from w w w.j av a  2s.c om*/
    Apps.addToEnvironment(appMasterEnv, Environment.JAVA_HOME.name(),
            "/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home", pathSep);
    Apps.addToEnvironment(appMasterEnv, Environment.CLASSPATH.name(), Environment.PWD.$() + dirSep + appJarFile,
            pathSep);
    Apps.addToEnvironment(appMasterEnv, Environment.CLASSPATH.name(), Environment.PWD.$() + dirSep + "*",
            pathSep);
}