Dear Wiki user, You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.
The "WritingYarnApps" page has been changed by ChrisRiccomini: http://wiki.apache.org/hadoop/WritingYarnApps?action=diff&rev1=8&rev2=9 You can use the LocalResource to add resources to your application request. This will cause YARN to distribute the resource to the application master node, and all of the the container nodes. If the resource is a tgz, zip, or jar, you can have YARN unzip it. Then, all you need to do is add the unzipped folder to your classpath. For example, when creating your application request: {{{ - val packageFile = new File(packagePath); + File packageFile = new File(packagePath); - val packageUrl = ConverterUtils.getYarnUrlFromPath(FileContext.getFileContext.makeQualified(new Path(packagePath))); + Url packageUrl = ConverterUtils.getYarnUrlFromPath(FileContext.getFileContext.makeQualified(new Path(packagePath))); packageResource.setResource(packageUrl); packageResource.setSize(packageFile.length()); @@ -35, +35 @@ resource.setMemory(memory) containerCtx.setResource(resource) - containerCtx.setCommands(ImmutableList.of(new ApplicationMasterExecutor(packagePath) + containerCtx.setCommands(ImmutableList.of( - .addCommand("java -cp './package/*' some.class.to.Run " + "java -cp './package/*' some.class.to.Run " + "1>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/stdout " - + "2>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/stderr") + + "2>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/stderr")) - .execute(new Configuration)) containerCtx.setLocalResources(Collections.singletonMap("package", packageResource)) appCtx.setApplicationId(appId) appCtx.setUser(user.getShortUserName)
