Question

My problem is that I am unsuccessfully finding a property entered from the command line in an Oozie job. This is how I start the oozie job :

$ oozie job -config /home/mruser/conf/mapreduce.properties -Dsample.property.filename=/path/to/file/samplefile.txt -run -oozie http://server:11000/oozie

and this is the relevant code snippet from the java program.

Configuration conf = new Configuration();
String configurationLocation = System.getProperty("oozie.action.conf.xml");
Path localConfigurationPath = new Path(configurationLocation);
conf.addResource(localConfigurationPath);
Job job = new Job(conf, "Sample oozie data load");

Configuration.dumpConfiguration(conf, new BufferedWriter(new OutputStreamWriter(System.out)));
String samplePropertyFilenameFromJobConfig = job.getConfiguration().get("sample.property.filename");
String samplePropertyFilenameFromProperty = System.getProperty("sample.property.filename");

In the above code "samplePropertyFilenameFromJobConfig" and "samplePropertyFilenameFromProperty" are both null. Also I could not find my property in the output of "Configuration.dumpConfiguration()".

When I find my job in the Oozie UI however, and I click on the "Job Configuration" tab I see

<property>
  <name>sample.resolution.filename</name>
  <value>/path/to/file/samplefile.txt</value>
</property>

Please note that when I bring up the specific action that executed and click on the "Action Configuration" tab, I do NOT see this configuration.

How do I get to this particular property in a Java program running under Oozie?

Was it helpful?

Solution

I figured out what I was missing. In workflow.xml file I needed to include :

<property>
    <name>sample.property.filename</name>
    <value>${wf:conf("sample.property.filename")}</value>
</property>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top