设为首页 加入收藏

TOP

指定Oozie Java节点的Hadoop属性
2014-11-23 22:15:47 来源: 作者: 【 】 浏览:28
Tags:指定 Oozie Java 节点 Hadoop 属性

一路追踪,


从开始servlet到一直调用后端的


org.apache.oozie.action.hadoop.JavaActionExecutor.submitLauncher(Context context, WorkflowAction action);


在这个函数中的关键代码


--------------------------------------分割线 --------------------------------------


推荐阅读


--------------------------------------分割线 --------------------------------------


最后调用


runningJob =jobClient.submitJob(launcherJobConf);


在这个提交job的时候参数JobConf就是launcherJobConf


而launcherJobConf的生成是


JobConf launcherJobConf =createLauncherConf(context, action, actionXml, actionConf);


当这个在创建的时候会使用到workflow.xml的节点信息actionXMl


在createLauncherConf函数中会有个


setupLauncherConf(launcherConf, actionXml, appPathRoot, context);


上边这个函数中写着如何加入启动hadoop的一些参数


Configuration setupLauncherConf(Configuration conf, Element actionXml,Path appPath, Context context) throws ActionExecutorException {
try {
Namespace ns = actionXml.getNamespace();
Element e = actionXml.getChild("configuration", ns);
if (e != null) {
String strConf =XmlUtils.prettyPrint(e).toString();
XConfiguration inlineConf = newXConfiguration(new StringReader(strConf));

XConfiguration launcherConf =new XConfiguration();
for (Map.Entry entry : inlineConf) {
if(entry.getKey().startsWith("oozie.launcher.")) {
String name =entry.getKey().substring("oozie.launcher.".length());
String value =entry.getValue();
// setting original KEY
launcherConf.set(entry.getKey(), value);
// setting un-prefixedkey (to allow Hadoop job config
// for the launcher job
launcherConf.set(name,value);
}
}
checkForDisallowedProps(launcherConf,"inline launcher configuration");
XConfiguration.copy(launcherConf, conf);
}
return conf;
}
catch (IOException ex) {
throw convertException(ex);
}
}


上边函数已经写着很明白了,当以oozie.launcher.开头的


Configuration节点中的属性,都会被加入到 Configuration中


这个时候只要在自己写的oozie节点中加入如下参数就ok了




${jobTracker}
${nameNode}


mapred.job.queue.name
${queueName}


oozie.launcher.mapreduce.task.classpath.user.precedence
true


com.jd.ebsdi.hadoop.mapreduce.ooziemain.main.DoCheck

{"dbSetPointerType":"pointerTime","wfName":"${wf:name()}","coorTime":"${wf:conf("nominalTime")}","wfPath":"${wf_app_path}","failClockThresholdValue":"${failThreshold}","checkLockFrequence":"${checkLockSequence}","waitingThresholdValue":"${waitingThreshold}"}






在hadoop的job配置文件中


hdfs://hadoop-master.xxx.com:8020/home/data/hadoop/cache/mapred/staging/houchangren/.staging/job_201401261826_18982/job.xml


可以看到


如下的属性


这个是oozie的属性


指定Oozie Java节点的Hadoop属性


下边中是解析后的hadoop属性


指定Oozie Java节点的Hadoop属性


恩恩,事情搞定了


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Spring 定时器执行两次 下一篇实用的Linux SHELL面试问题及答案

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: