Exemplo n.º 1
0
  @Override
  public void run(String... args) throws IOException {
    TachyonLineage tl = TachyonLineage.get();
    // TODO(yupeng) more validation
    List<TachyonURI> inputFiles = Lists.newArrayList();
    if (!args[0].equals("noInput")) {
      for (String path : args[0].split(",")) {
        inputFiles.add(new TachyonURI(path));
      }
    }
    List<TachyonURI> outputFiles = Lists.newArrayList();
    for (String path : args[1].split(",")) {
      outputFiles.add(new TachyonURI(path));
    }
    String cmd = "";
    for (int i = 2; i < args.length; i++) {
      cmd += args[i] + " ";
    }

    String outputPath = ClientContext.getConf().get(Constants.MASTER_LINEAGE_RECOMPUTE_LOG_PATH);
    if (outputPath == null) {
      throw new IOException("recompute output log is not configured");
    }
    CommandLineJob job = new CommandLineJob(cmd, new JobConf(outputPath));
    long lineageId;
    try {
      lineageId = tl.createLineage(inputFiles, outputFiles, job);
    } catch (TachyonException e) {
      throw new IOException(e.getMessage());
    }
    System.out.println("Lineage " + lineageId + " has been created.");
  }
Exemplo n.º 2
0
 private int listLineages() throws IOException {
   TachyonLineage tl = TachyonLineage.get();
   List<LineageInfo> infos = tl.getLineageInfoList();
   for (LineageInfo info : infos) {
     System.out.println(info);
   }
   return 0;
 }
Exemplo n.º 3
0
 private int deleteLineage(String[] argv) throws IOException {
   TachyonLineage tl = TachyonLineage.get();
   long lineageId = Long.parseLong(argv[1]);
   boolean cascade = Boolean.parseBoolean(argv[2]);
   DeleteLineageOptions options =
       new DeleteLineageOptions.Builder(new TachyonConf()).setCascade(cascade).build();
   try {
     tl.deleteLineage(lineageId, options);
   } catch (Exception e) {
     e.printStackTrace();
     System.out.println("Lineage '" + lineageId + "' could not be deleted.");
   }
   System.out.println("Lineage " + lineageId + " has been deleted.");
   return 0;
 }