Skip to content

Instantly share code, notes, and snippets.

@llasram
Created February 20, 2012 02:10
Show Gist options
  • Save llasram/1867247 to your computer and use it in GitHub Desktop.
Save llasram/1867247 to your computer and use it in GitHub Desktop.
Cascalog debugging helper
(defn compile-and-dot
"Debugging helper. Compile a flow, print the steps, and write out the DOT
files for the flow operations and MR job steps."
[& args]
(let [^Flow flow (apply c/compile-flow args), name (.getName flow),
flow-path (str name "-flow.dot"), steps-path (str name "-steps.dot")]
(returning nil
(doseq [step (.getSteps flow)]
(prn step))
(doto flow
(.writeDOT flow-path)
(.writeStepsDOT steps-path)))))
(defmacro debug-flows
"Generate debugging information for flows run in the argument body."
[& body]
`(with-redefs [?- compile-and-dot]
~@body))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment