final HadoopArchives har = new HadoopArchives(newConf); int rc = ToolRunner.run(har, args); if (rc != 0) {
checkPaths(conf, srcPaths); int numFiles = 0; long totalSize = 0; writeTopLevelDirs(srcWriter, srcPaths, parentPath); srcWriter.sync(); FileStatus fstatus = fs.getFileStatus(src); FileStatusDir fdir = new FileStatusDir(fstatus, null); recursivels(fs, fdir, allFiles); for (FileStatusDir statDir: allFiles) { FileStatus stat = statDir.getFileStatus(); long len = stat.isDirectory()? 0:stat.getLen(); final Path path = relPathToRoot(stat.getPath(), parentPath); final String[] children; if (stat.isDirectory()) { children = null; append(srcWriter, len, path.toString(), children); srcWriter.sync(); numFiles++;
Path deepest = largestDepth(paths); Path root = new Path(Path.SEPARATOR); for (int i = parentPath.depth(); i < deepest.depth(); i++) { final Path relPath = relPathToRoot(new Path(entry.getKey()), parentPath); if (relPath != null) { final String[] children = new String[entry.getValue().size()]; children[i++] = child; append(srcWriter, 0L, relPath.toString(), children);
printUsage(options, true); return 0; printUsage(options, false); throw new IOException("Archive Name not specified."); if (!checkValidName(archiveName)) { printUsage(options, false); throw new IOException("Invalid name for archives. " + archiveName); printUsage(options, false); throw new IOException("Parent path not specified."); parentPath = parentPath.getFileSystem(getConf()).makeQualified( parentPath); destPath = new Path(args[i]); if (!destPath.isAbsolute()) { destPath = destPath.getFileSystem(getConf()).makeQualified(destPath); Path argPath = new Path(args[i]); if (argPath.isAbsolute()) { printUsage(options, false); throw new IOException("Source path " + argPath + " is not relative to "+ parentPath); printUsage(options, false); throw new IOException("Destination path not specified.");
if (!checkValidName(archiveName)) { System.out.println(usage); throw new IOException("Invalid name for archives. " + archiveName); parentPath= parentPath.getFileSystem(getConf()).makeQualified(parentPath); destPath = new Path(args[i]); if (!destPath.isAbsolute()) { destPath = destPath.getFileSystem(getConf()).makeQualified(destPath); FileSystem fs = p.getFileSystem(getConf()); FileStatus[] statuses = fs.globStatus(p); if (statuses != null) { archive(parentPath, globPaths, archiveName, destPath); } catch(IOException ie) { System.err.println(ie.getLocalizedMessage());
checkPaths(conf, srcPaths); int numFiles = 0; long totalSize = 0; writeTopLevelDirs(srcWriter, srcPaths, parentPath); srcWriter.sync(); FileStatus fstatus = fs.getFileStatus(src); FileStatusDir fdir = new FileStatusDir(fstatus, null); recursivels(fs, fdir, allFiles); for (FileStatusDir statDir: allFiles) { FileStatus stat = statDir.getFileStatus(); long len = stat.isDirectory()? 0:stat.getLen(); final Path path = relPathToRoot(stat.getPath(), parentPath); final String[] children; if (stat.isDirectory()) { children = null; append(srcWriter, len, path.toString(), children); srcWriter.sync(); numFiles++;
Path deepest = largestDepth(paths); Path root = new Path(Path.SEPARATOR); for (int i = parentPath.depth(); i < deepest.depth(); i++) { final Path relPath = relPathToRoot(new Path(entry.getKey()), parentPath); if (relPath != null) { final String[] children = new String[entry.getValue().size()]; children[i++] = child; append(srcWriter, 0L, relPath.toString(), children);
printUsage(options, true); return 0; printUsage(options, false); throw new IOException("Archive Name not specified."); if (!checkValidName(archiveName)) { printUsage(options, false); throw new IOException("Invalid name for archives. " + archiveName); printUsage(options, false); throw new IOException("Parent path not specified."); parentPath = parentPath.getFileSystem(getConf()).makeQualified( parentPath); destPath = new Path(args[i]); if (!destPath.isAbsolute()) { destPath = destPath.getFileSystem(getConf()).makeQualified(destPath); Path argPath = new Path(args[i]); if (argPath.isAbsolute()) { printUsage(options, false); throw new IOException("Source path " + argPath + " is not relative to "+ parentPath); printUsage(options, false); throw new IOException("Destination path not specified.");
jobname = Utilities.abbreviate(jobname, maxJobNameLen - 6); conf.set(MRJobConfig.JOB_NAME, jobname); HadoopArchives har = new HadoopArchives(conf); List<String> args = new ArrayList<String>();
checkPaths(conf, srcPaths); int numFiles = 0; long totalSize = 0; writeTopLevelDirs(srcWriter, srcPaths, parentPath); srcWriter.sync(); FileStatus fstatus = fs.getFileStatus(src); FileStatusDir fdir = new FileStatusDir(fstatus, null); recursivels(fs, fdir, allFiles); for (FileStatusDir statDir: allFiles) { FileStatus stat = statDir.getFileStatus(); long len = stat.isDirectory()? 0:stat.getLen(); final Path path = relPathToRoot(stat.getPath(), parentPath); final String[] children; if (stat.isDirectory()) { children = null; append(srcWriter, len, path.toString(), children); srcWriter.sync(); numFiles++;
Path deepest = largestDepth(paths); Path root = new Path(Path.SEPARATOR); for (int i = parentPath.depth(); i < deepest.depth(); i++) { final Path relPath = relPathToRoot(new Path(entry.getKey()), parentPath); if (relPath != null) { final String[] children = new String[entry.getValue().size()]; children[i++] = child; append(srcWriter, 0L, relPath.toString(), children);
jobname = Utilities.abbreviate(jobname, maxJobNameLen - 6); conf.set(MRJobConfig.JOB_NAME, jobname); HadoopArchives har = new HadoopArchives(conf); List<String> args = new ArrayList<String>();
@Override public int createHadoopArchive(Configuration conf, Path sourceDir, Path destDir, String archiveName) throws Exception { HadoopArchives har = new HadoopArchives(conf); List<String> args = new ArrayList<String>(); args.add("-archiveName"); args.add(archiveName); args.add(sourceDir.toString()); args.add(destDir.toString()); return ToolRunner.run(har, args.toArray(new String[0])); }
@Override public int createHadoopArchive(Configuration conf, Path sourceDir, Path destDir, String archiveName) throws Exception { HadoopArchives har = new HadoopArchives(conf); List<String> args = new ArrayList<String>(); args.add("-archiveName"); args.add(archiveName); args.add("-p"); args.add(sourceDir.toString()); args.add(destDir.toString()); return ToolRunner.run(har, args.toArray(new String[0])); }
@Override public int createHadoopArchive(Configuration conf, Path sourceDir, Path destDir, String archiveName) throws Exception { HadoopArchives har = new HadoopArchives(conf); List<String> args = new ArrayList<String>(); args.add("-archiveName"); args.add(archiveName); args.add(sourceDir.toString()); args.add(destDir.toString()); return ToolRunner.run(har, args.toArray(new String[0])); }
@Override public int createHadoopArchive(Configuration conf, Path sourceDir, Path destDir, String archiveName) throws Exception { HadoopArchives har = new HadoopArchives(conf); List<String> args = new ArrayList<String>(); args.add("-archiveName"); args.add(archiveName); args.add(sourceDir.toString()); args.add(destDir.toString()); return ToolRunner.run(har, args.toArray(new String[0])); }
@Override public int createHadoopArchive(Configuration conf, Path sourceDir, Path destDir, String archiveName) throws Exception { HadoopArchives har = new HadoopArchives(conf); List<String> args = new ArrayList<String>(); args.add("-archiveName"); args.add(archiveName); args.add("-p"); args.add(sourceDir.toString()); args.add(destDir.toString()); return ToolRunner.run(har, args.toArray(new String[0])); }
protected void execute(final String cmd) throws Exception { // JobConf job=new JobConf(conf); HadoopArchives archive = new HadoopArchives(jobConf); String[] args = getCommandAsArgs(cmd, "NAMENODE", namenode); ToolRunner.run(archive, args); } }
public HadoopArchiveLogsRunner(Configuration conf) { setConf(conf); hadoopArchives = new HadoopArchives(conf); }
/** the main functions **/ public static void main(String[] args) { JobConf job = new JobConf(HadoopArchives.class); HadoopArchives harchives = new HadoopArchives(job); int ret = 0; try{ ret = ToolRunner.run(harchives, args); } catch(Exception e) { LOG.debug("Exception in archives ", e); System.err.println(e.getClass().getSimpleName() + " in archives"); final String s = e.getLocalizedMessage(); if (s != null) { System.err.println(s); } else { e.printStackTrace(System.err); } System.exit(1); } System.exit(ret); } }