Re: Oozie Variable Substitution In XML's Workflow Name

2018-05-14 Thread Peter Cseh
Hey!

This should be possible as of
https://issues.apache.org/jira/browse/OOZIE-637.
I haven't tried to do so, but please file a bug ticket with a reproduction
case attached  so it is easier to fix.

Thanks!

On Thu, May 10, 2018 at 8:59 PM, Richard Primera <
richard.prim...@woombatcg.com> wrote:

> 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:
>
> 
>
> Could then be set to be:
>
>  xmlns="uri:oozie:workflow:0.5">
>
> Or
>  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
>  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.
>



-- 
*Peter Cseh *| Software Engineer
cloudera.com 

[image: Cloudera] 

[image: Cloudera on Twitter]  [image:
Cloudera on Facebook]  [image: Cloudera
on LinkedIn] 
--


Oozie Variable Substitution In XML's Workflow Name

2018-05-10 Thread Richard Primera

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:


    

Could then be set to be:

    xmlns="uri:oozie:workflow:0.5">


Or
    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  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.


Oozie Variable Substitution In XML's Workflow Name

2018-05-10 Thread Richard Primera

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