Making it possible to run one-off square
This commit is contained in:
11
src/clj/auto_ap/jobs/square.clj
Normal file
11
src/clj/auto_ap/jobs/square.clj
Normal file
@@ -0,0 +1,11 @@
|
||||
(ns auto-ap.jobs.square
|
||||
(:gen-class)
|
||||
(:require [auto-ap.square.core :as square]
|
||||
[auto-ap.utils :refer [heartbeat]]
|
||||
[mount.core :as mount]
|
||||
[auto-ap.datomic :refer [conn]]))
|
||||
|
||||
(defn -main [& _]
|
||||
(mount/start (mount/only #{#'conn}))
|
||||
((heartbeat square/upsert-all "square-loading")))
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
[auto-ap.square.core :as square]
|
||||
[auto-ap.background.metrics :as metrics]
|
||||
[auto-ap.background.mail :as mail]
|
||||
[auto-ap.jobs.square :as job-square]
|
||||
[clojure.tools.logging :as log]
|
||||
[config.core :refer [env]]
|
||||
[mount.core :as mount]
|
||||
@@ -85,31 +86,37 @@
|
||||
(mount/stop))
|
||||
|
||||
(defn -main [& _]
|
||||
(let [without (cond-> []
|
||||
(not (env :run-web? )) (into [#'jetty
|
||||
#'jetty-stats])
|
||||
(not (env :run-background?)) (into [#'square/square-loader
|
||||
#'vendor/refresh-vendor-usages-worker
|
||||
#'ledger/touch-broken-ledger-worker
|
||||
#'mail/import-invoices
|
||||
#'ledger/process-txes-worker
|
||||
#'ledger/ledger-reconciliation-worker
|
||||
#'requests/request-listener
|
||||
#'sysco/sysco-invoice-importer
|
||||
#'auto-ap.background.invoices/close-auto-invoices-worker
|
||||
#'gq-clients/current-balance-worker
|
||||
#'yodlee2/import-worker
|
||||
#'yodlee2/account-worker
|
||||
#'intuit/import-worker
|
||||
#'intuit/account-worker
|
||||
#'plaid/import-worker
|
||||
#'migrate/migrate-start]))]
|
||||
(log/info "starting without " without)
|
||||
|
||||
(add-shutdown-hook! shutdown-mount)
|
||||
(start-server :port 9000 :bind "0.0.0.0" #_#_:handler (cider-nrepl-handler))
|
||||
#_(alter-var-root #'nrepl.middleware.print/*print-fn* (constantly clojure.pprint/pprint))
|
||||
(apply mount/start-without without)))
|
||||
|
||||
(let [job (System/getenv "INTEGREAT_JOB")]
|
||||
(cond (= job "square-import-job")
|
||||
(job-square/-main)
|
||||
|
||||
:else
|
||||
(let [without (cond-> []
|
||||
(not (env :run-web? )) (into [#'jetty
|
||||
#'jetty-stats])
|
||||
(not (env :run-background?)) (into [#'square/square-loader
|
||||
#'vendor/refresh-vendor-usages-worker
|
||||
#'ledger/touch-broken-ledger-worker
|
||||
#'mail/import-invoices
|
||||
#'ledger/process-txes-worker
|
||||
#'ledger/ledger-reconciliation-worker
|
||||
#'requests/request-listener
|
||||
#'sysco/sysco-invoice-importer
|
||||
#'auto-ap.background.invoices/close-auto-invoices-worker
|
||||
#'gq-clients/current-balance-worker
|
||||
#'yodlee2/import-worker
|
||||
#'yodlee2/account-worker
|
||||
#'intuit/import-worker
|
||||
#'intuit/account-worker
|
||||
#'plaid/import-worker
|
||||
#'migrate/migrate-start]))]
|
||||
(log/info "starting without " without)
|
||||
|
||||
(add-shutdown-hook! shutdown-mount)
|
||||
(start-server :port 9000 :bind "0.0.0.0" #_#_:handler (cider-nrepl-handler))
|
||||
#_(alter-var-root #'nrepl.middleware.print/*print-fn* (constantly clojure.pprint/pprint))
|
||||
(apply mount/start-without without)))))
|
||||
|
||||
(comment
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user