You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@oozie.apache.org by Himanish Kushary <hi...@gmail.com> on 2012/08/31 16:27:49 UTC

Getting last action node id from within another action node

Hi

I am trying to define a workflow where I could come into a java action node
from either Action A or Action AA.Depending on whether I come from Action A
or Action AA I would like to write different values into the properties
file (capture-output) that will be generated from the java action.
Subsequently a decision node will take different route based on the
different properties (key-value) set through the java action.I was thinking
of implementing the different properties key using the action id for Action
A / Action AA.

Is there any way to know the previous action id from the Java action
Node.Is there any EL function like wf:lastActionId ? Is there any
alternative way to define similar workflow ?


<action A> ----------
                           ------------------- <action B>
                           |------------ <java action node>
----------<decision node 1>--|
<action AA>---------
                           ------------------ <action BB>


---------------------------
Thanks & Regards
Himanish

Re: Getting last action node id from within another action node

Posted by Himanish Kushary <hi...@gmail.com>.
Hi Mona,

Thanks for your reply.Here is more details on my usecase.

I am running a hive action ( the SQL calculates the count for a
table(table1) joined with two other tables)  to update a directory in HDFS(
only with the count in the generated file), then using a Java action I am
generating the reading that count from the HDFS file and if the count is
greater than zero, I am setting a property proceed=1.In the decision action
node, if  proceed=1 then fail else move on to next hive action.

Now incidentally my next hive action is also similar ( means it also
calculates count by joining the table table1 with few other tables) and
will follow the same Java action --> Decision Node logic as above.

Now to keep the workflow xml simple and avoid duplicating the same set of
(action node - java action node - decision node).. in the decision node i
will like to use a logic like(in the switch case) :
case
when( proceed!=1 and wf.lastActionName='hive1') then move to 'hive2'
when( proceed!=1 and wf.lastActionName='hive2') then move to 'hive3'
when( proceed!=1 and wf.lastActionName='hive3') then move to 'hive4'

Thats why I was looking for something in that line.Not sure whether I am
making things far too complicated :-)

Hope this helps to give a better understanding of what I am trying
to achieve.

Thanks
Himanish

On Fri, Aug 31, 2012 at 3:48 PM, Mona Chitnis <ch...@yahoo-inc.com> wrote:

> Hi Himanish,
>
> There are a couple of other alternatives to this as well. Say if either of
> your preceding actions A or AA is a
>
>  *   java action, using <capture-output> tag, you will get all the
> action's data, accessible via wf:actionData(actionNode)
>
>
> http://incubator.apache.org/oozie/docs/3.2.0-incubating/docs/WorkflowFunctionalSpec.html#a4.2.1_Basic_EL_Constants
>
>  *   Map-reduce action, you can access mr counters (hadoop EL functions)
> of that node, and retrieve the information about this node
>
>
> http://incubator.apache.org/oozie/docs/3.2.0-incubating/docs/WorkflowFunctionalSpec.html#a4.2.5_Hadoop_EL_Functions
>
>
> Maybe you can elaborate on this use-case a bit more? We can think about
> supporting it if the current options are not solving it in entirety.
>
> Thanks and Regards,
> --
> Mona Chitnis
>
>
>
> On 8/31/12 11:09 AM, "Mona Chitnis" <chitnis@yahoo-inc.com<mailto:
> chitnis@yahoo-inc.com>> wrote:
>
> Hi Himanish,
>
> I believe the EL function that would be of use in this case is
> wf:transition(String node). You can check through the various action nodes
> preceding your java action (say called "java-node"), to check which holds
> the value "java-node" as a transition. Once you have that answer, is your
> Java action code handling it in some way to put it in the output
> properties? Or you could make this comparison as part of your decision
> node switch-case too.
>
> Hope that helps,
> --
> Mona Chitnis
>
>
>
>
> On 8/31/12 7:27 AM, "Himanish Kushary" <himanish@gmail.com<mailto:
> himanish@gmail.com>> wrote:
>
> Hi
>
> I am trying to define a workflow where I could come into a java action
> node
> from either Action A or Action AA.Depending on whether I come from Action
> A
> or Action AA I would like to write different values into the properties
> file (capture-output) that will be generated from the java action.
> Subsequently a decision node will take different route based on the
> different properties (key-value) set through the java action.I was
> thinking
> of implementing the different properties key using the action id for
> Action
> A / Action AA.
>
> Is there any way to know the previous action id from the Java action
> Node.Is there any EL function like wf:lastActionId ? Is there any
> alternative way to define similar workflow ?
>
>
> <action A> ----------
>                            ------------------- <action B>
>                            |------------ <java action node>
> ----------<decision node 1>--|
> <action AA>---------
>                            ------------------ <action BB>
>
>
> ---------------------------
> Thanks & Regards
> Himanish
>
>
>


-- 
Thanks & Regards
Himanish

Re: Getting last action node id from within another action node

Posted by Mona Chitnis <ch...@yahoo-inc.com>.
Hi Himanish,

There are a couple of other alternatives to this as well. Say if either of your preceding actions A or AA is a

 *   java action, using <capture-output> tag, you will get all the action's data, accessible via wf:actionData(actionNode)

http://incubator.apache.org/oozie/docs/3.2.0-incubating/docs/WorkflowFunctionalSpec.html#a4.2.1_Basic_EL_Constants

 *   Map-reduce action, you can access mr counters (hadoop EL functions) of that node, and retrieve the information about this node

http://incubator.apache.org/oozie/docs/3.2.0-incubating/docs/WorkflowFunctionalSpec.html#a4.2.5_Hadoop_EL_Functions


Maybe you can elaborate on this use-case a bit more? We can think about supporting it if the current options are not solving it in entirety.

Thanks and Regards,
--
Mona Chitnis



On 8/31/12 11:09 AM, "Mona Chitnis" <ch...@yahoo-inc.com>> wrote:

Hi Himanish,

I believe the EL function that would be of use in this case is
wf:transition(String node). You can check through the various action nodes
preceding your java action (say called "java-node"), to check which holds
the value "java-node" as a transition. Once you have that answer, is your
Java action code handling it in some way to put it in the output
properties? Or you could make this comparison as part of your decision
node switch-case too.

Hope that helps,
--
Mona Chitnis




On 8/31/12 7:27 AM, "Himanish Kushary" <hi...@gmail.com>> wrote:

Hi

I am trying to define a workflow where I could come into a java action
node
from either Action A or Action AA.Depending on whether I come from Action
A
or Action AA I would like to write different values into the properties
file (capture-output) that will be generated from the java action.
Subsequently a decision node will take different route based on the
different properties (key-value) set through the java action.I was
thinking
of implementing the different properties key using the action id for
Action
A / Action AA.

Is there any way to know the previous action id from the Java action
Node.Is there any EL function like wf:lastActionId ? Is there any
alternative way to define similar workflow ?


<action A> ----------
                           ------------------- <action B>
                           |------------ <java action node>
----------<decision node 1>--|
<action AA>---------
                           ------------------ <action BB>


---------------------------
Thanks & Regards
Himanish



Re: Getting last action node id from within another action node

Posted by Mona Chitnis <ch...@yahoo-inc.com>.
Hi Himanish,

I believe the EL function that would be of use in this case is
wf:transition(String node). You can check through the various action nodes
preceding your java action (say called "java-node"), to check which holds
the value "java-node" as a transition. Once you have that answer, is your
Java action code handling it in some way to put it in the output
properties? Or you could make this comparison as part of your decision
node switch-case too.

Hope that helps,
--
Mona Chitnis




On 8/31/12 7:27 AM, "Himanish Kushary" <hi...@gmail.com> wrote:

>Hi
>
>I am trying to define a workflow where I could come into a java action
>node
>from either Action A or Action AA.Depending on whether I come from Action
>A
>or Action AA I would like to write different values into the properties
>file (capture-output) that will be generated from the java action.
>Subsequently a decision node will take different route based on the
>different properties (key-value) set through the java action.I was
>thinking
>of implementing the different properties key using the action id for
>Action
>A / Action AA.
>
>Is there any way to know the previous action id from the Java action
>Node.Is there any EL function like wf:lastActionId ? Is there any
>alternative way to define similar workflow ?
>
>
><action A> ----------
>                           ------------------- <action B>
>                           |------------ <java action node>
>----------<decision node 1>--|
><action AA>---------
>                           ------------------ <action BB>
>
>
>---------------------------
>Thanks & Regards
>Himanish