OOZIEworkflow.xml没有函数映射到名称coord:nominalTime

时间:2019-04-26 12:37:06

标签: oozie oozie-coordinator oozie-workflow

我正在使用Oozie的SLA功能。我正在尝试使用$ {coord:nominalTime()}作为标称时间。但是当我安排工作流程时会引发错误。

E0803 : E0803: IO error, E1004: Expression language evaluation error, Validation error :No function is mapped to the name \"coord:nominalTime\"",

这是workflow.xml文件

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <wf:workflow-app xmlns:wf="uri:oozie:workflow:0.4" xmlns:spark="uri:oozie:spark-action:0.2" xmlns:shell="uri:oozie:shell-action:0.2" xmlns:sla="uri:oozie:sla:0.1" xmlns:coord="uri:oozie:coordinator:0.2" name="some-Job">
    <wf:global>
        <wf:job-tracker>${jobTracker}</wf:job-tracker>
        <wf:name-node>${nameNode}</wf:name-node>
    </wf:global>
    <wf:credentials>
        <wf:credential name="sds-creds" type="hcat">
            <wf:property>
                <wf:name>hcat.metastore.principal</wf:name>
                <wf:value>${hcatPrincipal}</wf:value>
            </wf:property>
            <wf:property>
                <wf:name>hcat.metastore.uri</wf:name>
                <wf:value>${hcatURL}</wf:value>
            </wf:property>
        </wf:credential>
    </wf:credentials>
    <wf:start to="some-Job"/>
    <wf:action name="some-Job" cred="sds-creds">
      <spark:job-tracker>${jobTracker}</spark:job-tracker>
      <spark:name-node>${nameNode}</spark:name-node>
      <spark:master>yarn</spark:master>
      <spark:mode>cluster</spark:mode>
      <spark:name>Some-Job</spark:name>
      <spark:class>com.Driver</spark:class>
      <spark:jar>hdfs:///user/abc.jar</spark:jar>
        <wf:ok to="End"/>
        <wf:error to="Kill"/>
    </wf:action>
    <wf:kill name="Kill">
        <wf:message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</wf:message>
    </wf:kill>
    <wf:end name="End"/>
    <sla:info>
        <sla:app-name>oozie-sla-test</sla:app-name>
        <sla:nominal-time>${coord:nominalTime()}</sla:nominal-time>
        <sla:should-start>1</sla:should-start>
        <sla:should-end>5</sla:should-end>
        <sla:notification-msg>Job couldn't complete</sla:notification-msg>
        <sla:alert-contact>test@gmail.com</sla:alert-contact>
        <sla:dev-contact>test@gmail.com</sla:dev-contact>
        <sla:qa-contact>test@gmail.com</sla:qa-contact>
        <sla:se-contact>test@gmail.com</sla:se-contact>
    </sla:info> </wf:workflow-app>

此错误的可能原因是什么? 任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:1)

您是否定义了启动此工作流程的协调器xml?除非涉及协调员,否则您将无法使用$ {coord:nominalTime()}。

这是一个快速的示例协调器:

<coordinator-app name="poc" start="${startTime}" end="${endTime}"
             frequency="${coord:days(1)}"  timezone="America/New_York"
             xmlns="uri:oozie:coordinator:0.4" xmlns:sla="uri:oozie:sla:0.2">
  <action>
    <workflow>
        <app-path>/tmp/path-to-your-workflow</app-path>
        <configuration>
            <property>
                <name>nameNode</name>
                <value>${nameNode}</value>
            </property>
            <property>
                <name>jobTracker</name>
                <value>${jobTracker}</value>
            </property>
        </configuration>
     </workflow>
   </action>
</coordinator-app>

答案 1 :(得分:0)

最后找到了解决方法。

因此,coord:NominalTime()函数只能与coordinator.xml一起使用。如果要在工作流.xml中使用它,则首先在协调器中定义如下:

// Retrieving container DOM object
var domContainer = $("#container")[0];

// Iterating CKEDITOR instances
for (var intanceName in CKEDITOR.instances) {

    // Testing if instance is inside container
    if ( $.contains(domContainer, CKEDITOR.instances[intanceName].container.$ ) ) {

        // Binding with focus event
        CKEDITOR.instances[intanceName].on('focus', function() {

            // Executing custom function with instance name as an argument
            my_custom_function(intanceName);
        });
    }
}

在工作流程中,您可以通过这种方式调用。

<property>
         <name>nominalTime()</name>
          <value>${coord:nominalTime()}</value>
  </property>