Skip to content

Instantly share code, notes, and snippets.

View eslick's full-sized avatar

Ian Eslick eslick

View GitHub Profile
@eslick
eslick / step-example.clj
Created February 23, 2011 21:26
clojure-hadoop shuffle component example
;; hadoop -jar compass.jar -step count-users
;; hadoop -jar compass.jar -flow count-user-flow
(defn map-count-users [k fmap]
(ctx/increment-counter "Compass" "rows")
(ctx/increment-counter "Compass" (format "src=%s" (:src (:userinfo fmap))))
[])
(defn count-users-total [job]
(job-counter-value job "Compass" "rows"))
@eslick
eslick / gist:840823
Created February 23, 2011 17:56
clojure-hadoop shuffle component example
;; Pseudocode example for guards in flows
(def *guard-time* [:days 7])
(defmacro with-resource-time-guard
[[name timespec inhibit?] &body ]
`(let [resource# (get-resource name)]
(cond (and ~inhibit? (resource-value resource#))
(resource-value resource#)
(or (resource-expired? resource# ~timespec)
@eslick
eslick / gist:840750
Created February 23, 2011 17:20
clojure-hadoop shuffle component example
(define-sink :null []
:reduce-writer wrap/clojure-writer
:output-format NullOutputFormat
:output-key Text
:output-value Text)
@eslick
eslick / gist:840748
Created February 23, 2011 17:20
clojure-hadoop shuffle component example
(define-shuffle :clojure []
:map-writer wrap/clojure-writer
:reduce-reader wrap/clojure-reduce-reader)
@eslick
eslick / gist:840745
Created February 23, 2011 17:18
clojure-hadoop source component example
(define-source :hbase [table constraints]
:input-format TableInputFormat
:map-reader hbase-table-reader-latest
:configure (fn [job]
(configure-hbase job table constraints)))