Search code examples
hadoopoozie

Oozie param tag before the script tag?


Is it possible to use a <param> tag in oozie before the <script> tag.

Like below:

               <param>script_name=${wf:actionData('GetJobParameters')['SCRIPT_NAME']}</param>
                <script>/tmp/abc/hive/${script_name}</script>
                <param>K_NAME=${wf:actionData('GetJobParameters')['K_NAME']}</param>
                <param>P_NAME=${wf:actionData('GetJobParameters')['P_NAME']}</param>
                <param>CNAME=${wf:actionData('GetJobParameters')['C_NAME']}</param>

The reason is my script name should be passed as a paramter and not hardcoded. And this script name is to be taken fron my mysql database like ${wf:actionData('GetJobParameters')['SCRIPT_NAME']}.

Any help is appreciated.


Solution

  • No. You can not do, because Oozie workflow/action xml expects everything in order as defined in the schema.

    Also, Your understanding of the <param> tag also appears to be wrong. It is not for declaring a variable and using it later on. I am guessing you are writing an hive action, <param> are used to pass the <key=value> parameter to the hive job. This is similar to --hivevar for specifying the variables in hive SQL. key is a variable you have used in the hive sql script.

    You can do as mentioned by the @SamsonScharfrichter:

    <script>/tmp/abc/hive/${wf:actionData('GetJobParameters')['SCRIPT_NAME']}</scri‌​pt>