2
votes

How can one pass Oozie configuration values to workflow actions?

For instance, Oozie is aware of the job tracker URL:

# oozie admin -oozie localhost:10000 -configuration | fgrep tracker
oozie.actions.default.job-tracker : server1:8080

Now in workflow.xml, we find:

<action name="hive-5228" cred="hcat">
    <hive xmlns="uri:oozie:hive-action:0.2">
        <job-tracker>${jobTracker}</job-tracker>
        <name-node>${nameNode}</name-node>
        [... deleted parameters for clarity ...]
    </hive>
    <ok to="hive-38fe"/>
    <error to="email-c6f0"/>
</action>

Currently, ${jobTracker} is hardcoded in a Java properties file, duplicating the information since Oozie is already aware of the job tracker URL. Is it possible to reference the Oozie configuration from within the worklow.xml file? I tried the following to no vail:

<job-tracker>${oozie.actions.default.job-tracker}</job-tracker>

This returns an error stating that variable 'oozie' is not defined.

I want to avoid creating specific property files for DEV, QA and PROD and since Oozie already knows the specific configuration for the environment, I would like it to pass the data to the coordinators and workflows.

2

2 Answers

2
votes

You should be able to access the variable data using <job-tracker>${wf:conf('oozie.actions.default.job-tracker')}</job-tracker>

0
votes

If you don't want to define the name-node and job-tracker in every and each of your workflows, you only have to add the following properties in the Oozie service configuration (oozie-site):

oozie.actions.default.name-node=<name-node-value>
oozie.actions.default.job-tracker=<job-tracker-value>

It worked for me using Oozie 4.2.0.