Calling shell script in Oozie: how to use decision node on base of different return values from the script

落爺英雄遲暮 提交于 2019-12-12 02:37:06

问题


I am currently using Oozie to call Shell script. On base of exit value of the called shell script, Oozie can easily choose OK or ERROR node, but what if Shell exits with other values than 0 or 1? can Oozie use the decision node to switch to different nodes on base of the exit value of the called Shell script?

I am thinking about using EL function, but do not know whyc EL function get the exit code of previously called Shell script


回答1:


  1. make sure that the shell exits with non-zero for critical errors (irrecoverable, go to kill) and zero for success or app errors (continue workflow to check status)
  2. make sure that the shell sends nothing to StdOut except your "soft" status code, otherwise you might blast the HashMap at step 4
  3. return your "soft" status report using Java properties syntax e.g. echo "status.rc=0" ; echo "status.message=so far, so good"
  4. set <capture_output/> option in the Shell Action so that Oozie retrieves your status report in a HashMap (key/value)
  5. branch the Workflow to a Decision node, check the value that shows the soft status (using wf:actionData() EL function), and branch accordingly


来源:https://stackoverflow.com/questions/32478911/calling-shell-script-in-oozie-how-to-use-decision-node-on-base-of-different-ret

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!