hadoopoozieoozie-coordinatoroozie-workflow

How to read config properties in sub-workflow (separate xml file)?


I am getting below mentioned error message while reading config properties in separate sub-workflow file. I am posting the sample code. Appreciate your help in resolving this issue. Thank you!

2019-01-17 08:44:52,885 WARN ActionStartXCommand:523 - SERVER[localhost] USER[user1] GROUP[-] TOKEN[] APP[subWorkflow] JOB[0338958-190114130857167-oozie-oozi-W] ACTION[0338958-190114130857167-oozie-oozi-W@subWorkflowAction1] ELException in ActionStartXCommand javax.servlet.jsp.el.ELException: variable [jobtracker] cannot be resolved

Coordinator job trigger command

oozie job --oozie http://localhost:11000/oozie --config /home/user/oozie-scripts/props/job.properties -run

job.properties

namenode=hdfs://localhost
workflowpath=${namenode}/user/user1/oozie-workflow/parentWorkflow.xml
frequency=25
starttime=2018-08-06T13\:29Z
endtime=2108-08-06T13\:29Z
timezone=UTC
oozie.coord.application.path=${namenode}/user/user1/oozie-workflow/coordinator.xml
jobtracker=http://localhost:8088
scriptpath=/user/user1/oozie-workflow

Coordinator

<coordinator-app name="sampleCoord" frequency="${frequency}" start="${starttime}" end="${endtime}" timezone="${timezone}" xmlns="uri:oozie:coordinator:0.4">
<action>
<workflow>
<app-path>${workflowpath}</app-path>
</workflow>
</action>
</coordinator-app>

Parent Workflow

<workflow-app xmlns = "uri:oozie:workflow:0.4" name = "Parent-Workflow">
<start to = "workflowAction1" />
<action name = "workflowAction1">
<sub-workflow>
<app-path>/user/user1/oozie-workflow/subWorkflow1.xml</app-path>
</sub-workflow>
<ok to = "end" />
<error to = "end" />
</action>

Sub-Workflow

<workflow-app xmlns = "uri:oozie:workflow:0.4" name = "subWorkflow">
<start to = "subWorkflowAction1" />
<action name = "subWorkflowAction1">
<hive xmlns = "uri:oozie:hive-action:0.4">
<job-tracker>${jobtracker}</job-tracker>
<script>${scriptpath}/dropTempTable.hive</script>
<param>Temp_TableVar=${concat(concat("HBASE_",replaceAll(wf:id(),"-    ","_")),"_TEMP")}</param>
</hive>

<ok to = "end" />
<error to = "kill_job" />
</action>


<kill name = "kill_job">
<message>Job failed</message>
</kill>
<end name = "end" />
</workflow-app>

Solution

  • Adding propagate-configuration tag in parent workflow xml file resolved the issue.

    <workflow-app xmlns = "uri:oozie:workflow:0.4" name = "Parent-Workflow">
    <start to = "workflowAction1" />
    <action name = "workflowAction1">
    <sub-workflow>
    <app-path>/user/user1/oozie-workflow/subWorkflow1.xml</app-path>
    <propagate-configuration />
    </sub-workflow>
    <ok to = "end" />
    <error to = "end" />