Hue Oozie Editor 调度 shell

1. prepare shell case
$ hdfs dfs -cat oozie/apps/hue/hello_hue.sh

#!/bin/sh

echo "my_output=Hello Mushishi"

2. create shell workflow
1) enter oozie editor
2) assign app name as "shell"
3) add a description (if need)
4) drag and drop a shell action node to an acvtive area
5) select and fill script name into "shell command" field, click "Add", then add the script to "FILES"
6) click Save button on top right corner
7) click Submit button nearby
Then hello_hue.sh is running,  after it done, you can check workflow / job log from panel

hue_oozie_shell

3. add fork to workflow
1) open workflow "shell" from "My documents"
2) click "Edit"
3) change app name to "shell-fork"
4) drag and drop a Kill action node under shell action node, add error message if needs
5) drag and drop another Kill action node to the right of the previous Kill node
6) then a fork node pops up, convert it to Decision node
7) fill and modify conditions as needs, ensure all node name are proper and "capture output" is opened
8) remove useless node if any
9) save and submit "shell-fork" workflow
Then you can verify result via workflow / job log, or see job DAG graph directly on oozie console

hue_oozie_shell_fork

btw,  workflow xml created by hue looks like this:

<workflow-app name="shell-fork" xmlns="uri:oozie:workflow:0.5">
    <start to="shell-50ec"/>
    <kill name="Kill">
        <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <action name="shell-50ec">
        <shell xmlns="uri:oozie:shell-action:0.1">
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <exec>/user/sun_xo/oozie/apps/hue/hello_hue.sh</exec>
            <file>/user/sun_xo/oozie/apps/hue/hello_hue.sh#hello_hue.sh</file>
              <capture-output/>
        </shell>
        <ok to="decision-8c70"/>
        <error to="Kill"/>
    </action>
    <kill name="kill-21d4">
        <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <decision name="decision-8c70">
        <switch>
            <case to="End">
              ${wf:actionData('shell-50ec')['my_output'] eq 'Hello Mushishi'}
            </case>
            <default to="kill-21d4"/>
        </switch>
    </decision>
    <end name="End"/>
</workflow-app>

reference Hue Guide > User > Scheduler

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值