Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8665475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:29:19+00:00 2026-06-12T17:29:19+00:00

I am trying to chain some Streaming jobs( jobs written in Python). I did

  • 0

I am trying to chain some Streaming jobs( jobs written in Python). I did it, but I have problem with -D commands. Here is the code,

public class OJs extends Configured implements Tool
{
public int run( String[] args) throws Exception
{
    //DOMINATION
    Path domin      = new Path( "diploma/join.txt");
    //dominationm.py
    Path domout     = new Path( "mapkeyout/");
    //dominationr.py

    String[] dom = new String[]
    {
        "-D mapred.reduce.tasks=0",
        "-file"     , "/home/hduser/optimizingJoins/dominationm.py" ,
        "-mapper"   , "dominationm.py"                              ,
        "-file"     , "/home/hduser/optimizingJoins/dominationr.py" ,
        "-reducer"  , "dominationr.py",         
        "-input"    , domin.toString()                              ,
        "-output"   , domout.toString()
    };
    JobConf domConf = new StreamJob().createJob( dom);
    //run domination job
    JobClient.runJob( domConf);
    return 0;
}//end run

public static void main( String[] args) throws Exception
{
    int res = ToolRunner.run( new Configuration(), new OJs(), args);
    System.exit( res);
}//end main
}//end OJs

My problem is with command “-D mapred.reduce.tasks=0”. I get this error,

ERROR streaming.StreamJob: Unrecognized option: -D...

where the … include any possible syntax combination, i.e.

"-D mapred.reduce.tasks=0"
"-Dmapred.reduce.tasks=0"
"-D", "mapred.reduce.tasks=0"
"-D", "mapred.reduce.tasks=", "0"
" -D mapred.reduce.tasks=0"

etc.

When I have a space before -D, then this command is ignored. I don’t have the number of reducers I specified. When I don’t have this space, I get the error I mentioned.

What am I doing wrong?

EDIT

Substituting -D option with -jobconf doesn’t solve the problem. Here is the whole error output,

 Warning: $HADOOP_HOME is deprecated.

    12/10/04 00:25:02 ERROR streaming.StreamJob: Unrecognized option: -jobconf mapred.reduce.tasks=0
    Usage: $HADOOP_HOME/bin/hadoop jar \
          $HADOOP_HOME/hadoop-streaming.jar [options]

    Options:
   -input    <path>     DFS input file(s) for the Map step

   -output   <path>     DFS output directory for the Reduce step

   -mapper   <cmd|JavaClassName>      The streaming command to run

   -combiner <cmd|JavaClassName> The streaming command to run

   -reducer  <cmd|JavaClassName>      The streaming command to run

   -file     <file>     File/dir to be shipped in the Job jar file

   -inputformat TextInputFormat(default)|SequenceFileAsTextInputFormat|JavaClassName Optional.

   -outputformat TextOutputFormat(default)|JavaClassName  Optional.

   -partitioner JavaClassName  Optional.

   -numReduceTasks <num>  Optional.

   -inputreader <spec>  Optional.

   -cmdenv   <n>=<v>    Optional. Pass env.var to streaming commands

   -mapdebug <path>  Optional. To run this script when a map task fails 

   -reducedebug <path>  Optional. To run this script when a reduce task fails 

   -io <identifier>  Optional.

   -verbose

   Generic options supported are

   -conf <configuration file>     specify an application configuration file

   -D <property=value>            use value for given property

   -fs <local|namenode:port>      specify a namenode

   -jt <local|jobtracker:port>    specify a job tracker

   -files <comma separated list of files>    specify comma separated files to be copied to the map reduce cluster

   -libjars <comma separated list of jars>    specify comma separated jar files to include in the classpath.

   -archives <comma separated list of archives>    specify comma separated archives to be unarchived on the compute machines.

   The general command line syntax is
   bin/hadoop command [genericOptions] [commandOptions]


   For more details about these options:

   Use $HADOOP_HOME/bin/hadoop jar build/hadoop-streaming.jar -info

   Exception in thread "main" java.lang.IllegalArgumentException: 
    at org.apache.hadoop.streaming.StreamJob.fail(StreamJob.java:549)
    at org.apache.hadoop.streaming.StreamJob.exitUsage(StreamJob.java:486)
    at org.apache.hadoop.streaming.StreamJob.parseArgv(StreamJob.java:246)
    at org.apache.hadoop.streaming.StreamJob.createJob(StreamJob.java:143)
    at OJs.run(OJs.java:135)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
    at OJs.main(OJs.java:183)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:156)

Moreover, I can’t understand, why when I run a job straight with Streaming, Streaming recognizes -D option, but when I run a job with Streaming through JobClient, -D option recognition fails. Is a problem of Streaming or a problem of sun.reflect? Where is sun.reflect package in Ubuntu?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:29:21+00:00Added an answer on June 12, 2026 at 5:29 pm

    To begin with, the line

    ..."-D mapred.reduce.tasks=0"...
    

    should be written as

    ..."-D", "mapred.reduce.tasks=0"...
    

    This is the standard pattern of commands,

    "-commandname", "value"
    

    To continue, a program generally may accepts or not some arguments. These arguments in Hadoop context are called options. There are two kinds of them, generic and streaming, job specific. The generic options are handled from GenericOptionsParser. Job specific options in the context of Hadoop Streaming are handled from StreamJob.

    So, the way -D option is set in the code of the initial question, is wrong. This is because -D is a generic option. StreamJob can’t handle generic options. StreamJob can handle -jobconf however, which is a job specific option. So the line

    ..."-D", "mapred.reduce.tasks=0"...
    

    is writtern correctly as

    ..."-jobconf", "mapred.reduce.tasks=0"...
    

    With -jobconf this warning is raised,

    WARN streaming.StreamJob: -jobconf option is deprecated, please use -D instead.
    

    To avoid this warning -D option is needed and consequently a GenericOptionsParser is needed to parse -D option.

    To move on, when someone runs a streaming job using the command

    bin/hadoop jar /usr/local/hadoop/contrib/streaming/hadoop-streaming-*.jar [ generic options] [ streaming( job specific) options]
    

    what really happens? Why in this case there is no problem? In this case, both generic and job specific options are parsed properly. This is possible because of the Tool interface that takes care of the generic options through GenericOptionsParser. The job specific options are handled from the StreamJob() inside hadoop-streaming-*.jar.

    Indeed hadoop-streaming-*.jar has a file “HadoopStreaming.java” responsible for jobs submitted the way above. The HadoopStreaming class calls ToolRunner.run() with two arguments. The first argument is a new StreamJob object and the second consists of all the command line options i.e. [ generic options] and [ streaming( job specific) options]. The GenericOptionsParser separates generic from job specific options by parsing only the generic ones. Then, the GenericOptionsParser returns the rest of the options i.e. job specific which are parsed from the StreamJob(). StreamJob is invoked through Tool.run( [ job specific args]) where Tool = StreamJob. See this and this to have an intuition why Tool = StreamJob.

    In conclusion,

    GenericOptionsParser -> generic options,

    StreamJob -> streaming( job specific) options.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to encode some chains to MD5 but I have noticed that: For
I have been trying to tackle this problem , but I am having difficulty
I am trying to setup my swap chain Buffer but I get the following
I have a function with a chain of filters in jQuery. I am trying
This probably sounds harder than it is. I'm actually trying to chain some animations
I have a chain of asynchronous events that i want to execute, some of
I am new to Scala, trying to integrate some existing Java code with Scala-specific
Okay, I'm trying to be clear on this one... I have some insliding boxes,
I've been trying to chain Arel queries using scopes, instead of just using some
I have some classes that i'd like chain methods of to provide a fluent

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.