Skip to content

Commit

Permalink
Merge pull request #77 from seki-seki/add-logging
Browse files Browse the repository at this point in the history
Add some logs
  • Loading branch information
seki-seki authored Apr 10, 2017
2 parents 8341503 + 2f78e04 commit 5235a90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/clj/job_streamer/control_bus/component/dispatcher.clj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
(jobs/save-execution jobs (:db/id execution) new-exec))))))

(defn- dispatch [{:keys [dispatcher-ch datomic]} agt execution-request]
(log/debug "dispatch job to agent" agt)
(ag/execute-job
agt execution-request

Expand All @@ -40,6 +41,7 @@

:on-success
(fn [{:keys [execution-id batch-status start-time] :as res}]
(log/debug "success to dispatch")
(if execution-id
(d/transact datomic
[(merge {:db/id (:request-id execution-request)
Expand All @@ -54,6 +56,7 @@
:job-execution/batch-status :batch-status/abandoned}])))))

(defn submit [{:keys [dispatcher-ch datomic]} execution-request]
(log/debug "submit execution-request " execution-request)
(try
(put! dispatcher-ch execution-request)
(d/transact datomic
Expand All @@ -67,6 +70,7 @@
(when-let [_ (<! submitter-ch)]
(let [undispatched (jobs/find-undispatched jobs)]
(doseq [[execution-request job-bpmn-xml parameter] undispatched]
(log/debug "find undispatched job" execution-request)
(submit dispatcher
{:request-id execution-request
:class-loader-id (:application/class-loader-id
Expand Down
3 changes: 3 additions & 0 deletions src/clj/job_streamer/control_bus/component/jobs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@
(assoc time-monitor :time-monitor/action action)))))))))

(defn- execute-job [{:keys [datomic scheduler] :as jobs} app-name job-name ctx]
(log/debug "execute job " job-name)
(when-let [[app-id job-id] (find-by-name jobs app-name job-name)]
(let [execution-id (d/tempid :db.part/user)
tempids (-> (d/transact
Expand All @@ -696,11 +697,13 @@
:job-execution/job-parameters (pr-str (or (:edn ctx) {}))}
[:db/add job-id :job/executions execution-id]])
:tempids)]
(log/debug "set execution-id " (-> tempids vals first))
(when-let [time-monitor (d/pull datomic
'[{:job/time-monitor
[:time-monitor/duration
{:time-monitor/action [:db/ident]}]}]
job-id)]
(log/debug "set time-monitor")
(scheduler/time-keeper
scheduler
(d/resolve-tempid datomic tempids execution-id)
Expand Down

0 comments on commit 5235a90

Please sign in to comment.