List of usage examples for org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher ContainerLaunch CONTAINER_SCRIPT
String CONTAINER_SCRIPT
To view the source code for org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher ContainerLaunch CONTAINER_SCRIPT.
Click Source Link
From source file:oz.hadoop.yarn.test.cluster.InJvmContainerExecutor.java
License:Apache License
/** * Most of this code is copied from the super class's launchContainer method (unfortunately), since directory * and other preparation logic is tightly coupled with the actual container launch. * Would be nice if it was broken apart where launch method would be invoked when * everything is prepared//from w w w . j av a 2s . c o m */ private void prepareContainerDirectories(Container container, Path nmPrivateContainerScriptPath, Path nmPrivateTokensPath, String userName, String appId, Path containerWorkDir, List<String> localDirs, List<String> logDirs) { FsPermission dirPerm = new FsPermission(APPDIR_PERM); ContainerId containerId = container.getContainerId(); String containerIdStr = ConverterUtils.toString(containerId); String appIdStr = ConverterUtils.toString(containerId.getApplicationAttemptId().getApplicationId()); try { for (String sLocalDir : localDirs) { Path usersdir = new Path(sLocalDir, ContainerLocalizer.USERCACHE); Path userdir = new Path(usersdir, userName); Path appCacheDir = new Path(userdir, ContainerLocalizer.APPCACHE); Path appDir = new Path(appCacheDir, appIdStr); Path containerDir = new Path(appDir, containerIdStr); createDir(containerDir, dirPerm, true); } // Create the container log-dirs on all disks this.createLogDirs(appIdStr, containerIdStr, logDirs); Path tmpDir = new Path(containerWorkDir, YarnConfiguration.DEFAULT_CONTAINER_TEMP_DIR); createDir(tmpDir, dirPerm, false); // copy launch script to work dir Path launchDst = new Path(containerWorkDir, ContainerLaunch.CONTAINER_SCRIPT); fc.util().copy(nmPrivateContainerScriptPath, launchDst); // copy container tokens to work dir Path tokenDst = new Path(containerWorkDir, ContainerLaunch.FINAL_CONTAINER_TOKENS_FILE); fc.util().copy(nmPrivateTokensPath, tokenDst); } catch (Exception e) { throw new IllegalStateException("Failed to prepare container directories for container " + container, e); } }