Java Code Examples for org.apache.hadoop.mapreduce.JobSubmissionFiles#getStagingDir()
The following examples show how to use
org.apache.hadoop.mapreduce.JobSubmissionFiles#getStagingDir() .
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: TestExternalCall.java From hadoop with Apache License 2.0 | 6 votes |
/** * test methods run end execute of DistCp class. silple copy file * @throws Exception */ @Test public void testCleanup() throws Exception { Configuration conf = getConf(); Path stagingDir = JobSubmissionFiles.getStagingDir(new Cluster(conf), conf); stagingDir.getFileSystem(conf).mkdirs(stagingDir); Path soure = createFile("tmp.txt"); Path target = createFile("target.txt"); DistCp distcp = new DistCp(conf, null); String[] arg = { soure.toString(), target.toString() }; distcp.run(arg); Assert.assertTrue(fs.exists(target)); }
Example 2
Source File: TestExternalCall.java From hadoop with Apache License 2.0 | 6 votes |
/** * test main method of DistCp. Method should to call System.exit(). * */ @Test public void testCleanupTestViaToolRunner() throws IOException, InterruptedException { Configuration conf = getConf(); Path stagingDir = JobSubmissionFiles.getStagingDir(new Cluster(conf), conf); stagingDir.getFileSystem(conf).mkdirs(stagingDir); Path soure = createFile("tmp.txt"); Path target = createFile("target.txt"); try { String[] arg = {target.toString(),soure.toString()}; DistCp.main(arg); Assert.fail(); } catch (ExitException t) { Assert.assertTrue(fs.exists(target)); Assert.assertEquals(t.status, 0); Assert.assertEquals( stagingDir.getFileSystem(conf).listStatus(stagingDir).length, 0); } }
Example 3
Source File: TestIntegration.java From hadoop with Apache License 2.0 | 6 votes |
@Test(timeout=100000) public void testCleanup() { try { Path sourcePath = new Path("noscheme:///file"); List<Path> sources = new ArrayList<Path>(); sources.add(sourcePath); DistCpOptions options = new DistCpOptions(sources, target); Configuration conf = getConf(); Path stagingDir = JobSubmissionFiles.getStagingDir( new Cluster(conf), conf); stagingDir.getFileSystem(conf).mkdirs(stagingDir); try { new DistCp(conf, options).execute(); } catch (Throwable t) { Assert.assertEquals(stagingDir.getFileSystem(conf). listStatus(stagingDir).length, 0); } } catch (Exception e) { LOG.error("Exception encountered ", e); Assert.fail("testCleanup failed " + e.getMessage()); } }
Example 4
Source File: TestExternalCall.java From big-c with Apache License 2.0 | 6 votes |
/** * test methods run end execute of DistCp class. silple copy file * @throws Exception */ @Test public void testCleanup() throws Exception { Configuration conf = getConf(); Path stagingDir = JobSubmissionFiles.getStagingDir(new Cluster(conf), conf); stagingDir.getFileSystem(conf).mkdirs(stagingDir); Path soure = createFile("tmp.txt"); Path target = createFile("target.txt"); DistCp distcp = new DistCp(conf, null); String[] arg = { soure.toString(), target.toString() }; distcp.run(arg); Assert.assertTrue(fs.exists(target)); }
Example 5
Source File: TestExternalCall.java From big-c with Apache License 2.0 | 6 votes |
/** * test main method of DistCp. Method should to call System.exit(). * */ @Test public void testCleanupTestViaToolRunner() throws IOException, InterruptedException { Configuration conf = getConf(); Path stagingDir = JobSubmissionFiles.getStagingDir(new Cluster(conf), conf); stagingDir.getFileSystem(conf).mkdirs(stagingDir); Path soure = createFile("tmp.txt"); Path target = createFile("target.txt"); try { String[] arg = {target.toString(),soure.toString()}; DistCp.main(arg); Assert.fail(); } catch (ExitException t) { Assert.assertTrue(fs.exists(target)); Assert.assertEquals(t.status, 0); Assert.assertEquals( stagingDir.getFileSystem(conf).listStatus(stagingDir).length, 0); } }
Example 6
Source File: TestIntegration.java From big-c with Apache License 2.0 | 6 votes |
@Test(timeout=100000) public void testCleanup() { try { Path sourcePath = new Path("noscheme:///file"); List<Path> sources = new ArrayList<Path>(); sources.add(sourcePath); DistCpOptions options = new DistCpOptions(sources, target); Configuration conf = getConf(); Path stagingDir = JobSubmissionFiles.getStagingDir( new Cluster(conf), conf); stagingDir.getFileSystem(conf).mkdirs(stagingDir); try { new DistCp(conf, options).execute(); } catch (Throwable t) { Assert.assertEquals(stagingDir.getFileSystem(conf). listStatus(stagingDir).length, 0); } } catch (Exception e) { LOG.error("Exception encountered ", e); Assert.fail("testCleanup failed " + e.getMessage()); } }
Example 7
Source File: S3MapReduceCp.java From circus-train with Apache License 2.0 | 5 votes |
/** * Create a default working folder for the job, under the job staging directory * * @return Returns the working folder information * @throws Exception - EXception if any */ private Path createMetaFolderPath() throws Exception { Configuration configuration = getConf(); Path stagingDir = JobSubmissionFiles.getStagingDir(new Cluster(configuration), configuration); Path metaFolderPath = new Path(stagingDir, PREFIX + String.valueOf(rand.nextInt())); LOG.debug("Meta folder location: {}", metaFolderPath); configuration.set(S3MapReduceCpConstants.CONF_LABEL_META_FOLDER, metaFolderPath.toString()); return metaFolderPath; }
Example 8
Source File: DistCp.java From hadoop with Apache License 2.0 | 5 votes |
/** * Create a default working folder for the job, under the * job staging directory * * @return Returns the working folder information * @throws Exception - EXception if any */ private Path createMetaFolderPath() throws Exception { Configuration configuration = getConf(); Path stagingDir = JobSubmissionFiles.getStagingDir( new Cluster(configuration), configuration); Path metaFolderPath = new Path(stagingDir, PREFIX + String.valueOf(rand.nextInt())); if (LOG.isDebugEnabled()) LOG.debug("Meta folder location: " + metaFolderPath); configuration.set(DistCpConstants.CONF_LABEL_META_FOLDER, metaFolderPath.toString()); return metaFolderPath; }
Example 9
Source File: DistCp.java From big-c with Apache License 2.0 | 5 votes |
/** * Create a default working folder for the job, under the * job staging directory * * @return Returns the working folder information * @throws Exception - EXception if any */ private Path createMetaFolderPath() throws Exception { Configuration configuration = getConf(); Path stagingDir = JobSubmissionFiles.getStagingDir( new Cluster(configuration), configuration); Path metaFolderPath = new Path(stagingDir, PREFIX + String.valueOf(rand.nextInt())); if (LOG.isDebugEnabled()) LOG.debug("Meta folder location: " + metaFolderPath); configuration.set(DistCpConstants.CONF_LABEL_META_FOLDER, metaFolderPath.toString()); return metaFolderPath; }
Example 10
Source File: JobUtil.java From hbase with Apache License 2.0 | 3 votes |
/** * Initializes the staging directory and returns the qualified path. * * @param conf conf system configuration * @return qualified staging directory path * @throws IOException if the ownership on the staging directory is not as expected * @throws InterruptedException if the thread getting the staging directory is interrupted */ public static Path getQualifiedStagingDir(Configuration conf) throws IOException, InterruptedException { Cluster cluster = new Cluster(conf); Path stagingDir = JobSubmissionFiles.getStagingDir(cluster, conf); return cluster.getFileSystem().makeQualified(stagingDir); }
Example 11
Source File: JobUtil.java From hbase with Apache License 2.0 | 2 votes |
/** * Initializes the staging directory and returns the path. * * @param conf system configuration * @return staging directory path * @throws IOException if the ownership on the staging directory is not as expected * @throws InterruptedException if the thread getting the staging directory is interrupted */ public static Path getStagingDir(Configuration conf) throws IOException, InterruptedException { return JobSubmissionFiles.getStagingDir(new Cluster(conf), conf); }