gpt4 book ai didi

org.apache.oozie.client.WorkflowAction.getConf()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-27 04:13:05 30 4
gpt4 key购买 nike

本文整理了Java中org.apache.oozie.client.WorkflowAction.getConf()方法的一些代码示例,展示了WorkflowAction.getConf()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkflowAction.getConf()方法的具体详情如下:
包路径:org.apache.oozie.client.WorkflowAction
类名称:WorkflowAction
方法名:getConf

WorkflowAction.getConf介绍

[英]Return the action configuration.
[中]返回操作配置。

代码示例

代码示例来源:origin: apache/oozie

protected boolean getCaptureOutput(WorkflowAction action) throws JDOMException {
  Element eConf = XmlUtils.parseXml(action.getConf());
  Namespace ns = eConf.getNamespace();
  Element captureOutput = eConf.getChild("capture-output", ns);
  return captureOutput != null;
}

代码示例来源:origin: org.apache.oozie/oozie-core

protected boolean getCaptureOutput(WorkflowAction action) throws JDOMException {
  Element eConf = XmlUtils.parseXml(action.getConf());
  Namespace ns = eConf.getNamespace();
  Element captureOutput = eConf.getChild("capture-output", ns);
  return captureOutput != null;
}

代码示例来源:origin: org.apache.oozie/oozie-tools

private void persistResolvedActionDefinition(final WorkflowAction action, final File resolvedActionsDir) throws IOException {
  persistWorkflowDefinition(resolvedActionsDir, action.getName(), action.getConf());
}

代码示例来源:origin: apache/oozie

private Configuration createJobConfFromActionConf(final Context context, final WorkflowAction action)
    throws JDOMException, NoSuchAlgorithmException {
  final Element actionXml = XmlUtils.parseXml(action.getConf());
  final Configuration jobConf = createBaseHadoopConf(context, actionXml);
  final String launcherTag = getActionYarnTag(context, action);
  jobConf.set(CHILD_MAPREDUCE_JOB_TAGS, LauncherHelper.getTag(launcherTag));
  return jobConf;
}

代码示例来源:origin: org.apache.oozie/oozie-core

private Configuration createJobConfFromActionConf(final Context context, final WorkflowAction action)
    throws JDOMException, NoSuchAlgorithmException {
  final Element actionXml = XmlUtils.parseXml(action.getConf());
  final Configuration jobConf = createBaseHadoopConf(context, actionXml);
  final String launcherTag = getActionYarnTag(context, action);
  jobConf.set(CHILD_MAPREDUCE_JOB_TAGS, LauncherHelper.getTag(launcherTag));
  return jobConf;
}

代码示例来源:origin: apache/oozie

LOG.info("Starting action");
try {
  String confStr = action.getConf();
  context.setStartData("-", "-", "-");
  Element conf = XmlUtils.parseXml(confStr);

代码示例来源:origin: org.apache.oozie/oozie-core

LOG.info("Starting action");
try {
  String confStr = action.getConf();
  context.setStartData("-", "-", "-");
  Element conf = XmlUtils.parseXml(confStr);

代码示例来源:origin: apache/oozie

@Override
public void start(Context context, WorkflowAction action) throws ActionExecutorException {
  LOG.info("Starting action");
  try {
    context.setStartData("-", "-", "-");
    Element actionXml = XmlUtils.parseXml(action.getConf());
    validateAndMail(context, actionXml);
    context.setExecutionData("OK", null);
  }
  catch (Exception ex) {
    throw convertException(ex);
  }
}

代码示例来源:origin: org.apache.oozie/oozie-core

@Override
public void start(Context context, WorkflowAction action) throws ActionExecutorException {
  LOG.info("Starting action");
  try {
    context.setStartData("-", "-", "-");
    Element actionXml = XmlUtils.parseXml(action.getConf());
    doOperations(context, actionXml);
    context.setExecutionData("OK", null);
  }
  catch (Exception ex) {
    throw convertException(ex);
  }
}

代码示例来源:origin: apache/oozie

@Override
public void start(Context context, WorkflowAction action) throws ActionExecutorException {
  LOG.info("Starting action");
  try {
    context.setStartData("-", "-", "-");
    Element actionXml = XmlUtils.parseXml(action.getConf());
    doOperations(context, actionXml);
    context.setExecutionData("OK", null);
  }
  catch (Exception ex) {
    throw convertException(ex);
  }
}

代码示例来源:origin: org.apache.oozie/oozie-core

@Override
public void start(Context context, WorkflowAction action) throws ActionExecutorException {
  LOG.info("Starting action");
  try {
    context.setStartData("-", "-", "-");
    Element actionXml = XmlUtils.parseXml(action.getConf());
    validateAndMail(context, actionXml);
    context.setExecutionData("OK", null);
  }
  catch (Exception ex) {
    throw convertException(ex);
  }
}

代码示例来源:origin: apache/oozie

private XConfiguration getJavaActionConfiguration(WorkflowJob workflow) throws Exception {
  final WorkflowAction workflowAction = helper.getJavaAction(workflow);
  final Element element = XmlUtils.parseXml(workflowAction.getConf());
  final String configuration = XmlUtils.prettyPrint(element.getChild("configuration",
      element.getNamespace())).toString();
  return new XConfiguration(new StringReader(configuration));
}

代码示例来源:origin: apache/oozie

public void testProperties() {
  WorkflowAction action = createNode();
  Assert.assertEquals("a", action.getId());
  Assert.assertEquals("b", action.getName());
  Assert.assertEquals("c", action.getType());
  Assert.assertEquals("d", action.getConf());
  Assert.assertEquals(WorkflowAction.Status.RUNNING, action.getStatus());
  Assert.assertEquals(1, action.getRetries());
  Assert.assertEquals(JsonUtils.parseDateRfc822(START_TIME), action.getStartTime());
  Assert.assertEquals(JsonUtils.parseDateRfc822(END_TIME), action.getEndTime());
  Assert.assertEquals("e", action.getTransition());
  Assert.assertEquals("ee", action.getData());
  Assert.assertEquals("stats", action.getStats());
  Assert.assertEquals("extChIDs", action.getExternalChildIDs());
  Assert.assertEquals("f", action.getExternalId());
  Assert.assertEquals("g", action.getExternalStatus());
  Assert.assertEquals("h", action.getTrackerUri());
  Assert.assertEquals("i", action.getConsoleUrl());
  Assert.assertEquals("j", action.getErrorCode());
  Assert.assertEquals("k", action.getErrorMessage());
}

代码示例来源:origin: apache/oozie

public void end(Context context, WorkflowAction action) throws ActionExecutorException {
  Element eConf = getConfiguration(action.getConf());
  Namespace ns = eConf.getNamespace();
  String error = eConf.getChild("error", ns).getText().trim();

代码示例来源:origin: apache/oozie

public void start(Context context, WorkflowAction action) throws ActionExecutorException {
  Element eConf = getConfiguration(action.getConf());
  Namespace ns = eConf.getNamespace();
  String error = eConf.getChild("error", ns).getText().trim();

代码示例来源:origin: org.apache.oozie/oozie-core

@Override
public void kill(Context context, WorkflowAction action) throws ActionExecutorException {
  YarnClient yarnClient = null;
  try {
    Element actionXml = XmlUtils.parseXml(action.getConf());
    final Configuration jobConf = createBaseHadoopConf(context, actionXml);
    String launcherTag = getActionYarnTag(context, action);
    jobConf.set(LauncherMain.CHILD_MAPREDUCE_JOB_TAGS, LauncherHelper.getTag(launcherTag));
    yarnClient = createYarnClient(context, jobConf);
    String appExternalId = action.getExternalId();
    killExternalApp(action, yarnClient, appExternalId);
    killExternalChildApp(action, yarnClient, appExternalId);
    killExternalChildAppByTags(action, yarnClient, jobConf, appExternalId);
    context.setExternalStatus(KILLED);
    context.setExecutionData(KILLED, null);
  } catch (Exception ex) {
    LOG.error("Error when killing YARN application", ex);
    throw convertException(ex);
  } finally {
    try {
      FileSystem actionFs = context.getAppFileSystem();
      cleanUpActionDir(actionFs, context);
      Closeables.closeQuietly(yarnClient);
    } catch (Exception ex) {
      LOG.error("Error when cleaning up action dir", ex);
      throw convertException(ex);
    }
  }
}

代码示例来源:origin: apache/oozie

@Override
public void kill(Context context, WorkflowAction action) throws ActionExecutorException {
  YarnClient yarnClient = null;
  try {
    Element actionXml = XmlUtils.parseXml(action.getConf());
    final Configuration jobConf = createBaseHadoopConf(context, actionXml);
    String launcherTag = getActionYarnTag(context, action);
    jobConf.set(LauncherMain.CHILD_MAPREDUCE_JOB_TAGS, LauncherHelper.getTag(launcherTag));
    yarnClient = createYarnClient(context, jobConf);
    String appExternalId = action.getExternalId();
    killExternalApp(action, yarnClient, appExternalId);
    killExternalChildApp(action, yarnClient, appExternalId);
    killExternalChildAppByTags(action, yarnClient, jobConf, appExternalId);
    context.setExternalStatus(KILLED);
    context.setExecutionData(KILLED, null);
  } catch (Exception ex) {
    LOG.error("Error when killing YARN application", ex);
    throw convertException(ex);
  } finally {
    try {
      FileSystem actionFs = context.getAppFileSystem();
      cleanUpActionDir(actionFs, context);
      Closeables.closeQuietly(yarnClient);
    } catch (Exception ex) {
      LOG.error("Error when cleaning up action dir", ex);
      throw convertException(ex);
    }
  }
}

代码示例来源:origin: apache/oozie

public void testParentGlobalConf() throws Exception {
  try {
    Path subWorkflowAppPath = createSubWorkflowXml();
    String workflowUri = createTestWorkflowXml(subWorkflowAppPath);
    LocalOozie.start();
    final OozieClient wfClient = LocalOozie.getClient();
    final String jobId = submitWorkflow(workflowUri, wfClient);
    waitFor(JOB_TIMEOUT, new Predicate() {
      public boolean evaluate() throws Exception {
        return (wfClient.getJobInfo(jobId).getStatus() == WorkflowJob.Status.SUCCEEDED) &&
            (wfClient.getJobInfo(jobId).getActions().get(1).getStatus() == WorkflowAction.Status.OK);
      }
    });
    WorkflowJob subWorkflow = wfClient.getJobInfo(wfClient.getJobInfo(jobId).
        getActions().get(1).getExternalId());
    Configuration subWorkflowConf = getWorkflowConfig(subWorkflow);
    Element eConf = XmlUtils.parseXml(subWorkflow.getActions().get(1).getConf());
    Element element = eConf.getChild("configuration", eConf.getNamespace());
    Configuration actionConf = new XConfiguration(new StringReader(XmlUtils.prettyPrint(element).toString()));
    assertEquals("foo1", actionConf.get("foo1"));
    assertEquals("subconf", actionConf.get("foo2"));
    assertEquals("foo3", actionConf.get("foo3"));
    // Checking the action conf configuration.
    assertEquals("actionconf", subWorkflowConf.get("foo3"));
  } finally {
    LocalOozie.stop();
  }
}

代码示例来源:origin: apache/oozie

public void testGlobalConfigurationWithActionDefaults() throws Exception {
  try {
    String workflowUri = helper.createTestWorkflowXml(getWorkflowGlobalXml(), helper.getJavaActionXml(""));
    LocalOozie.start();
    final OozieClient wfClient = LocalOozie.getClient();
    Properties conf = wfClient.createConfiguration();
    conf.setProperty(OozieClient.APP_PATH, workflowUri);
    conf.setProperty(OozieClient.USER_NAME, getTestUser());
    conf.setProperty("appName", "var-app-name");
    final String jobId = wfClient.submit(conf);
    wfClient.start(jobId);
    WorkflowJob workflow = wfClient.getJobInfo(jobId);
    waitFor(20 * 1000, new Predicate() {
      @Override
      public boolean evaluate() throws Exception {
        WorkflowAction javaAction = helper.getJavaAction(wfClient.getJobInfo(jobId));
        return javaAction != null && !javaAction.getStatus().equals("PREP");
      }
    });
    final WorkflowAction workflowAction = helper.getJavaAction(workflow);
    Element eConf = XmlUtils.parseXml(workflowAction.getConf());
    Element element = eConf.getChild("configuration", eConf.getNamespace());
    Configuration actionConf = new XConfiguration(new StringReader(XmlUtils.prettyPrint(element).toString()));
    assertEquals("Config value set in <global> section is not propagated correctly",
        "foo2", actionConf.get("action.foo"));
  } finally {
    LocalOozie.stop();
  }
}

代码示例来源:origin: apache/oozie

public void testResourceManagerInGlobalConfigurationCanBeOverridenWithJobTrackerInAction() throws Exception {
  try {
    final String global = "<global>" +
        "<resource-manager>RM</resource-manager>"+
        "</global>";
    final String workflowUri = helper.createTestWorkflowXml(global, helper.getJavaActionXml(""));
    LocalOozie.start();
    final OozieClient wfClient = LocalOozie.getClient();
    final Properties conf = wfClient.createConfiguration();
    conf.setProperty(OozieClient.APP_PATH, workflowUri);
    conf.setProperty(OozieClient.USER_NAME, getTestUser());
    conf.setProperty("appName", "var-app-name");
    final String jobId = wfClient.submit(conf);
    wfClient.start(jobId);
    WorkflowJob workflow = wfClient.getJobInfo(jobId);
    waitFor(20 * 1000, new Predicate() {
      @Override
      public boolean evaluate() throws Exception {
        WorkflowAction javaAction = helper.getJavaAction(wfClient.getJobInfo(jobId));
        return javaAction != null && !javaAction.getStatus().equals("PREP");
      }
    });
    final WorkflowAction workflowAction = helper.getJavaAction(workflow);
    final String actualConfig = workflowAction.getConf();
    final String actualJobTrackerURI = XmlUtils.parseXml(actualConfig).getChildTextNormalize("job-tracker", null);
    assertEquals(getJobTrackerUri(), actualJobTrackerURI);
  } finally {
    LocalOozie.stop();
  }
}

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com