Created
July 17, 2014 17:12
-
-
Save BenjyO238/6aae961f81bf565cbc8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn get-pids-for-day [fut-func f pp] ; add date rangepp | |
"fut-func is apply-query-to-pid, f is p-day-qry, pp partitioned-pids. | |
Iterate through each n pids making futures for n pids (batch size)" | |
(let [results []] ;vec inside vec to mirror readings/days | |
(for [pid-pool pp] | |
(let [fut (fut-func pid-pool f)] | |
(while (not (every? future-done? fut)) | |
(Thread/sleep 500) | |
(prn (str "waiting for current future to finish..." (first pid-pool)))) | |
(conj results (apply combine-readings (map #(identity @ %) fut))))))) | |
;create lazy-seq | |
(def test-run (get-pids-for-day apply-query-to-pid p-day-qry-mini tinyer-pid-pool)) | |
(spit "t2t.txt" (prn test-run)) ; or | |
(spit "t2t.txt" (map #(println %) test-run)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment