Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Using Oozie Worfklow Expression Language Functions in Hue

avatar
Explorer

I have a shell action node that is able to send notifications to a chat application and can be used as a transition route if another action node in the workflow fails. What I'd like to be able to do, is use wf:user() and wf:lastErrorNode() in that notification.

 

My idea was to pass these values to my shell script as arguments, but when I place 'wf:X()' as the argument to my shell action node, it doesn't resolve to anything and just gives me the raw string as the argument.

 

Is there a way to use these in a shell action node? 

1 ACCEPTED SOLUTION

avatar
Explorer

Hi Alex,

I've resolved the issue. I had been using the wf:X() in the wrong place. Initially I had added an argument for the shell action like ${user} and then set $wf:user() as the value of that argument when submitting the workflow.

I replaced ${user} with the Expression Language Function and the value was resolved automatically and when submitting the workflow I wasn't asked to provide a value for the argument 🙂

View solution in original post

3 REPLIES 3

avatar
Master Collaborator

Hi James,

 

Could you share your XML action script for that SSH action?

 

In general, the following example shows how to pass arguments to your shell (from Oozie docs😞

<workflow-app name="sample-wf" xmlns="uri:oozie:workflow:0.1">
    ...
    <action name="myssjob">
        <ssh>
            <host>foo@bar.com<host>
            <command>YOURCOMMAND</command>
            <args>${wf:user()}</args>
            <args>${wf:lastErrorNode()}</args>
        </ssh>
        <ok to="myotherjob"/>
        <error to="errorcleanup"/>
    </action>
    ...
</workflow-app>

 Note the ${} syntax of the parameter.  If this helps, please accept this as a solution.

 

 

Regards,

Alex

avatar
Master Collaborator

If you are doing this through Hue, please post the generated XML once you submit the job.

avatar
Explorer

Hi Alex,

I've resolved the issue. I had been using the wf:X() in the wrong place. Initially I had added an argument for the shell action like ${user} and then set $wf:user() as the value of that argument when submitting the workflow.

I replaced ${user} with the Expression Language Function and the value was resolved automatically and when submitting the workflow I wasn't asked to provide a value for the argument 🙂