简体   繁体   中英

How to use Java assertion in Hadoop MapReduce java API?

for java program, we can use

java -ea

to enable assertion check. is it available in hadoop command:

hadoop jar some-mapreduce-program.jar org.foo.bar.MainJob ...

is it possible?

Assuming Hadoop 2+, you can set this property in your mapred-site.xml

<property>
    <name>mapreduce.map.java.opts</name>
    <value>-ea</value>
</property>

Alternatively, you can try exporting it in the client opts:

export HADOOP_CLIENT_OPTS="-ea ${HADOOP_CLIENT_OPTS}"
hadoop jar some-mapreduce-program.jar org.foo.bar.MainJob ...

Note that if you are using a cluster, this variable should be set in all nodes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM