Skip to main content
_James_
Gold ⭐️
Sep 15, 2020 12:07 PM UTC
Solved

Using Oozie Worfklow Expression Language Functions in Hue

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? 

_James_
_James_Answer
Gold ⭐️
Sep 17, 2020 8:17 AM UTC

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 🙂

3 replies

aakulov
Platinum ⭐️
Platinum ⭐️
Sep 15, 2020 5:43 PM UTC

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

Translate
aakulov
Platinum ⭐️
Platinum ⭐️
Sep 16, 2020 7:21 PM UTC

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

Translate
_James_
_James_AuthorAnswer
Gold ⭐️
Sep 17, 2020 8:17 AM UTC

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 🙂

Translate