Skip to content

Commit

Permalink
fix main.clj (accept keys to run as arguments)
Browse files Browse the repository at this point in the history
  • Loading branch information
prepor committed May 30, 2018
1 parent 7c27d2a commit ff1bee3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions infra/charts/re_bench/templates/load-data-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ spec:
containers:
- name: {{ .Chart.Name }}
image: "eu.gcr.io/xray2poc/re:{{ .Values.re.image.tag }}"
command: ["lein", "run"]
command: ["lein", "run", ":re.benchmark/loader"]
env:
- name: CONFIG_PATH
value: re/config.bench.edn
value: re/config.prod.edn
- name: KAFKA
value: "{{ .Release.Name }}-kafka:9092"
- name: SCYLLA
Expand Down
8 changes: 0 additions & 8 deletions re/resources/re/config.bench.edn

This file was deleted.

9 changes: 8 additions & 1 deletion re/resources/re/config.prod.edn
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@
"group.id" #duct/env "KAFKA_GROUP"
"auto.offset.reset" "earliest"}
:count 1
:handler #ig/ref :re.handler/decoder}}
:handler #ig/ref :re.handler/decoder}
:re.benchmark/loader {:kafka #ig/ref :re/kafka-producer
:db #ig/ref :re/db
:encoder #ig/ref :re/encoder
:topic "events"
:universes #duct/env ["BENCH_UNIVERSES" Int]
:entities #duct/env ["BENCH_ENTITIES" Int]
:subscription-events #duct/env ["BENCH_SUBSCRIPTION_EVENTS" Int]}}
7 changes: 4 additions & 3 deletions re/src/re/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
(seq (ig/find-derived system :duct/daemon)))

(defn -main [& args]
(let [config (-> (duct/read-config (io/resource (or (System/getenv "CONFIG_PATH")
(let [keys (or (duct/parse-keys args) [:duct/daemon])
config (-> (duct/read-config (io/resource (or (System/getenv "CONFIG_PATH")
"re/config.dev.edn")))
(duct/prep))]
(duct/prep keys))]
(info "Start with config:")
(pprint/pprint config)

;; FIXME we don't use duct/exec here because we want to halt system even if
;; there are no daemons
(let [system (ig/init config)]
(let [system (ig/init config keys)]
(if (has-daemon? system)
(do (duct/add-shutdown-hook ::exec #(ig/halt! system))
(.. Thread currentThread join))
Expand Down

0 comments on commit ff1bee3

Please sign in to comment.