Skip to content
Browse files

Makes process log more clear (#1312)

  • Loading branch information
dposada authored and nsinkov committed Nov 19, 2019
1 parent 58afaf7 commit d0227e44c665699499cab959273f5d52cb16b582
Showing with 10 additions and 4 deletions.
  1. +10 −4 scheduler/src/cook/kubernetes/controller.clj
@@ -107,6 +107,12 @@
(assoc expected-state-dict :launch-pod [:elided-for-brevity])

(defn prepare-existing-state-dict-for-logging
(-> existing-state-dict
(update-in [:synthesized-state :state] #(or % :missing))
(dissoc :pod)))

(defn pod-has-started
"A pod has started. So now we need to update the status in datomic."
[kcc {:keys [pod] :as existing-state-dictionary}]
@@ -130,12 +136,12 @@
(defn process
"Visit this pod-name, processing the new level-state. Returns the new expected state. Returns
empty dictionary to indicate that the result should be deleted. NOTE: Must be invoked with the lock."
[{:keys [api-client existing-state-map expected-state-map] :as kcc} ^String pod-name]
[{:keys [api-client existing-state-map expected-state-map name] :as kcc} ^String pod-name]
(loop [{:keys [expected-state] :as expected-state-dict} (get @expected-state-map pod-name)
{:keys [synthesized-state pod] :as existing-state-dict} (get @existing-state-map pod-name)]
;; TODO: Remove the printing of existing-state-dict once we test on real kubernetes and get synthesized-pod-state robust.
(log/info "Processing: " pod-name ": ((" (prepare-expected-state-dict-for-logging expected-state-dict)
" ===== " (or (:state synthesized-state) :missing) "///" existing-state-dict "))")
(log/info "In compute cluster" name ", processing pod" pod-name ";"
"expected:" (prepare-expected-state-dict-for-logging expected-state-dict) ","
"existing:" (prepare-existing-state-dict-for-logging existing-state-dict))
; TODO: We added an :expected/starting state to the machine, to represent when a pod is starting. We map instance.status/unknown to that state
; The todo is to add in cases for [:expected/starting *] for those other states.

0 comments on commit d0227e4

Please sign in to comment.
You can’t perform that action at this time.