[英]Hadoop Oozie Workflow not getting Coordinator properties
我有一个简单的Oozie协调员和工作流程。 我试图按如下所述将协调器的dataIn属性传递给工作流: https ://oozie.apache.org/docs/3.2.0-incubating/CoordinatorFunctionalSpec.html#a6.7.1._coord:dataInString_name_EL_Function
由于某些原因,在以下示例中,该值在工作流属性中为空,而EL变量为空${inputDir}
。
实际错误是: variable [inputDir] cannot be resolved
<?xml version="1.0" encoding="UTF-8"?>
<coordinator-app xmlns="uri:oozie:coordinator:0.4" name="awesome" frequency="${coord:days(1)}" start="2014-10-06T00:01Z" end="2050-01-01T00:01Z" timezone="UTC">
<controls>
<!-- Wait 23 hours before giving up -->
<timeout>1380</timeout>
<concurrency>1</concurrency>
<execution>LIFO</execution>
</controls>
<datasets>
<dataset name="itsready" frequency="${coord:days(1)}" initial-instance="2014-10-06T08:00Z" timezone="America/Los_Angeles">
<uri-template>${s3DataPath}/${YEAR}-${MONTH}-${DAY}</uri-template>
<!-- with the done-flag set to none, this will look for the folder's existance -->
<done-flag></done-flag>
</dataset>
<!-- output dataset -->
<dataset name="itsdone" frequency="${coord:days(1)}" initial-instance="2014-10-06T08:00Z" timezone="America/Los_Angeles">
<uri-template>${dataPath}/awesome/sql-schema-tab-delim-load/${YEAR}-${MONTH}-${DAY}/loaded</uri-template>
</dataset>
</datasets>
<input-events>
<data-in name="input" dataset="itsready">
<instance>${coord:current(0)}</instance>
</data-in>
</input-events>
<output-events>
<data-out name="output" dataset="itsdone">
<instance>${coord:current(0)}</instance>
</data-out>
</output-events>
<action>
<workflow>
<app-path>${workflowApplicationPath}</app-path>
<configuration>
<property>
<name>inputDir</name>
<value>${coord:dataIn('input')}</value>
</property>
</configuration>
</workflow>
</action>
</coordinator-app>
<?xml version="1.0" encoding="UTF-8"?>
<workflow-app xmlns="uri:oozie:workflow:0.4" name="awesome-wf">
<start to="shell-import"/>
<action name="shell-import">
<shell xmlns="uri:oozie:shell-action:0.2">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<exec>${importFile}</exec>
<env-var>INPUT_DIR=${inputDir}</env-var>
<file>${importFile}#${importFile}</file>
</shell>
<ok to="end"/>
<error to="fail"/>
</action>
<kill name="fail">
<message>it failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end"/>
</workflow-app>
hadoopMaster=myawesome.server.com
nameNode=hdfs://${hadoopMaster}:8020
jobTracker=${hadoopMaster}:8050
tzOffset=-8
oozie.use.system.libpath=true
oozie.libpath=/user/oozie/share/lib
appPath=${nameNode}/apps
dataPath=${appPath}/data
s3DataPath=s3n://an/awesome/s3/data/path
oozie.wf.action.notification.url=https://zapier.com/mysecreturl
workflowApplicationPath=${appPath}/awesome
#uncomment both of these lines to test the workflow
#inputDir=s3://awesome/path/2014-10-06
#oozie.wf.application.path=${workflowApplicationPath}
oozie.coord.application.path=${workflowApplicationPath}
importFile=import.sh
要点如下: https : //gist.github.com/nathantsoi/dc8caac7109a57c99399#file-awesome-oozie-config-md
终于有机会重温了这一点。 它现在正在运行,但是可能由于多种原因。 为了后代,这是我更改的内容:
需要进行一些调试才能确定确切原因。
这很容易回答:协调员的开始时间为2014-10-06T00:01Z,而数据集的初始实例为2014-10-06T08:00Z。 因此$ {coord:current(0)}无法为协调程序的第一次运行返回有效的数据集。
似乎您只在运行工作流,而不在运行协调器。
如果您希望协调器填写这些参数-您需要运行协调器-当数据准备就绪时,它将运行工作流程
可能有两种可能性:
- 而不是在uri模板$ {s3DataPath} / $ {YEAR}-$ {MONTH}-$ {DAY}中使用$ {YEAR}-$ {MONTH}-$ {DAY},请尝试使用hdfs的完整路径对值进行硬编码路径(例如hdfs:// namenode:8020 / user / data / s3DataPath / 2012-10-10),然后检查EL函数是否正确替换了日期格式。 如果没有,请检查格式化程序以正确定义它。
2.它可能具有与输入相同的值$ {coord:current(0)}。 因此,尝试使其变为$ {coord:current(1)}。
可能会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.