Skip to content
Browse files

Moved wrong indented print-usage back to global namespace.

  • Loading branch information...
1 parent 603c8f5 commit 66bc6a736ca46b4241ff9aab40ff4d11b3f33438 @r0man r0man committed
Showing with 34 additions and 30 deletions.
  1. +30 −30 src/clojure_hadoop/config.clj
  2. +4 −0 test/clojure_hadoop/test/config.clj
View
60 src/clojure_hadoop/config.clj
@@ -88,14 +88,14 @@
(defmethod conf :map [^Job job key value]
(let [value (as-str value)]
(cond
- (= "identity" value)
- (.setMapperClass job Mapper)
+ (= "identity" value)
+ (.setMapperClass job Mapper)
- (.contains value "/")
- (.set (configuration job) "clojure-hadoop.job.map" value)
+ (.contains value "/")
+ (.set (configuration job) "clojure-hadoop.job.map" value)
- :else
- (.setMapperClass job (Class/forName value)))))
+ :else
+ (.setMapperClass job (Class/forName value)))))
;; The name of the mapper cleanup function as namespace/symbol.
(defmethod conf :map-cleanup [^Job job key value]
@@ -115,17 +115,17 @@
(defmethod conf :reduce [^Job job key value]
(let [value (as-str value)]
(cond
- (= "identity" value)
- (.setReducerClass job Reducer)
+ (= "identity" value)
+ (.setReducerClass job Reducer)
- (= "none" value)
- (.setNumReduceTasks job 0)
+ (= "none" value)
+ (.setNumReduceTasks job 0)
- (.contains value "/")
- (.set (configuration job) "clojure-hadoop.job.reduce" value)
+ (.contains value "/")
+ (.set (configuration job) "clojure-hadoop.job.reduce" value)
- :else
- (.setReducerClass job (Class/forName value)))))
+ :else
+ (.setReducerClass job (Class/forName value)))))
;; The name of the reducer cleanup function as namespace/symbol.
(defmethod conf :reduce-cleanup [^Job job key value]
@@ -218,28 +218,28 @@
(defmethod conf :input-format [^Job job key value]
(let [val (as-str value)]
(cond
- (= "text" val)
- (.setInputFormatClass job TextInputFormat)
+ (= "text" val)
+ (.setInputFormatClass job TextInputFormat)
- (= "seq" val)
- (.setInputFormatClass job SequenceFileInputFormat)
+ (= "seq" val)
+ (.setInputFormatClass job SequenceFileInputFormat)
- :else
- (.setInputFormatClass job (Class/forName value)))))
+ :else
+ (.setInputFormatClass job (Class/forName value)))))
;; The output file format. May be a class name or "text" for
;; TextOutputFormat, "seq" for SequenceFileOutputFormat.
(defmethod conf :output-format [^Job job key value]
(let [val (as-str value)]
(cond
- (= "text" val)
- (.setOutputFormatClass job TextOutputFormat)
+ (= "text" val)
+ (.setOutputFormatClass job TextOutputFormat)
- (= "seq" val)
- (.setOutputFormatClass job SequenceFileOutputFormat)
+ (= "seq" val)
+ (.setOutputFormatClass job SequenceFileOutputFormat)
- :else
- (.setOutputFormatClass job (Class/forName value)))))
+ :else
+ (.setOutputFormatClass job (Class/forName value)))))
;; If true, compress job output files.
(defmethod conf :compress-output [^Job job key value]
@@ -292,10 +292,10 @@
(when-not (even? (count args))
(throw (IllegalArgumentException. "Number of options must be even.")))
(doseq [[k v] (partition 2 args)]
- (conf job (keyword (replace-re #"^:|-" "" k)) v))
+ (conf job (keyword (replace-re #"^:|-" "" k)) v)))
- (defn print-usage []
- (println "Usage: java -cp [jars...] clojure_hadoop.job [options...]
+(defn print-usage []
+ (println "Usage: java -cp [jars...] clojure_hadoop.job [options...]
Required options are:
-input comma-separated input paths
-output output path
@@ -326,5 +326,5 @@ Other available options are:
-compress-output If \"true\", compress job output files
-output-compressor Compression class or \"gzip\",\"bzip2\",\"default\"
-compression-type For seqfiles, compress \"block\",\"record\",\"none\"
-")))
+"))
View
4 test/clojure_hadoop/test/config.clj
@@ -223,3 +223,7 @@
(let [job (Job.)]
(parse-command-line-args job ["replace" "true"])
(is (= (.get (configuration job) "clojure-hadoop.job.replace") "true"))))
+
+(deftest test-print-usage
+ (let [out (with-out-str (print-usage))]
+ (is (re-find #"Usage.*" out))))

0 comments on commit 66bc6a7

Please sign in to comment.
Something went wrong with that request. Please try again.