Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically calculate number of peers #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions test/onyx_starter/jobs/sample_job_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@
(:require [clojure.test :refer [deftest is]]
[com.stuartsierra.component :as component]
[onyx-starter.launcher.submit-sample-job :as submit-sample]
[onyx-starter.workflows.sample-workflow :as workflows]
[onyx-starter.launcher.dev-system :refer [onyx-dev-env]]
[onyx-starter.functions.sample-functions]
[onyx.api]))

(defn count-distinct-tasks [workflow]
(->> workflow
flatten
set
count))

(deftest test-sample-dev-job
;; 7 peers for 7 distinct tasks in the workflow
(let [dev-env (component/start (onyx-dev-env 7))]
(try
(let [distinct-workflows (count-distinct-tasks workflows/workflow)
dev-env (component/start (onyx-dev-env distinct-workflows))]
(try
(let [{:keys [loud-output question-output]} (submit-sample/submit-job dev-env)]
(clojure.pprint/pprint loud-output)
(println)
(clojure.pprint/pprint question-output)
(is (= 11 (count question-output)))
(is (= 11 (count loud-output))))
(finally
(finally
(component/stop dev-env)))))