Created
February 7, 2015 16:13
-
-
Save lbradstreet/062ef5eb2fc641c8f9a2 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 with-env-peers [env-config peer-config n-peers f] | |
(let [env (onyx.api/start-env env-config) | |
v-peers (onyx.api/start-peers! n-peers peer-config)] | |
(try | |
(f) | |
(finally | |
(doseq [v-peer v-peers] | |
(onyx.api/shutdown-peer v-peer)) | |
(onyx.api/shutdown-env env))))) | |
(with-env-peers | |
env-config peer-config 3 | |
(fn [] | |
(onyx.api/submit-job | |
peer-config | |
{:catalog catalog :workflow workflow | |
:task-scheduler :onyx.task-scheduler/round-robin}) | |
(let [results (doall (repeatedly n-messages (fn [] (<!! out-chan)))) | |
expected (set (map (fn [x] {:n (inc x)}) (range n-messages)))] | |
(fact (set results) => expected) | |
; (fact (last results) => :done) | |
))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment