Oozie shell script action
2016-09-05 18:23
465 查看
本文为在实际操作中,使用oozie做任务调度,并在action中调用Python脚本。
workflow.xml的配置如下:
<workflow-app xmlns="uri:oozie:workflow:0.4" name="full-demo">
<start to="python-node"/>
<!-- Python action -->
<action name="python-node">
<shell xmlns="uri:oozie:shell-action:0.2">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
</configuration>
<exec>test.py</exec>
<file><span style="font-family: Arial, Helvetica, sans-serif;">test.py</span><span style="font-family: Arial, Helvetica, sans-serif;"></file></span>
</shell>
<ok to="send-email"/>
<error to="fail"/>
</action>
<action name="send-email">
<email xmlns="uri:oozie:email-action:0.1">
<to>xxx@xx.com</to>
<cc>xxx@qq.com</cc>
<subject>Email notifications for ${wf:id()}</subject>
<body>The wf ${wf:id()} successfully completed.</body>
</email>
<ok to="end"/>
<error to="fail"/>
</action>
<kill name="fail">
<message>Python action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end"/>
</workflow-app>job.properties文件配置如下:
nameNode=hdfs://test:8020
jobTracker=test:8050
queueName=default
examplesRoot=oozie
oozie.use.system.libpath=true
oozie.wf.application.path=${nameNode}/user/hdfs/${examplesRoot}
oozie.wf.rerun.failnodes=false
start=2016-09-01T01:34Z
end=2016-09-01T08:45Z
timezone=UTC
frequency=*/30 * * * *
这里有一点要注意的是,test.py文件中可以使用import或from ...import从Python系统中导入py文件,但对于自己写的py文件,从test.py中导入执行不了,这个问题目前还没有找到解决方案。
workflow.xml的配置如下:
<workflow-app xmlns="uri:oozie:workflow:0.4" name="full-demo">
<start to="python-node"/>
<!-- Python action -->
<action name="python-node">
<shell xmlns="uri:oozie:shell-action:0.2">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
</configuration>
<exec>test.py</exec>
<file><span style="font-family: Arial, Helvetica, sans-serif;">test.py</span><span style="font-family: Arial, Helvetica, sans-serif;"></file></span>
</shell>
<ok to="send-email"/>
<error to="fail"/>
</action>
<action name="send-email">
<email xmlns="uri:oozie:email-action:0.1">
<to>xxx@xx.com</to>
<cc>xxx@qq.com</cc>
<subject>Email notifications for ${wf:id()}</subject>
<body>The wf ${wf:id()} successfully completed.</body>
</email>
<ok to="end"/>
<error to="fail"/>
</action>
<kill name="fail">
<message>Python action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end"/>
</workflow-app>job.properties文件配置如下:
nameNode=hdfs://test:8020
jobTracker=test:8050
queueName=default
examplesRoot=oozie
oozie.use.system.libpath=true
oozie.wf.application.path=${nameNode}/user/hdfs/${examplesRoot}
oozie.wf.rerun.failnodes=false
start=2016-09-01T01:34Z
end=2016-09-01T08:45Z
timezone=UTC
frequency=*/30 * * * *
这里有一点要注意的是,test.py文件中可以使用import或from ...import从Python系统中导入py文件,但对于自己写的py文件,从test.py中导入执行不了,这个问题目前还没有找到解决方案。
相关文章推荐
- Oozie shell action
- oozie框架案例之shellAction
- Oozie Shell Action 配置
- Basics of Oozie and Oozie SHELL action
- Oozie-自定义实现WorkFlow中shell action
- Failing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.ShellMain], exit code [1]
- 由于在写oozie hive action时候script属性指定hql脚本时多写了一个斜杠导致的一个悲剧,以及解决方案
- oozie hive action注意事项
- How to Create a First Shell Script
- SWF反编神器Action Script Viewer终身免费升级!
- AS3 大作 Essential ActionScript 3.0 电子版 下载
- 开发Flex for Android第一个ANE(ActionScript Native Extensions)本地扩展
- 最强Flash反编译软件(Action Script Viewer)ASV2012/04发布
- my first shell script
- [ID 401749.1] Shell Script to Calculate Values Recommended Linux HugePages / HugeTLB Configuration
- bash shell script 简明教程
- How to find variable is empty in shell script
- Flex Actionscript 3 flash游戏 键盘 连招 连按 combo 同时按 事件处理
- linux 查找系统最大分区挂载点的shell script
- ASP.NET AJAX in Action—ScriptManager