Esempio n. 1
0
  private RunningJob submitAction(Context context, Namespace ns) throws Exception {
    Hive2ActionExecutor ae = new Hive2ActionExecutor();

    WorkflowAction action = context.getAction();

    ae.prepareActionDir(getFileSystem(), context);
    ae.submitLauncher(getFileSystem(), context, action);

    String jobId = action.getExternalId();
    String jobTracker = action.getTrackerUri();
    String consoleUrl = action.getConsoleUrl();
    assertNotNull(jobId);
    assertNotNull(jobTracker);
    assertNotNull(consoleUrl);
    Element e = XmlUtils.parseXml(action.getConf());
    XConfiguration conf =
        new XConfiguration(
            new StringReader(XmlUtils.prettyPrint(e.getChild("configuration", ns)).toString()));
    conf.set("mapred.job.tracker", e.getChildTextTrim("job-tracker", ns));
    conf.set("fs.default.name", e.getChildTextTrim("name-node", ns));
    conf.set("user.name", context.getProtoActionConf().get("user.name"));
    conf.set("group.name", getTestGroup());

    JobConf jobConf = Services.get().get(HadoopAccessorService.class).createJobConf(jobTracker);
    XConfiguration.copy(conf, jobConf);
    String user = jobConf.get("user.name");
    JobClient jobClient =
        Services.get().get(HadoopAccessorService.class).createJobClient(user, jobConf);
    final RunningJob runningJob = jobClient.getJob(JobID.forName(jobId));
    assertNotNull(runningJob);
    return runningJob;
  }
Esempio n. 2
0
  public static WorkflowJob.Status queryJobStatus(String oozieJobid)
      throws OozieClientException, InterruptedException {
    OozieClient wc = new AuthOozieClient("http://10.25.22.19:8080/oozie", "ldap");
    wc.setHeader("j_username", "V_PA011_HADOOP_CORE");
    wc.setHeader("j_password", "{DES}/+J5e0Ed2/PABTqzeVGQ1g==");

    List<WorkflowAction> walist;
    int wacount = 0;
    while (wacount < 2) {
      walist = wc.getJobInfo(oozieJobid).getActions();
      wacount = walist.size();
      Thread.sleep(20000);
      System.out.println("#######-" + wacount);
      for (WorkflowAction wa : walist) {
        System.out.println("#######" + wa.getName());

        if (wa.getConsoleUrl().contains("jobdetails.jsp?jobid=")) {
          System.out.println("#######" + wa.getConsoleUrl());
        }
      }
    }

    return wc.getJobInfo(oozieJobid).getStatus();
  }