oozieoozie-coordinatoroozie-workflow

OOZIE workflow.xml No function is mapped to the name coord:nominalTime


I'm using Oozie's SLA feature. I'm trying to use ${coord:nominalTime()} for nominal time, but it throws an error when I schedule the workflow:

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

This is workflow.xml file:

<?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>

What could be the reason for this error?


Solution

  • coord:NominalTime() function can be used with only with coordinator.xml. If you want to use it in workflow.xml, then first define in coordinator like this:

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

    And in the workflow, you can call in this way:

    ${nominalTime}