LoadApplicationService

LoadApplicationService

本文介绍了如何检查LoadApplicationService的完成状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在工作流程中有2个动作节点:javaMainActionjavaMainAction2.

I have 2 action nodes in workflow : javaMainAction and javaMainAction2.

我的LoadApplicationService方法执行后返回SUCCESS或FAILURE.

My LoadApplicationService method returns SUCCESS or FAILURE after execution.

如何检查是否返回SUCCESS的响应?

How to check response if SUCCESS is returned?

workflow.xml:

workflow.xml :

<workflow-app name="WorkflowJavaMainAction" xmlns="uri:oozie:workflow:0.1">
    <start to="javaMainAction" />
    <action name="javaMainAction">
        <java>
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <configuration>
                <property>
                    <name>mapred.job.queue.name</name>
                    <value>${queueName}</value>
                </property>
            </configuration>
            <main-class>in.augmentiq.maxiq.dataschedular.services.LoadApplicationService</main-class>
            <arg>${workflowAppPath}/javaMainActionInput/schedule_config.properties</arg>
            <arg>${workflowAppPath}/javaMainActionInput/appRequestParams.json</arg>
            <capture-output/>
        </java>
        <ok to="javaMainAction2" />
        <error to="killJobAction" />
    </action>
    <action name="javaMainAction2">
        <java>
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <configuration>
                <property>
                    <name>mapred.job.queue.name</name>
                    <value>${queueName}</value>
                </property>
            </configuration>
            <main-class>in.augmentiq.maxiq.dataschedular.services.LoadApplicationService</main-class>
            <arg>${workflowAppPath}/javaMainAction2Input/schedule_config.properties</arg>
            <arg>${workflowAppPath}/javaMainAction2Input/appRequestParams.json</arg>
            <capture-output/>
        </java>
        <ok to="end" />
        <error to="killJobAction" />
    </action>
    <kill name="killJobAction">
        <message>"Killed job due to error: ${wf:errorMessage(wf:lastErrorNode())}"</message>
    </kill>
    <end name="end" />
</workflow-app>

推荐答案

LoadApplicationService需要将输出写入key=pair格式,例如response=SUCCESS.您可以检查输出,如下所示:

LoadApplicationService needs to write the output into a key=pair format e.g. response=SUCCESS. The you can inspect the output like this:

${wf:actionData("action-name")["key"]}

使用决策控制"节点比较并做出决策 Decision_Control_Node .

Use Decision control node for comparing and taking decision Decision_Control_Node.

main()方法将属性文件写入oozie.action.output.properties ENVIRONMENT变量中指定的路径. 参考

The main() method writes a Property file to the path specified in the oozie.action.output.properties ENVIRONMENT variable. Reference

   public static void main (String[] args)
   {
      String fileName = args[0];
      try{
         File file = new File(System.getProperty("oozie.action.output.properties"));
         Properties props = new Properties();
         props.setProperty("PASS_ME", "123456");

         OutputStream os = new FileOutputStream(file);
         props.store(os, "");
         os.close();
         System.out.println(file.getAbsolutePath());
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   }

这篇关于如何检查LoadApplicationService的完成状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 06:55