List of usage examples for org.apache.hadoop.yarn.api.records ContainerLaunchContext getEnvironment
@Public @Stable public abstract Map<String, String> getEnvironment();
From source file:oz.hadoop.yarn.api.core.YayaUtils.java
License:Apache License
/** * * @param containerType/* w ww .j a va 2s.co m*/ * @param containerLaunchContext * @param containerLauncherName * @param containerArguments */ public static void inJvmPrep(String containerType, ContainerLaunchContext containerLaunchContext, String containerLauncherName, String containerArguments) { Map<String, String> environment = containerLaunchContext.getEnvironment(); environment.put(YayaConstants.CONTAINER_TYPE, "JAVA"); environment.put(YayaConstants.CONTAINER_LAUNCHER, containerLauncherName); environment.put(YayaConstants.CONTAINER_ARG, containerArguments); }
From source file:oz.hadoop.yarn.api.core.YayaUtilsTests.java
License:Apache License
@Test public void validateInJvmPrepForJava() { ContainerLaunchContext containerLaunchContext = Records.newRecord(ContainerLaunchContext.class); YayaUtils.inJvmPrep("JAVA", containerLaunchContext, "mylauncher", "bar baz"); assertEquals("JAVA", containerLaunchContext.getEnvironment().get(YayaConstants.CONTAINER_TYPE)); assertEquals("mylauncher", containerLaunchContext.getEnvironment().get(YayaConstants.CONTAINER_LAUNCHER)); assertEquals("bar baz", containerLaunchContext.getEnvironment().get(YayaConstants.CONTAINER_ARG)); }
From source file:tachyon.yarn.ApplicationMasterTest.java
License:Apache License
/** * @param expectedContext the context to test for matching * @return an argument matcher which tests for matching the given container launch context *//* w ww. jav a2 s .com*/ private ArgumentMatcher<ContainerLaunchContext> getContextMatcher( final ContainerLaunchContext expectedContext) { return new ArgumentMatcher<ContainerLaunchContext>() { public boolean matches(Object arg) { if (!(arg instanceof ContainerLaunchContext)) { return false; } ContainerLaunchContext ctx = (ContainerLaunchContext) arg; return ctx.getLocalResources().equals(expectedContext.getLocalResources()) && ctx.getCommands().equals(expectedContext.getCommands()) && ctx.getEnvironment().equals(expectedContext.getEnvironment()); } }; }
From source file:yarnkit.container.ContainerLaunchContextFactory.java
License:Apache License
public ContainerLaunchContext duplicate(@CheckForNull ContainerLaunchContext original) { Preconditions.checkNotNull(original, "ContainerLaunchContext should not be null"); ContainerLaunchContext copy = Records.newRecord(ContainerLaunchContext.class); copy.setCommands(original.getCommands()); copy.setEnvironment(original.getEnvironment()); copy.setLocalResources(original.getLocalResources()); ByteBuffer token = original.getTokens(); if (token != null) { copy.setTokens(token.duplicate()); }/*from ww w . ja v a 2 s. c o m*/ return copy; }