0

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.

Neethu Lalitha
  • 3,031
  • 4
  • 35
  • 60
  • 2
    Hmm... any reason you can't write directly ``?? – Samson Scharfrichter Jul 26 '16 at 13:55
  • Besides, expression `${script_name}` refers to an Oozie *parameter* (as in `` section of Workflow, or in the config file at submit time), not to a local `` that is meant to be passed as-is to the Pig action. – Samson Scharfrichter Jul 26 '16 at 13:58
  • More details about what is a "parameter" in Oozie dialect, in that post: http://stackoverflow.com/questions/38337362/oozie-properties-defined-in-file-referenced-in-global-job-xml-not-visible-in-wo – Samson Scharfrichter Jul 26 '16 at 14:00
  • haha cool.. didnt think it that way. It works. Thanks Samson :) FIX: ` – Neethu Lalitha Jul 26 '16 at 14:01

1 Answers1

0

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>
YoungHobbit
  • 13,254
  • 9
  • 50
  • 73