Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oozie String wf:errorCode(String node) how to check empty?

Tags:

hadoop

oozie

I have an action node named 'CW', after that I placed a Decision Node to check if 'CW' returns error or not.... how should I write the predicate?

I tried:

${ wf:errorCode('CW') eq '' } then go to Y

${ wf:errorCode('CW') != '' } then go to N

Although it return empty string (no error), but it always goes to N. Any advise? Thanks!!

like image 212
Kevin Avatar asked Feb 15 '23 17:02

Kevin


2 Answers

Try

${not empty wf:errorCode('CW')} 

to detect failures

like image 99
Paul Praet Avatar answered Feb 17 '23 05:02

Paul Praet


This is the only method for checking an empty string that worked for me.

<decision name='decision-action'>
    <switch>
        <case to='success-action'>${firstNotNull(wf:lastErrorNode(), 'no error') eq 'no error'}</case>
        <default to='failed-action' />
    </switch>
</decision>

So, to relate this answer directly to the question, this conditional

${firstNotNull(wf:errorCode('CW'), 'no error') eq 'no error}

should map to Y.

like image 30
Russell McEntyre Avatar answered Feb 17 '23 07:02

Russell McEntyre