Java Code Examples for org.apache.hadoop.yarn.util.Apps#addToEnvironment()
The following examples show how to use
org.apache.hadoop.yarn.util.Apps#addToEnvironment() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: YarnManager.java From Scribengin with GNU Affero General Public License v3.0 | 6 votes |
void setupAppClasspath(boolean miniClusterEnv, Configuration conf, Map<String, String> appMasterEnv) { if(miniClusterEnv) { String cps = System.getProperty("java.class.path") ; String[] cp = cps.split(":") ; for(String selCp : cp) { Apps.addToEnvironment(appMasterEnv, Environment.CLASSPATH.name(), selCp, ":"); } } else { StringBuilder classPathEnv = new StringBuilder(); classPathEnv.append(Environment.CLASSPATH.$()).append(File.pathSeparatorChar); classPathEnv.append("./*"); String[] classpath = conf.getStrings( YarnConfiguration.YARN_APPLICATION_CLASSPATH, YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH ) ; for (String selClasspath : classpath) { classPathEnv.append(File.pathSeparatorChar); classPathEnv.append(selClasspath.trim()); } appMasterEnv.put(Environment.CLASSPATH.name(), classPathEnv.toString()); System.err.println("CLASSPATH: " + classPathEnv); } Apps.addToEnvironment(appMasterEnv, Environment.CLASSPATH.name(), Environment.PWD.$() + File.separator + "*", ":"); }
Example 2
Source File: MRApps.java From hadoop with Apache License 2.0 | 5 votes |
@Public @Unstable public static void addToEnvironment(Map<String, String> environment, String variable, String value, Configuration conf) { String classPathSeparator = conf.getBoolean(MRConfig.MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM, MRConfig.DEFAULT_MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM) ? ApplicationConstants.CLASS_PATH_SEPARATOR : File.pathSeparator; Apps.addToEnvironment(environment, variable, value, classPathSeparator); }
Example 3
Source File: MRApps.java From big-c with Apache License 2.0 | 5 votes |
@Public @Unstable public static void addToEnvironment(Map<String, String> environment, String variable, String value, Configuration conf) { String classPathSeparator = conf.getBoolean(MRConfig.MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM, MRConfig.DEFAULT_MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM) ? ApplicationConstants.CLASS_PATH_SEPARATOR : File.pathSeparator; Apps.addToEnvironment(environment, variable, value, classPathSeparator); }
Example 4
Source File: IgniteYarnClient.java From ignite with Apache License 2.0 | 5 votes |
/** * @param envs Environment variables. * @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); }
Example 5
Source File: Client.java From hadoop-mini-clusters with Apache License 2.0 | 5 votes |
@SuppressWarnings("deprecation") private void setupAppMasterEnv(Map<String, String> appMasterEnv) { for (String c : conf.getStrings( YarnConfiguration.YARN_APPLICATION_CLASSPATH, YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH)) { Apps.addToEnvironment(appMasterEnv, Environment.CLASSPATH.name(), c.trim()); } Apps.addToEnvironment(appMasterEnv, Environment.CLASSPATH.name(), Environment.PWD.$() + File.separator + "*"); }
Example 6
Source File: SolrClient.java From yarn-proto with Apache License 2.0 | 5 votes |
protected void setupAppMasterEnv(CommandLine cli, Map<String, String> appMasterEnv) throws IOException { for (String c : conf.getStrings( YarnConfiguration.YARN_APPLICATION_CLASSPATH, YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH)) { Apps.addToEnvironment(appMasterEnv, Environment.CLASSPATH.name(), c.trim()); } Apps.addToEnvironment(appMasterEnv, Environment.CLASSPATH.name(), Environment.PWD.$() + File.separator + "*"); if (cli.hasOption("extclasspath")) { String extclasspathArg = cli.getOptionValue("extclasspath"); File extclasspathFile = new File(extclasspathArg); StringBuilder sb = new StringBuilder(); BufferedReader reader = null; String line = null; try { reader = new BufferedReader( new InputStreamReader(new FileInputStream(extclasspathFile), Charset.forName("UTF-8"))); while ((line = reader.readLine()) != null) sb.append(line.trim()).append(":"); } finally { if (reader != null) { reader.close(); } } for (String part : sb.toString().split(":")) { if (part.length() > 0) Apps.addToEnvironment(appMasterEnv, Environment.CLASSPATH.name(), part); } } }
Example 7
Source File: Utils.java From stratosphere with Apache License 2.0 | 4 votes |
public static void setupEnv(Configuration conf, Map<String, String> appMasterEnv) { for (String c : conf.getStrings(YarnConfiguration.YARN_APPLICATION_CLASSPATH,YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH)) { Apps.addToEnvironment(appMasterEnv, Environment.CLASSPATH.name(), c.trim()); } Apps.addToEnvironment(appMasterEnv, Environment.CLASSPATH.name(), Environment.PWD.$() + File.separator + "*"); }