Oozie Custom EL function协调​​器的oozie [英] Oozie Custom EL function oozie for coordinator

查看:110
本文介绍了Oozie Custom EL function协调​​器的oozie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个自定义el函数,该函数将在oozie协调器内部使用.我的自定义el函数运行良好,但是当我将已经定义的oozie el函数作为参数传递给el函数时,它将引发异常.

I want to create a custom el function that i will use inside oozie coordinator. My custom el function is working fine but when i pass already defined oozie el function as a parameter to my el function it throws exception.

coordinator.xml

$ {coord:dateToEpoch(coord:nominalTime(),"yyyy-MM-dd'T'hh:mmZ")参见以下示例

<datasets>
    <dataset name="input1" frequency="${inputDataSetFrequence}" initial-instance="${initialInstance}"
             timezone="${timezone}">
        <uri-template>${inputBasePath}/${useCaseName}/bintime=${coord:dateToEpoch(coord:nominalTime(),  "yyyy-MM-dd'T'hh:mmZ")}
        </uri-template>
        <done-flag></done-flag>
    </dataset>
</datasets>
<input-events>
    <data-in name="coordInput1" dataset="input1">
        <instance>${coord:current(0)}</instance>
    </data-in>
</input-events>

我用来测试的配置

<property>
<name>oozie.service.ELService.ext.functions.coord-job-submit-nofuncs</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>

恒定参数有效,但动态参数无效

constant param is working but dynamic param is not working

工作电话

$ {coord:dateToEpoch("2009-01-01T08:00UTC","yyyy-MM-dd'T'hh:mmZ")

${coord:dateToEpoch("2009-01-01T08:00UTC", "yyyy-MM-dd'T'hh:mmZ")

异常调用

$ {coord:dateToEpoch(coord:nominalTime(),"yyyy-MM-dd'T'hh:mmZ")

${coord:dateToEpoch(coord:nominalTime(), "yyyy-MM-dd'T'hh:mmZ")

试图使用所有这些属性

    <property>
<name>oozie.service.ELService.ext.functions.job-submit</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>
<property>
<name>oozie.service.ELService.ext.functions.workflow</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>
<property>
<name>oozie.service.ELService.ext.functions.wf-sla-submit</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>
<property>
<name>oozie.service.ELService.ext.functions.coord-job-submit-freq</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>
<property>
<name>oozie.service.ELService.ext.functions.coord-job-submit-data</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>
<property>
<name>oozie.service.ELService.ext.functions.coord-job-submit-instances</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>
<property>
<name>oozie.service.ELService.ext.functions.coord-sla-create</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>
<property>
<name>oozie.service.ELService.ext.functions.coord-sla-submit</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>
<property>
<name>oozie.service.ELService.ext.functions.coord-action-create</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>
<property>
<name>oozie.service.ELService.ext.functions.coord-action-create-inst</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>
<property>
<name>oozie.service.ELService.ext.functions.coord-action-start</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>
<property>
<name>oozie.service.ELService.ext.functions.coord-job-wait-timeout</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>
<property>
<name>oozie.service.ELService.ext.functions.bundle-submit</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>
<property>
<name>oozie.service.ELService.ext.functions.coord-job-submit-initial-instance</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>

<property>
<name>oozie.service.ELService.ext.functions.coord-job-submit-nofuncs</name>
<value>coord:dateToEpoch=com.mobileum.oozie.MobileumELFunctions#dateToEpoch</value>
</property>

EXCEPTION

Caused by: java.lang.Exception: Unable to evaluate :${inputBasePath}/${useCaseName}/bintime=${coord:dateToEpoch(coord:nominalTime(),  "yyyy-MM-dd'T'hh:mmZ")}:

    at org.apache.oozie.coord.CoordELFunctions.evalAndWrap(CoordELFunctions.java:743)
    at org.apache.oozie.command.coord.CoordSubmitXCommand.resolveTagContents(CoordSubmitXCommand.java:1002)
    ... 37 more
Caused by: javax.servlet.jsp.el.ELException: No function is mapped to the name "coord:nominalTime"
    at org.apache.commons.el.Logger.logError(Logger.java:481)
    at org.apache.commons.el.Logger.logError(Logger.java:498)
    at org.apache.commons.el.Logger.logError(Logger.java:525)
    at org.apache.commons.el.FunctionInvocation.evaluate(FunctionInvocation.java:150)
    at org.apache.commons.el.FunctionInvocation.evaluate(FunctionInvocation.java:163)
    at org.apache.commons.el.ExpressionString.evaluate(ExpressionString.java:114)
    at org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:274)
    at org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:190)
    at org.apache.oozie.util.ELEvaluator.evaluate(ELEvaluator.java:204)
    at org.apache.oozie.coord.CoordELFunctions.evalAndWrap(CoordELFunctions.java:734)

推荐答案

并非所有Oozie EL构造都在uri-template中求值.有关更多详细信息,请参考同步数据集.以下是uri-template的摘录:

Not all Oozie EL constructs are evaluated in uri-template. Please refer section Synchronous Datasets for more details. Below is excerpt on uri-template:

uri-template:标识数据集的URI模板,可以是 解析为具体的URI以标识特定的数据集实例. URI模板是使用以下内容构造的:

uri-template: The URI template that identifies the dataset and can be resolved into concrete URIs to identify a particular dataset instance. The URI template is constructed using:

常数:请参见下面的允许的EL时间常数.例如:$ {YEAR}/$ {MONTH}.

constants: See the allowable EL Time Constants below. Ex: ${YEAR}/${MONTH}.

变量:变量必须在将协调器作业提交给协调器引擎时解析.通常为他们提供作业参数(配置属性).例如:$ {market}/$ {language}

variables: Variables must be resolved at the time a coordinator job is submitted to the coordinator engine. They are normally provided a job parameters (configuration properties). Ex: ${market}/${language}

以下EL常量可在同步数据集URI模板中使用:

The following EL constants can be used within synchronous dataset URI templates:

  • YEAR
  • MONTH
  • DAY
  • 小时
  • MINUTE

问题与您的自定义EL函数实现无关.因此,即使您使用了以下功能,也无法使用:

Problem is not associated with your custom EL function implementation. So even if you have used following, it will not work:

<uri-template>${inputBasePath}/${useCaseName}/bintime=${coord:nominalTime()}</uri-template>

这篇关于Oozie Custom EL function协调​​器的oozie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆