Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(defn job [state source experiment]
(let [head (format "%d" (get ((keyword source) *experiment-to-subtypeid*) experiment))
value-fmt " %d:%f"
min (ref head)
avg (ref head)
max (ref head)
i (atom 1)
row-worker (fn [row]
(alter min str (format value-fmt @i (:min row)))
(alter avg str (format value-fmt @i (:avg row)))
(alter max str (format value-fmt @i (:max row)))
(swap! i inc)
nil)]
(send printer println+ (format "Agent No.: %d, fetching row" (:no ^*agent*)))
(with-connection db
(with-query-results rs [(str "SELECT min,max,avg FROM " source "_probesetid_expressions WHERE experiment = " experiment "ORDER BY probesetid")]
(dorun (map row-worker rs))))
(send printer println+ (format "Agent No.: %d, sending to writer" (:no ^*agent*)))
(send (:min writer-agents) writeln+ min)
(send (:avg writer-agents) writeln+ avg)
(send (:max writer-agents) writeln+ max)
(send printer println+ (format "Agent No.: %d, incrementing state" (:no ^*agent*)))
(inc state)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.