<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to read the parameter value in mapper code passed from oozie workflow in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-read-the-parameter-value-in-mapper-code-passed-from/m-p/30175#M6756</link>
    <description>&lt;P&gt;Hi Harsh,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The information provided for Java Action is clear to me. But I have doubt regarding MapReduce action.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using only Mapreduce action for my workflow and I am placing only my Mapper class &amp;amp; Reducer Class in the .jar file. I want to pass all the properties and parameters through Oozie workflow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now&amp;nbsp;can I get the value of the "var" variable, i.e. "2", in my Mapper using the below code in my mapper class.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="1" color="#7f0055"&gt;&lt;STRONG&gt;protected&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT size="1" color="#7f0055"&gt;void&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="1"&gt; setup(&lt;U&gt;Context&lt;/U&gt; context) &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="1" color="#7f0055"&gt;throws&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="1"&gt; IOException,InterruptedException {&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;Configuration conf = context.getConfiguration();&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="1" color="#0000c0"&gt;&lt;FONT size="1" color="#0000c0"&gt;var_val&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1"&gt; = conf.get(&lt;/FONT&gt;&lt;FONT size="1" color="#2a00ff"&gt;&lt;FONT size="1" color="#2a00ff"&gt;"var"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jul 2015 13:43:52 GMT</pubDate>
    <dc:creator>Anishsk10</dc:creator>
    <dc:date>2015-07-28T13:43:52Z</dc:date>
    <item>
      <title>How to read the parameter value in mapper code passed from oozie workflow?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-read-the-parameter-value-in-mapper-code-passed-from/m-p/30083#M6754</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running my oozie workflow through command prompt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assigning value to a parameter "var" in my my workflow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;var&amp;lt;/name&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;value&amp;gt;2&amp;lt;/value&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/property&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now how can i access the variable value in my java Mapper Program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will the below metioned work for me:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="1" color="#7f0055"&gt;&lt;STRONG&gt;protected&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT size="1" color="#7f0055"&gt;void&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="1"&gt; setup(&lt;U&gt;Context&lt;/U&gt; context) &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="1" color="#7f0055"&gt;throws&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="1"&gt; IOException,InterruptedException {&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;Configuration conf = context.getConfiguration();&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="1" color="#0000c0"&gt;&lt;FONT size="1" color="#0000c0"&gt;var_val&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1"&gt; = conf.get(&lt;/FONT&gt;&lt;FONT size="1" color="#2a00ff"&gt;&lt;FONT size="1" color="#2a00ff"&gt;"var"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 09:35:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-read-the-parameter-value-in-mapper-code-passed-from/m-p/30083#M6754</guid>
      <dc:creator>Anishsk10</dc:creator>
      <dc:date>2022-09-16T09:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the parameter value in mapper code passed from oozie workflow</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-read-the-parameter-value-in-mapper-code-passed-from/m-p/30084#M6755</link>
      <description>Yes, that will work if you use a map-reduce action type to define that&lt;BR /&gt;configuration property. If you are using a java action type instead, you&lt;BR /&gt;will also need to load the configuration in the driver explicitly:&lt;BR /&gt;&lt;A href="http://archive.cloudera.com/cdh5/cdh/5/oozie/WorkflowFunctionalSpec.html#a3.2.7_Java_Action" target="_blank"&gt;http://archive.cloudera.com/cdh5/cdh/5/oozie/WorkflowFunctionalSpec.html#a3.2.7_Java_Action&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;"""&lt;BR /&gt;&lt;BR /&gt;A java action can create a Hadoop configuration for interacting with a&lt;BR /&gt;cluster (e.g. launching a map-reduce job). Oozie prepares a Hadoop&lt;BR /&gt;configuration file which includes the environments site configuration files&lt;BR /&gt;(e.g. hdfs-site.xml, mapred-site.xml, etc) plus the properties added&lt;BR /&gt;to the section&lt;BR /&gt;of the java action. The Hadoop configuration file is made available as a&lt;BR /&gt;local file to the Java application in its running directory. It can be&lt;BR /&gt;added to the java actions Hadoop configuration by referencing the system&lt;BR /&gt;property: oozie-action.conf.xml . For example:&lt;BR /&gt;&lt;BR /&gt;// loading action conf prepared by Oozie&lt;BR /&gt;Configuration actionConf = new Configuration(false);&lt;BR /&gt;actionConf.addResource(new Path("file:///",&lt;BR /&gt;System.getProperty("oozie.action.conf.xml")));&lt;BR /&gt;&lt;BR /&gt;If oozie.action.conf.xml is not added then the job will pick up the&lt;BR /&gt;mapred-default properties and this may result in unexpected behaviour. For&lt;BR /&gt;repeated configuration properties later values override earlier ones.&lt;BR /&gt;"""</description>
      <pubDate>Mon, 27 Jul 2015 10:03:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-read-the-parameter-value-in-mapper-code-passed-from/m-p/30084#M6755</guid>
      <dc:creator>Harsh J</dc:creator>
      <dc:date>2015-07-27T10:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the parameter value in mapper code passed from oozie workflow</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-read-the-parameter-value-in-mapper-code-passed-from/m-p/30175#M6756</link>
      <description>&lt;P&gt;Hi Harsh,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The information provided for Java Action is clear to me. But I have doubt regarding MapReduce action.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using only Mapreduce action for my workflow and I am placing only my Mapper class &amp;amp; Reducer Class in the .jar file. I want to pass all the properties and parameters through Oozie workflow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now&amp;nbsp;can I get the value of the "var" variable, i.e. "2", in my Mapper using the below code in my mapper class.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="1" color="#7f0055"&gt;&lt;STRONG&gt;protected&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT size="1" color="#7f0055"&gt;void&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="1"&gt; setup(&lt;U&gt;Context&lt;/U&gt; context) &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="1" color="#7f0055"&gt;throws&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="1"&gt; IOException,InterruptedException {&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;Configuration conf = context.getConfiguration();&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="1" color="#0000c0"&gt;&lt;FONT size="1" color="#0000c0"&gt;var_val&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1"&gt; = conf.get(&lt;/FONT&gt;&lt;FONT size="1" color="#2a00ff"&gt;&lt;FONT size="1" color="#2a00ff"&gt;"var"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2015 13:43:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-read-the-parameter-value-in-mapper-code-passed-from/m-p/30175#M6756</guid>
      <dc:creator>Anishsk10</dc:creator>
      <dc:date>2015-07-28T13:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the parameter value in mapper code passed from oozie workflow</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-read-the-parameter-value-in-mapper-code-passed-from/m-p/30177#M6757</link>
      <description>Yes, do you not see it working?&lt;BR /&gt;&lt;BR /&gt;You'll need to pass the XML property via the workflow.xml under the&lt;BR /&gt;action's configuration section.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Jul 2015 14:06:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-read-the-parameter-value-in-mapper-code-passed-from/m-p/30177#M6757</guid>
      <dc:creator>Harsh J</dc:creator>
      <dc:date>2015-07-28T14:06:05Z</dc:date>
    </item>
  </channel>
</rss>

