【发布时间】:2017-04-25 18:33:17
【问题描述】:
我在oozie 中有一个工作流程。在此工作流程中,我想将表名作为参数传递。表名存在于文件tables.txt
我想将tables.txt 中的表名传递给工作流。
<workflow-app name="Shell_test" xmlns="uri:oozie:workflow:0.5">
<start to="shell-8f63"/>
<kill name="Kill">
<message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<action name="test_shell">
<shell xmlns="uri:oozie:shell-action:0.1">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<exec>shell.sh</exec>
<argument>${table}</argument>
<env-var>HADOOP_USER_NAME=${wf:user()}</env-var>
<file>/user/oozie/lib/test_shell.sh#shell.sh</file>
<file>/user/oozie/input/tables.txt#tables.txt</file>
</shell>
<ok to="End"/>
<error to="email-error"/>
</action>
<action name="email-error">
<email xmlns="uri:oozie:email-action:0.2">
<to>xxxxxxxxxx.com</to>
<subject>Status of workflow ${table}</subject>
<body>The workflow ${table} ${wf:id()} had issues and was killed. The error message is: ${wf:errorMessage(wf:lastErrorNode())}</body>
<content_type>text/plain</content_type>
</email>
<ok to="end"/>
<error to="end"/>
</action>
<end name="End"/>
</workflow-app>
我能够在工作流程中使用以下内容来做到这一点。
<argument>${input_file}</argument>
<env-var>HADOOP_USER_NAME=${wf:user()}</env-var>
<file>/user/oozie/lib/test_shell.sh#shell.sh</file>
<file>/user/oozie/input/${input_file}#${input_file}</file>
现在我有一个问题。
说如果input_file 中的一个表的工作流失败,那么我不会收到任何电子邮件。仅当 input_file 中最后一个表的工作流失败时,我才会收到电子邮件。
为什么会发生这种情况?每次工作流失败时我如何才能收到一封电子邮件?
还是我做错了整个过程。
谁能解释并纠正我在哪里做错了。
我的test_shell.sh
while read line ;do
spark-submit --name "SparkJob" --master "yarn-client" test.py $line
done < tables.txt
【问题讨论】:
标签: hadoop hdfs oozie oozie-coordinator