我想创建一个变量,该变量应可用于oozie工作流中的所有操作。我试图创建它如下所示。但el表达式没有得到求值,导致当前值变为el表达式本身。谁能帮我解释一下吗?
<workflow-app xmlns="uri:oozie:workflow:0.4" name="no-op-wf">
<parameters>
<property>
<name>current_ts</name>
<value>${replaceAll((replaceAll((replaceAll((timestamp()),"-","")),"T","_")),":","")}</value>
</property>
</parameters>
<start to="test"/>
<kill name="test">
<!--message Just to show that this expression works if used here>Timestamp - [${replaceAll((replaceAll((replaceAll((timestamp()),"-","")),"T","_")),":","")}</message-->
<message>Timestamp - ${current_ts}</message> <!-- this will print expression but not evaluate it -->
</kill>
<end name="end"/>
</workflow-app>
2条答案
按热度按时间u59ebvdq1#
在工作流参数化中提到:
el表达式可用于动作和决策节点的配置值。它们可以用在xml属性值中,也可以用在xml元素和属性值中。
它们不能用在xml元素和属性名称中。它们不能用在节点的名称中,也不能用在节点的转换元素中。
但你可以用在协调器里
xoefb8l82#
如果我在工作流中创建一个global->configuration->property并在wf的其他操作中引用它,那么属性中的el表达式将不会得到计算。
作为解决方法,我将wf Package 为子wf,并在父wf中创建global->configuation->property,然后将其传递给子wf。通过这种变通方法,el表达式得到了计算。
父wf: