You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@oozie.apache.org by "C 4.5" <cf...@gmail.com> on 2014/02/02 21:29:05 UTC

Problem passing property to Oozie java action

I want to pass to a Oozie java action some configuration information needed
to the application.

I have looked at oozie documentation and various pointers I've found.

Seems like there are several methods that could achieve what I need, and
I've tried several of them out but so far no luck yet.
I'd appreciate if anyone has some further suggestions.

I have tried with: 1.) oozie.mapred.child.java.opts, 2.)
oozie.mapred.child.env, 3.) -D

Below I am posting all the information about what I am doing.
(I set properties in the workflow individually even if the code below
contains all the various methods I tried in a single file .)

None of these methods seem to succeed.

Thanks.

===  Java code:

public class TestOozie {

  public static void main(String[] args) throws Exception {
      final String prop1 = System.getenv("INFO");

      final String prop2 = System.getProperty("INFO");

     If (prop1 == null && prop2 == null) {
           throw new RuntimeException("failed to get value");
     }
     ...
  }
}

===
Oozie version:
> oozie version
> Oozie client build version: 3.3.2-mapr

===
<workflow-app xmlns="uri:oozie:workflow:0.2" name="map-reduce-wf">
   <start to="TestOozie"/>
   <action name="TestOozie">
   <java>
      <job-tracker>${jobTracker}</job-tracker>
      <name-node>${nameNode}</name-node>
      <configuration>
<property>
    <name>oozie.mapred.child.java.opts</name>
    <value>INFO=foo1</value>
</property>
<property>
    <name>oozie.mapred.child.env</name>
    <value>INFO=foo2</value>
</property>
<property>
            <name>mapred.job.queue.name</name>
            <value>${queueName}</value>
         </property>
         <property>
            <name>INFO</name>
            <value>foo3</value>
         </property>
      </configuration>
      <main-class>TestOozie</main-class>
      <java-opts>-DINFO=foo4</java-opts>
   </java>
   <ok to="end"/>
   <error to="killWorkflow"/>
   </action>

   <kill name="killWorkflow">
      <message>"Killed job due to error:
${wf:errorMessage(wf:lastErrorNode())}"</message>
   </kill>
   <end name="end" />
</workflow-app>

Re: Problem passing property to Oozie java action

Posted by Mohammad Islam <mi...@yahoo.com>.
Did you try with <arg> ? If you have multiple arguments, use as many <arg> tags.

java-opts and child.env for different purpose.

Hope this will help.




On Monday, February 3, 2014 1:48 AM, C 4.5 <cf...@gmail.com> wrote:
 
I want to pass to a Oozie java action some configuration information needed
to the application.

I have looked at oozie documentation and various pointers I've found.

Seems like there are several methods that could achieve what I need, and
I've tried several of them out but so far no luck yet.
I'd appreciate if anyone has some further suggestions.

I have tried with: 1.) oozie.mapred.child.java.opts, 2.)
oozie.mapred.child.env, 3.) -D

Below I am posting all the information about what I am doing.
(I set properties in the workflow individually even if the code below
contains all the various methods I tried in a single file .)

None of these methods seem to succeed.

Thanks.

===  Java code:

public class TestOozie {

  public static void main(String[] args) throws Exception {
      final String prop1 = System.getenv("INFO");

      final String prop2 = System.getProperty("INFO");

     If (prop1 == null && prop2 == null) {
           throw new RuntimeException("failed to get value");
     }
     ...
  }
}

===
Oozie version:
> oozie version
> Oozie client build version: 3.3.2-mapr

===
<workflow-app xmlns="uri:oozie:workflow:0.2" name="map-reduce-wf">
   <start to="TestOozie"/>
   <action name="TestOozie">
   <java>
      <job-tracker>${jobTracker}</job-tracker>
      <name-node>${nameNode}</name-node>
      <configuration>
<property>
    <name>oozie.mapred.child.java.opts</name>
    <value>INFO=foo1</value>
</property>
<property>
    <name>oozie.mapred.child.env</name>
    <value>INFO=foo2</value>
</property>
<property>
            <name>mapred.job.queue.name</name>
            <value>${queueName}</value>
         </property>
         <property>
            <name>INFO</name>
            <value>foo3</value>
         </property>
      </configuration>
      <main-class>TestOozie</main-class>
      <java-opts>-DINFO=foo4</java-opts>
   </java>
   <ok to="end"/>
   <error to="killWorkflow"/>
   </action>

   <kill name="killWorkflow">
      <message>"Killed job due to error:
${wf:errorMessage(wf:lastErrorNode())}"</message>
   </kill>
   <end name="end" />
</workflow-app>