You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@oozie.apache.org by Richard Primera <ri...@woombatcg.com> on 2018/05/10 18:46:30 UTC

Oozie Variable Substitution In XML's Workflow Name

Greetings,

I have a workflow definition where I would like to generate the name of 
the workflow dynamically. Say you have a workflow that can operate on 
hundreds of different sources. It would be benefitial if one could set 
the name of the workflow to be $applicationName_$source instead of 
simply $applicationName. In this case I thought that a simple variable 
substitution would've worked, meaning:

*<**workflow-app **name=**"my_application" 
**xmlns=**"uri:oozie:workflow:0.5"**>*

Could then be set to be:

*<**workflow-app **name=**${dynamically_generated_wf_name} 
**xmlns=**"uri:oozie:workflow:0.5"**>*
Or
*<**workflow-app **name=**"${dynamically_generated_wf_name}" 
**xmlns=**"uri:oozie:workflow:0.5"**>*

However this doesn't work. In the first case launching the workflow 
simply fails, I assume due to the missing quotes in the name parameter 
inside the <workflow-app> element. In the second case the workflow name 
appears as the literal string ${dynamically_generated_wf_name}, so it's 
obvious that variable substitution is not being performed in that element.

The obvious approach to this would be to manually do the substitution on 
the XML template with a script and then place that in the HDFS path 
where the XML file normally resides, however this approach implies more 
work if the actual workflow is to be launched many times in parallel for 
different parameters and with different names. In that case one would 
have to place multiple XML files in different locations in the HDFS 
which becomes a bit of a pain. At this moment I'm waiting for a more 
elegant approach but I've failed to come to it on my own, so I decided 
to reach out to other oozie users out there and see what comes up.


Thanks in advance.