@Override
  public int run(String[] args) throws Exception {
    CommandLine cmd = getCommand(args);
    DistCpOptions options = getDistCpOptions(cmd);

    Configuration conf = this.getConf();
    // inject wf configs
    Path confPath = new Path("file:///" + System.getProperty("oozie.action.conf.xml"));

    LOG.info(confPath + " found conf ? " + confPath.getFileSystem(conf).exists(confPath));
    conf.addResource(confPath);

    String falconFeedStorageType = cmd.getOptionValue("falconFeedStorageType").trim();
    Storage.TYPE feedStorageType = Storage.TYPE.valueOf(falconFeedStorageType);

    DistCp distCp =
        (feedStorageType == Storage.TYPE.FILESYSTEM)
            ? new CustomReplicator(conf, options)
            : new DistCp(conf, options);
    LOG.info("Started DistCp");
    distCp.execute();

    if (feedStorageType == Storage.TYPE.FILESYSTEM) {
      executePostProcessing(options); // this only applies for FileSystem Storage.
    }

    LOG.info("Completed DistCp");
    return 0;
  }
Пример #2
0
 private static void invokeCopy(Configuration config, String[] parsedArgs) {
   try {
     log.info(
         "Running DistCp with arguments ["
             + StringUtils.arrayToCommaDelimitedString(parsedArgs)
             + "]");
     DistCpOptions inputOptions = OptionsParser.parse(parsedArgs);
     org.apache.hadoop.tools.DistCp distCp =
         new org.apache.hadoop.tools.DistCp(config, inputOptions);
     distCp.execute();
   } catch (Exception e) {
     throw new HadoopException("Error running DistCp job", e);
   }
 }