Feed gizmos with proper data

Feed gizmos with proper data

--- frontend/src/faceboard/views/boards/people/card_extended_info.cljs
+++ frontend/src/faceboard/views/boards/people/card_extended_info.cljs
@@ -28,11 +28,10 @@
 (defn has-socials? [person]
   (not (zero? (count (person/socials person)))))

-(defn has-icon? [social]
-  (if (str/contains? social "|") 0 1))
-
 (defn sort-social-icons-first [socials]
-  (sort #(compare (has-icon? %) (has-icon? %2)) socials))
+  (let [has-icon? #(str/contains? % "|")
+        priority #(if (has-icon? %) 0 1)]
+    (sort #(compare (priority %) (priority %2)) socials)))

 (defcomponent social-section-item-component [data _ _]
   (render [_]
@@ -55,7 +54,7 @@
           about (if need-placeholder? person/about-placeholder (person/about person))
           about-gizmo {:descriptor about-gizmo-descriptor
                        :state      gizmo
-                       :content    {:person person}}]
+                       :data       {:person person}}]
       (dom/div {:class (str "extended-info-section about clearfix" (if need-placeholder? " has-placeholder"))}
         (if editing?
           (om/build gizmo-component about-gizmo))
@@ -71,7 +70,7 @@
           email (if need-placeholder? person/email-placeholder (person/email person))
           contact-gizmo {:descriptor contact-gizmo-descriptor
                          :state      gizmo
-                         :content    {:person person}}]
+                         :data       {:person person}}]
       (dom/div {:class (str "extended-info-section contact clearfix" (if need-placeholder? " has-placeholder"))}
         (if editing?
           (om/build gizmo-component contact-gizmo))
@@ -92,7 +91,7 @@
           tags (if need-placeholder? person/tags-placeholder (person/tags person))
           tags-gizmo {:descriptor tags-gizmo-descriptor
                       :state      gizmo
-                      :content    {:person person
+                      :data       {:person person
                                    :people people}}]
       (dom/div {:class (str "extended-info-section tags clearfix" (if need-placeholder? " has-placeholder"))}
         (if editing?
@@ -108,7 +107,7 @@
           socials (if need-placeholder? person/socials-placeholder (sort-social-icons-first (person/socials person)))
           social-gizmo {:descriptor social-gizmo-descriptor
                         :state      gizmo
-                        :content    {:person person}}]
+                        :data       {:person person}}]
       (dom/div {:class (str "extended-info-section social clearfix" (if need-placeholder? " has-placeholder"))}
         (if editing?
           (om/build gizmo-component social-gizmo))


CMR-3559: Fixed access control root route to return the correct home page with documentation

--- access-control-app/src/cmr/access_control/api/routes.clj
+++ access-control-app/src/cmr/access_control/api/routes.clj
@@ -310,8 +310,6 @@
 (defn- build-routes [system]
   (routes
     (context (:relative-root-url system) []
-      ;; for NGAP deployment health check
-      (GET "/" {} {:status 200})
       admin-api-routes

       ;; Add routes for API documentation


Remove some dead code.

Remove some dead code.

--- src/algebolic/expression/interpreter.clj
+++ src/algebolic/expression/interpreter.clj
@@ -44,36 +44,3 @@
   [expr vars coords]
   (let [jexpr ^JExpr (->jexpr vars expr)]
     (Evaluator/evaluateList jexpr coords)))
-
-;(defprotocol Eval
-;  (ev [expr coords]))
-;
-;(defrecord Pl [a1 a2]
-;  Eval
-;  (ev [expr coords] (+ (ev a1 coords) (ev a2 coords))))
-;
-;(defrecord Ti [a1 a2]
-;  Eval
-;  (ev [expr coords] (* (ev a1 coords) (ev a2 coords))))
-;
-;(defrecord Co [c]
-;  Eval
-;  (ev [expr coords] c))
-;
-;(defrecord Va [i]
-;  Eval
-;  (ev [expr coords] (nth coords i)))
-;
-;(defn to-eval
-;  [^APersistentVector var-list expr]
-;  (cond
-;    (symbol? expr) (Va. (.indexOf var-list expr))
-;    (number? expr) (Co. expr)
-;    true (case (nth expr 0)
-;           :plus (Pl. (to-eval var-list (nth expr 1)) (to-eval var-list (nth expr 2)))
-;           :times (Ti. (to-eval var-list (nth expr 1)) (to-eval var-list (nth expr 2))))))
-;
-;(defn evaluate-p
-;  [expr vars coords]
-;  (let [eval-expr (to-eval vars expr)]
-;    (mapv (fn [x] (ev eval-expr x)) coords)))


read-storm-conf is using storage now

read-storm-conf is using storage now

--- src/clj/backtype/storm/daemon/nimbus.clj
+++ src/clj/backtype/storm/daemon/nimbus.clj
@@ -60,13 +60,12 @@
 (defn inbox [nimbus]
   (master-inbox (:conf nimbus)))

-(defn- read-storm-conf [conf storm-id]
-  (let [stormroot (master-stormdist-root conf storm-id)]
+(defn- read-storm-conf [storage conf storm-id]
+  (let [stormroot (nimbus-storage-stormdist-root storm-id)]
     (merge conf
            (Utils/deserialize
-            (FileUtils/readFileToByteArray
-             (File. (master-stormconf-path stormroot))
-             )))))
+            (IOUtils/toByteArray
+             (.open storage (master-stormconf-path stormroot)))))))

 (defn set-topology-status! [nimbus storm-id status]
   (let [storm-cluster-state (:storm-cluster-state nimbus)]
@@ -83,7 +82,7 @@
   (fn [kill-time]
     (let [delay (if kill-time
                   kill-time
-                  (get (read-storm-conf (:conf nimbus) storm-id)
+                  (get (read-storm-conf (:storage nimbus) (:conf nimbus) storm-id)
                        TOPOLOGY-MESSAGE-TIMEOUT-SECS))]
       (delay-event nimbus
                    storm-id
@@ -97,7 +96,7 @@
   (fn [time num-workers executor-overrides]
     (let [delay (if time
                   time
-                  (get (read-storm-conf (:conf nimbus) storm-id)
+                  (get (read-storm-conf (:storage nimbus) (:conf nimbus) storm-id)
                        TOPOLOGY-MESSAGE-TIMEOUT-SECS))]
       (delay-event nimbus
                    storm-id
@@ -312,8 +311,9 @@

 (defn read-topology-details [nimbus storm-id]
   (let [conf (:conf nimbus)
+        storage (:storage nimbus)
         storm-base (.storm-base (:storm-cluster-state nimbus) storm-id nil)
-        topology-conf (read-storm-conf conf storm-id)
+        topology-conf (read-storm-conf storage conf storm-id)
         topology (read-storm-topology conf storm-id)
         executor->component (->> (compute-executor->component nimbus storm-id)
                                  (map-key (fn [[start-task end-task]]
@@ -404,9 +404,10 @@

 (defn- compute-executors [nimbus storm-id]
   (let [conf (:conf nimbus)
+        storage (:storage nimbus)
         storm-base (.storm-base (:storm-cluster-state nimbus) storm-id nil)
         component->executors (:component->executors storm-base)
-        storm-conf (read-storm-conf conf storm-id)
+        storm-conf (read-storm-conf storage conf storm-id)
         topology (read-storm-topology conf storm-id)
         task->component (storm-task-info topology storm-conf)]
     (->> (storm-task-info topology storm-conf)
@@ -420,9 +421,10 @@

 (defn- compute-executor->component [nimbus storm-id]
   (let [conf (:conf nimbus)
+        storage (:storage nimbus)
         executors (compute-executors nimbus storm-id)
         topology (read-storm-topology conf storm-id)
-        storm-conf (read-storm-conf conf storm-id)
+        storm-conf (read-storm-conf storage conf storm-id)
         task->component (storm-task-info topology storm-conf)
         executor->component (into {} (for [executor executors
                                            :let [start-task (first executor)
@@ -694,7 +696,8 @@
   {:pre [(#{:active :inactive} topology-initial-status)]}
   (let [storm-cluster-state (:storm-cluster-state nimbus)
         conf (:conf nimbus)
-        storm-conf (read-storm-conf conf storm-id)
+        storage (:storage nimbus)
+        storm-conf (read-storm-conf storage conf storm-id)
         topology (system-topology! storm-conf (read-storm-topology conf storm-id))
         num-executors (->> (all-components topology) (map-val num-start-executors))]
     (log-message "Activating " storm-name ": " storm-id)
@@ -1007,10 +1010,10 @@
         (to-json (:conf nimbus)))

       (^String getTopologyConf [this ^String id]
-        (to-json (read-storm-conf conf id)))
+        (to-json (read-storm-conf storage conf id)))

       (^StormTopology getTopology [this ^String id]
-        (system-topology! (read-storm-conf conf id) (read-storm-topology conf id)))
+        (system-topology! (read-storm-conf storage conf id) (read-storm-topology conf id)))

       (^StormTopology getUserTopology [this ^String id]
         (read-storm-topology conf id))
@@ -1056,7 +1059,7 @@

       (^TopologyInfo getTopologyInfo [this ^String storm-id]
         (let [storm-cluster-state (:storm-cluster-state nimbus)
-              task->component (storm-task-info (read-storm-topology conf storm-id) (read-storm-conf conf storm-id))
+              task->component (storm-task-info (read-storm-topology conf storm-id) (read-storm-conf storage conf storm-id))
               base (.storm-base storm-cluster-state storm-id nil)
               assignment (.assignment-info storm-cluster-state storm-id nil)
               beats (.executor-beats storm-cluster-state storm-id (:executor->node+port assignment))


Create Temporary Log-in for event page

Create Temporary Log-in for event page

--- src/cljs/event_planner/pages/events.cljs
+++ src/cljs/event_planner/pages/events.cljs
@@ -1,4 +1,26 @@
 (ns event-planner.pages.events)

 (defn events-page [id]
-  [:div "Wow my id is: " id])
+  [:div "Wow my id is: " id]
+  [:div.container
+    [:div.row.col-md-4
+      [:form.form-signin
+        [:h2.form-signin-heading "Sign In"]
+        [:label {:for "inputusername"
+                 :class "sr-only"} "Username"]
+        [:input {:type "text"
+                 :id "inputusername"
+                 :placeholder "Username"
+                 :required
+                 :autofocus}]
+        [:label {:for "inputpassword"
+                 :class "sr-only"} "Password"]
+        [:input {:type "password"
+                 :id "inputpassword"
+                 :placeholder "Password"}]
+        [:button.btn.btn-sm.btn-primary {:type "Submit"} "Sign In"]]
+    [:p ]
+    [:p "Please note that all sign in usernames and passwords are temporary."]
+    [:p "To sign in using your account please go to the "
+        [:a {:href "#"} "Login"] " page."]
+   ]])


debug statement bug fix

debug statement bug fix

--- src/clojure/zensols/model/classifier.clj
+++ src/clojure/zensols/model/classifier.clj
@@ -287,8 +287,7 @@
   "Create a filtered data set (`weka.core.Instances`) from unfiltered Instances.
   Paramater **attributes** is a set of string attribute names."
   [unfiltered attributes]
-  (let [aid (weka/value unfiltered 0 "aid")
-        data (weka/remove-attributes unfiltered attributes :invert-selection? true)]
+  (let [data (weka/remove-attributes unfiltered attributes :invert-selection? true)]
     (log/debugf "attributes: %s"
                 (->> (weka/attributes-for-instances data)
                      (map #(-> % :name symbol))


Now displays default text strings (plus some refactoring)

--- src/day8/re_frame/trace/view/app_db.cljs
+++ src/day8/re_frame/trace/view/app_db.cljs
@@ -73,7 +73,7 @@
                            :on-click #(println "Clicked [end state]")]]]]])

 (defn path-header [p]
-  (let [search-string (rf/subscribe [:app-db/search-string])
+  (let [search-string (r/atom (when (some? p) (prn-str p))) ;;(rf/subscribe [:app-db/search-string])
         *pod-open     (r/atom true)]
     (fn [p]
       [rc/h-box
@@ -190,25 +190,30 @@
                :children  ["---after-diff---"]]
               [rc/gap-f :size "12px"]]])

+(defn no-pods
+  []
+  [rc/h-box
+   :margin "0px 0px 0px 19px"
+   :gap common/gs-7s
+   :align :start
+   :align-self :start
+   :children [[:img {:src (str "data:image/svg+xml;utf8," round-arrow)}]
+              [rc/label
+               :style {:width      "150px"
+                       :margin-top "22px"}
+               :label "add inspectors to show what happened to app-db"]]])
+
 (defn paths []
   (let [
         pods [["x" "y"] [:abc 123] nil]
         ;pods nil
         ]
-    [rc/v-box
-     :gap      pod-gap
-     :children (if (empty? pods)
-                 [[rc/h-box
-                   :margin     "0px 0px 0px 19px"
-                   :gap        common/gs-7s
-                   :align      :start
-                   :align-self :start
-                   :children   [[:img {:src (str "data:image/svg+xml;utf8," round-arrow)}]
-                                [rc/label
-                                 :style {:width "150px"
-                                         :margin-top "22px"}
-                                 :label "add inspectors to show what happened to app-db"]]]]
-                 (doall (for [p pods] [app-db-path p])))]))
+    (fn []
+      [rc/v-box
+       :gap pod-gap
+       :children (if (empty? pods)
+                   [[no-pods]]
+                   (doall (for [p pods] [app-db-path p])))])))

 (defn render-state [data]


finish clojure version

finish clojure version

--- Heap-Sort/HS.clj
+++ Heap-Sort/HS.clj
@@ -1,6 +1,51 @@
-(defn heapify [func nl]
-  (let [
-        ]
-    (loop [heap nl
-           len (count nl)]
+(defn heapify [func nl ind] ; return new nl and child index
+  (let [parent (nth nl ind) ; nl cannot be empty
+        leftind (inc (* 2 ind))
+        left (if (>= leftind (count nl)) nil (nth nl leftind))
+        rightind (+ 2 (* 2 ind))
+        right (if (>= rightind (count nl)) nil (nth nl rightind))]
+    (cond
+      (nil? left) [nl nil]
+      (and (func parent left)
+           (if (nil? right) true (func parent right)))
+      [nl nil]
+      (and (func left parent)
+           (if (nil? right) true (func left right)))
+      [(assoc nl leftind parent ind left) leftind]
+      :else
+      [(assoc nl rightind parent ind right) rightind]
       )))
+
+;(print (heapify >= [4 1 3 2 16 9 10 14 8 7] 4))
+
+(defn parent-ind [ind]
+  (if (= -1 ind) -1
+      (-> ind dec (/ 2) int)))
+
+(defn build-heap [func arr]
+  (loop [arr arr
+         stack [(parent-ind (dec (count arr)))]]
+    ;(println arr stack)
+    (cond
+      (= -1 (first stack)) arr
+      :else
+      (let [[newarr newind] (heapify func arr (last stack))]
+        (recur newarr
+               (cond newind (conj stack newind)
+                     :else
+                     [(dec (first stack))]))))))
+
+(println (build-heap >= [4 1 3 2 16 9 10 14 8 7]))
+
+(defn heap-sort [func arr]
+  (loop [result []
+         arr arr]
+    (cond (= [nil] arr) result
+          :else
+          (let [[this & remaining] (build-heap func arr)]
+            (print remaining)
+            (recur (conj result this)
+                   (into [] (conj (butlast remaining) (last remaining))))))))
+
+(println (heap-sort >= [4 1 3 2 16 9 10 14 8 7]))
+(println (heap-sort <= [4 1 3 2 16 9 10 14 8 7]))


removed debug

removed debug

--- dropwizard-clojure-core/src/main/clojure/dropwizard_clojure/task.clj
+++ dropwizard-clojure-core/src/main/clojure/dropwizard_clojure/task.clj
@@ -10,12 +10,9 @@
     (zipmap (map keyword (keys (.asMap imm))) (vals (.asMap imm)))))

 (defn- transform-multimap [imm]
-  (println (str "incoming map is " imm))
   (if imm (transform imm) {}))

 (defn- values-to-writer [^PrintWriter pw x]
-	(println "entered values to writer")
-  (println (str "param is " x))
 	(cond
 		(or (seq? x) (vector? x) (list? x)) (doseq [y x] (.println pw y))
 		:else (if x (.println pw x))))
@@ -23,9 +20,7 @@
 (defn task [^String n f] "creates a task based on the supplied function"
   (proxy [Task] [n]
     (execute [^ImmutableMultimap p ^PrintWriter pw]
-    	(println "executing task")
     	(values-to-writer pw (f (transform-multimap p)))
-
     	)))

 (defn update-task [t f] "updates the function used when execising the supplied task"


Constrain tooltip to be in build viewport so it doesn't overflow behind the side nav

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -114,7 +114,10 @@
     om/IDidMount
     (did-mount [_]
       (when (seq body)
-        (utils/tooltip (str "#commit-line-tooltip-hack-" commit) {:placement "bottom" :animation false})))
+        (utils/tooltip (str "#commit-line-tooltip-hack-" commit)
+                       {:placement "bottom"
+                        :animation false
+                        :viewport "#build-log-container"})))
     om/IRender
     (render [_]
       (html


implement json generation for sigmajs

implement json generation for sigmajs

--- src/main/clojure/conexp/sigmajs/base.clj
+++ src/main/clojure/conexp/sigmajs/base.clj
@@ -3,14 +3,38 @@
             [loom.graph :as lg]
             [conexp.fca.lattices :as lat]
             [conexp.util.graph :exclude [transitive-closure] :refer :all])
-  (:use conexp.base)
-  (:use loom.io))
+  (:use conexp.base))

 ;;;

 (defn graph->json
-  )
+  ([g]
+   (graph->json g (fn [_] [(clojure.core/rand) (clojure.core/rand)])))
+  ([g node-positions]
+   (let [nodes (lg/nodes g)
+         edges (lg/edges g)
+         node->str (fn [n] (let [pos (node-positions n)]
+                             (str "    {
+      \"id\": \"" n "\",
+      \"label\": \"" n "\",
+      \"x\": " (first pos) ",
+      \"y\": " (last pos) "
+    }")))
+         edge->str (fn [e] (str "    {
+      \"id\": \"" (:id e) "\",
+      \"source\": \"" (:src e) "\",
+      \"target\": \"" (:dest e) "\"
+    }"))]
+     (str
+       "{\n  \"nodes\": [\n"
+       (if nodes (node->str (first nodes)))
+       (apply str (map #(str ",\n" (node->str %)) (drop 1 nodes)))
+       "\n  ],\n  \"edges\": [\n"
+       (if edges (edge->str (first edges)))
+       (apply str (map #(str ",\n" (edge->str %)) (drop 1 edges)))
+       "\n  ]\n}"
+       ))))

 ;;;


Fix predicate success check.

Fix predicate success check.

--- src/onyx/flow_conditions/fc_routing.cljc
+++ src/onyx/flow_conditions/fc_routing.cljc
@@ -32,7 +32,7 @@
                                (:flow/action entry)
                                (:result pred-result)))

-             (:success? pred-result)
+             (and (:success? pred-result) (:result pred-result))
              (if (:flow/short-circuit? entry)
                (reduced (->Route (join-output-paths flow (:flow/to entry) downstream)
                                  (into (set exclusions) (:flow/exclude-keys entry))


Fix paren.

Fix paren.

--- src/onyx/flow_conditions/fc_routing.cljc
+++ src/onyx/flow_conditions/fc_routing.cljc
@@ -52,7 +52,7 @@
             (throw (maybe-attach-segment exception task-id segment))))
         (if (seq compiled-norm-fcs)
           (choose-output-paths event compiled-norm-fcs result message egress-tasks)
-          (->Route egress-tasks nil nil nil)))))))
+          (->Route egress-tasks nil nil nil))))))

 (defn apply-post-transformation [message routes event]
   (let [post-transformation (:post-transformation routes)


Add a test for custom retry handler

Add a test for custom retry handler

--- test/clj_http/test/core.clj
+++ test/clj_http/test/core.clj
@@ -195,7 +195,7 @@
 (deftest ^{:integration true} throw-on-too-many-redirects
   (run-server)
   (let [resp (client/get "http://localhost:18080/redirect"
-               {:max-redirects 2 :throw-exceptions false})]
+                         {:max-redirects 2 :throw-exceptions false})]
     (is (= 302 (:status resp)))
     (is (= (apply vector (repeat 3 "http://localhost:18080/redirect"))
            (:trace-redirects resp))))
@@ -232,3 +232,15 @@
   (let [resp (client/get "http://[::1]:18080/get")]
     (is (= 200 (:status resp)))
     (is (= "get" (:body resp)))))
+
+(deftest t-custom-retry-handler
+  (let [called? (atom false)]
+    (is (thrown? Exception
+                 (client/post "http://localhost"
+                              {:multipart [["title" "Foo"]
+                                           ["Content/type" "text/plain"]
+                                           ["file" (file "/tmp/missing-file")]]
+                               :retry-handler (fn [ex try-count http-context]
+                                                (reset! called? true)
+                                                false)})))
+    (is @called?)))


(PDB-4961) State that postgres <11 is unsupported

Since this is now a non-fatal error, we've gone further than deprecating
postgresql less than 11. In PuppetDB 7+ it will be officially
unsupported and may break in any release.

--- src/puppetlabs/puppetdb/cli/services.clj
+++ src/puppetlabs/puppetdb/cli/services.clj
@@ -548,7 +548,7 @@
                        :current current
                        :oldest supported})))
     (when (neg? (compare current supported))
-      (log/error (trs "PostgreSQL {0}.{1} is deprecated. Please upgrade to PostgreSQL {2}"
+      (log/error (trs "PostgreSQL {0}.{1} is unsupported. Please upgrade to PostgreSQL {2}"
                      (first current)
                      (second current)
                      (first supported))))


(PDB-4555) Retry settings validation db connection

This was found in the testing of the PuppetDB container, which starts
PuppetDB and PostgreSQL closer together than you'd traditionally see in
a VM or baremetal install.

The bug was introduced by PDB-4509 in 8152c4dd9, which performs the
database query 'show all;' outside the retry loop for
SQLTransientException. If that query encounters an error in its
connection, instead of retrying the connection it would error and
shutdown PuppetDB with the following message
    ERROR [p.t.internal] Error during service start!!!
    java.sql.SQLTransientConnectionException: PDBMigrationsPool -
    Connection is not available, request timed out after 3011ms.

An SQLTransientException indicates
    that the connection operation that failed might be
    able to succeed if the operation is retried without any
    application-level changes.

By moving into the retry loop for connection exceptions the error will
now be caught and retried with the same error message as migrations,
    ERROR [p.p.c.services] Will retry database connection after
    temporary failure:
    java.sql.SQLTransientConnectionException: PDBMigrationsPool -
    Connection is not available, request timed out after 3008ms.

--- src/puppetlabs/puppetdb/cli/services.clj
+++ src/puppetlabs/puppetdb/cli/services.clj
@@ -394,10 +394,10 @@
                         (.setName "PuppetDB migration pool closer"))]
       (.addShutdownHook runtime on-shutdown)
       (try
-        (verify-database-settings (request-database-settings {:datasource db-pool}))
         (loop [i 0
                last-ex nil]
           (let [result (try
+                         (verify-database-settings (request-database-settings {:datasource db-pool}))
                          (initialize-schema {:datasource db-pool} config)
                          true
                          (catch java.sql.SQLTransientConnectionException ex


Clarify method intent, change implementation

--- src/test_utils/fracture_diagnostics.cljc
+++ src/test_utils/fracture_diagnostics.cljc
@@ -133,14 +133,14 @@
      :ft (make-measurement (tuc/draw-normal 8000 1667) length-unit)
      :m (length-as (typical-extent-of-horizontal :ft) length-unit))))

-(defn typical-measured-depth
-  ([] (typical-measured-depth (rand-length-unit)))
+(defn typical-measured-depth-in-horizontal
+  ([] (typical-measured-depth-in-horizontal (rand-length-unit)))
   ([length-unit]
    (case length-unit
      :ft (make-measurement (+ (magnitude (typical-measured-depth-of-vertical length-unit))
                               (magnitude (typical-extent-of-horizontal length-unit)))
                            length-unit)
-     :m (length-as (typical-measured-depth) length-unit))))
+     :m (length-as (typical-measured-depth-in-horizontal) length-unit))))

 (defn typical-toe-measured-depth
   ([] (typical-toe-measured-depth (rand-length-unit)))
@@ -149,12 +149,7 @@
      :ft (make-measurement (tuc/draw-normal 18000 1500) :ft)
      :m (length-as (typical-toe-measured-measured-depth) :m))))

-(defn typical-stage-top
-  ([] (typical-stage-top (rand-length-unit)))
-  ([length-unit]
-   (condp = length-unit
-     :ft (make-measurement (tuc/draw-normal 13750 2150) :ft)
-     :m (length-as (typical-stage-top :ft) :m))))
+(def typical-stage-top typical-measured-depth-in-horizontal)

 (defn typical-stage-length
   ([] (typical-stage-length (rand-length-unit)))


CMR-4238 - Update the docstring to better show resetting with parameters.

--- dev-system/dev/user.clj
+++ dev-system/dev/user.clj
@@ -213,7 +213,12 @@

 (defn reset
   "Resets the development environment, taking optional keyword arguments for
-  various run modes (see the docstring for `set-modes!` for more details).
+  various run modes, e.g.:
+  ```
+  (reset :db :external)
+  ```
+  See the docstring for `set-modes!` for more details.
+
   Environment resetting includes the reloading of any changed namespaces and
   the restarting the CMR services.


clean up tests

clean up tests

--- test/com/billpiel/sayid/test/go_deep.clj
+++ test/com/billpiel/sayid/test/go_deep.clj
@@ -1,10 +0,0 @@
-(ns com.billpiel.sayid.test.go-deep)
-
-(defn go-deep [n & r]
-  (if (> n 0)
-     (->> (range (dec n) n)
-         (concat r)
-         (map #(go-deep (dec n) %))
-         flatten
-         (apply +))
-    r))


WIP - generative testing for query->props

--- test/com/wsscode/pathom/map_db_test.cljc
+++ test/com/wsscode/pathom/map_db_test.cljc
@@ -6,7 +6,10 @@
             [com.wsscode.pathom.gen :as pgen]
             [clojure.test.check :as tc]
             [clojure.test.check.properties :as props]
-            [clojure.spec.alpha :as s]))
+            [clojure.spec.alpha :as s]
+            [clojure.spec.gen.alpha :as gen]
+            [com.wsscode.pathom.gen :as sgen]
+            [com.wsscode.pathom.core :as p]))

 (deftest db-tree-sanity-checks
   (are [q m r o] (= (map-db/db->tree q m r) o)
@@ -139,9 +142,47 @@

   (stest/abbrev-result (first (stest/check `p/query->ast))))

+(def gen-env
+  {::pgen/settings {:name          {::pgen/gen (s/gen string?)}
+                    :user/id       {::pgen/gen (s/gen string?)}
+                    :user/name     {::pgen/gen (s/gen string?)}
+                    :product/title {::pgen/gen (s/gen string?)}
+                    :other         {::pgen/gen (s/gen string?)}}
+   ::p/union-path  (fn [env] (-> env :ast :query ffirst))})
+
 (comment
-  (tc/quick-check 100
-    (props/for-all [query (s/gen ::spec.query/query)]
-      (let [data (pgen/query->props gen-env query)]
-        (= (fp/db->tree query data data)
-           (map-db/db->tree query data data))))))
+  (gen/sample (s/gen ::spec.query/query) 20)
+  (def queries (gen/sample (s/gen ::spec.query/query) 10))
+
+  (->> (map
+         #(try
+            [% (pgen/query->props gen-env %)]
+            (catch Throwable e
+              [::error % (.getMessage e)])) queries)
+       (filter (comp #{::error} first)))
+
+  (binding [*print-namespace-maps* false]
+    (tc/quick-check 100
+      (props/for-all [query (s/gen ::spec.query/query)]
+        (pgen/query->props gen-env query)
+        #_(let [data (pgen/query->props gen-env query)]
+            (= (fp/db->tree query data data)
+               (map-db/db->tree (sgen/remove-root-stars query) data data))))))
+
+  (pgen/query->props gen-env
+    '[:user/id {:user/name ...}])
+
+  (pgen/query->props gen-env
+    '[{:user/name
+       [[:user/name "123"]
+        {[:user/name "123"] 1}]}])
+
+  (pgen/query->props gen-env
+    '[[:user/name "123"]])
+
+  (binding [*print-namespace-maps* false]
+    (tc/quick-check 100
+      (props/for-all [query (s/gen ::spec.query/query)]
+        (let [data (pgen/query->props gen-env query)]
+          (= (fp/db->tree query data data)
+             (map-db/db->tree query data data)))))))


Refactor csv-corpus-to-tf-idf-data! to only write one file.

--- project/analyze-data/src/analyze_data/corpus_to_tf_idf.clj
+++ project/analyze-data/src/analyze_data/corpus_to_tf_idf.clj
@@ -61,19 +61,16 @@

 (defn csv-corpus-to-tf-idf-data!
   "Transform a csv containing a corpus of documents into a file of tf-idf
-  vectors and a file of idf values.
+  vectors.

   in-path: path to a csv file. It should contain the headers 'item-name' and
            'item-text', with values as described in corpus-to-tf-idf-data.
-  idf-path: path to write an edn map from term to idf value.
   tf-idf-path: path where the tf-idf vectors will be written as a gzipped
                file. Each line of the output file will be an edn list, and
                each will correspond to an entry from the :tf-idf key in the
                return value of corpus-to-tf-idf-data."
-  [in-path idf-path tf-idf-path]
-  (with-open [in (io/reader in-path)
-              idf-out (io/writer idf-path)]
+  [in-path tf-idf-path]
+  (with-open [in (io/reader in-path)]
     (let [corpus (csv-to-map in)
           tf-idf-data (corpus-to-tf-idf-data corpus)]
-      (binding [*out* idf-out] (prn (:idf tf-idf-data)))
-      (write-sequence! (:tf-idf tf-idf-data) tf-idf-path, :compress? true))))
+      (write-sequence! tf-idf-data tf-idf-path, :compress? true))))


test-avro-utils - from-avro - added test for java.util.Maps

--HG--
extra : rebase_source : 29a73bb959d0e4e87844d4ebc0c4e625836eed9b

--- sherpa-clojure/src/test/clojure/sherpa/test_avro_utils.clj
+++ sherpa-clojure/src/test/clojure/sherpa/test_avro_utils.clj
@@ -89,6 +89,13 @@
     (is (= {:a "foo" :b 1}
            cljmap))))

+(deftest test-from-avro-java-map
+  (let [m (java.util.HashMap.)]
+    (.put m "test" "100")
+    (let [cljmap (from-avro m example-protocol)]
+      (is (= {:test "100"}
+             cljmap)))))
+
 (deftest test-from-avro-enum
   (let [avenum (GenericData$EnumSymbol. (.getType example-protocol "e1") "a")
         cljenum (from-avro avenum example-protocol)]


addresses conversion of chunked encoding request by Jetty (#1505)

--- waiter/integration/waiter/basic_test.clj
+++ waiter/integration/waiter/basic_test.clj
@@ -251,8 +251,15 @@
                   chunked-body-str (str (:body chunked-resp))
                   chunked-body-json (try-parse-json chunked-body-str)]
               (is (= request-length (get-in chunked-body-json ["request-length"])) chunked-body-str)
-              (is (= "chunked" (get-in chunked-body-json ["headers" "transfer-encoding"])) chunked-body-str)
-              (is (nil? (get-in chunked-body-json ["headers" "content-length"])) chunked-body-str)))))
+              (let [request-content-length (get-in chunked-body-json ["headers" "content-length"])]
+                ;; depending upon timing of chunks jetty may compress the body into a known length request
+                (if request-content-length
+                  (do
+                    (is (nil? (get-in chunked-body-json ["headers" "transfer-encoding"])) chunked-body-str)
+                    (is (= (str request-length) request-content-length) chunked-body-str))
+                  (do
+                    (is (= "chunked" (get-in chunked-body-json ["headers" "transfer-encoding"])) chunked-body-str)
+                    (is (nil? request-content-length) chunked-body-str))))))))

       (testing "large header"
         (let [all-chars (map char (range 33 127))


avoids flakiness in test assertion (#964)

--- waiter/integration/waiter/basic_test.clj
+++ waiter/integration/waiter/basic_test.clj
@@ -459,75 +459,78 @@
       (let [{:keys [cookies service-id]} (make-request-with-debug-info
                                            {:x-waiter-name (rand-name)}
                                            #(make-kitchen-request waiter-url %))]
-        (assert-service-on-all-routers waiter-url service-id cookies)
-        ;; wait for scaling state to become available on the service endpoint
-        (is (wait-for (fn [] (get (service waiter-url service-id {}) "scaling-state"))))
-
-        (testing "without parameters"
-          (let [service (service waiter-url service-id {})] ;; see my app as myself
-            (is service)
-            (is (contains? #{"Running" "Starting"} (get service "status")))
-            (is (-> (get service "last-request-time") du/str-to-date .getMillis pos?))
-            (is (get service "scaling-state") (str service))
-            (is (pos? (get-in service ["service-description" "cpus"])) service)))
-
-        (testing "with star run-as-user parameter"
-          (let [run-as-user-param (->> current-user reverse (drop 2) (cons "*") reverse (str/join ""))
-                service (service waiter-url service-id {"run-as-user" run-as-user-param})] ;; see my app as myself
-            (is service)
-            (is (contains? #{"Running" "Starting"} (get service "status")))
-            (is (-> (get service "last-request-time") du/str-to-date .getMillis pos?))
-            (is (get service "scaling-state") (str service))
-            (is (pos? (get-in service ["service-description" "cpus"])) service)))
-
-        (testing "waiter user disabled" ;; see my app as myself
-          (let [service (service waiter-url service-id {"force" "false"})]
-            (is service)
-            (is (contains? #{"Running" "Starting"} (get service "status")))
-            (is (-> (get service "last-request-time") du/str-to-date .getMillis pos?))
-            (is (get service "scaling-state") (str service))
-            (is (pos? (get-in service ["service-description" "cpus"])) service)))
-
-        (testing "waiter user disabled and same user" ;; see my app as myself
-          (let [service (service waiter-url service-id {"force" "false", "run-as-user" current-user})]
-            (is service)
-            (is (contains? #{"Running" "Starting"} (get service "status")))
-            (is (-> (get service "last-request-time") du/str-to-date .getMillis pos?))
-            (is (get service "scaling-state") (str service))
-            (is (pos? (get-in service ["service-description" "cpus"])) service)))
-
-        (testing "different run-as-user" ;; no such app
-          (let [service (service waiter-url service-id {"run-as-user" "test-user"}
-                                 :interval 2, :timeout 10)]
-            (is (nil? service))))
-
-        (testing "should not provide effective service description by default"
-          (let [service (service waiter-url service-id {})]
-            (is (nil? (get service "effective-parameters")))))
-
-        (testing "should not provide effective service description when explicitly not requested"
-          (let [service (service waiter-url service-id {"effective-parameters" "false"})]
-            (is (nil? (get service "effective-parameters")))))
-
-        (testing "should provide effective service description when requested"
-          (let [service (service waiter-url service-id {"effective-parameters" "true"})]
-            (is (= (disj sd/service-parameter-keys "image" "namespace" "scheduler")
-                   (set (keys (get service "effective-parameters")))))))
-
-        (delete-service waiter-url service-id))
-
-      (let [service-id (:service-id (make-request-with-debug-info
-                                      {:x-waiter-name (rand-name)
-                                       :x-waiter-run-as-user current-user}
-                                      #(make-kitchen-request waiter-url %)))]
-        (testing "list-apps-with-waiter-user-disabled-and-see-another-app" ;; can see another user's app
-          (let [service (service waiter-url service-id {"force" "false", "run-as-user" current-user})]
-            (is service)
-            (is (contains? #{"Running" "Starting"} (get service "status")))
-            (is (-> (get service "last-request-time") du/str-to-date .getMillis pos?))
-            (is (get service "scaling-state") (str service))
-            (is (pos? (get-in service ["service-description" "cpus"])) service)))
-        (delete-service waiter-url service-id)))))
+        (with-service-cleanup
+          service-id
+          (assert-service-on-all-routers waiter-url service-id cookies)
+          ;; wait for scaling state to become available on the service endpoint
+          (is (wait-for (fn [] (get (service waiter-url service-id {}) "scaling-state"))))
+
+          (testing "without parameters"
+            (let [service (service waiter-url service-id {})] ;; see my app as myself
+              (is service)
+              (is (contains? #{"Running" "Starting"} (get service "status")))
+              (is (-> (get service "last-request-time") du/str-to-date .getMillis pos?))
+              (is (get service "scaling-state") (str service))
+              (is (pos? (get-in service ["service-description" "cpus"])) service)))
+
+          (testing "with star run-as-user parameter"
+            (let [run-as-user-param (->> current-user reverse (drop 2) (cons "*") reverse (str/join ""))
+                  service (service waiter-url service-id {"run-as-user" run-as-user-param})] ;; see my app as myself
+              (is service)
+              (is (contains? #{"Running" "Starting"} (get service "status")))
+              (is (-> (get service "last-request-time") du/str-to-date .getMillis pos?))
+              (is (get service "scaling-state") (str service))
+              (is (pos? (get-in service ["service-description" "cpus"])) service)))
+
+          (testing "waiter user disabled" ;; see my app as myself
+            (let [service (service waiter-url service-id {"force" "false"})]
+              (is service)
+              (is (contains? #{"Running" "Starting"} (get service "status")))
+              (is (-> (get service "last-request-time") du/str-to-date .getMillis pos?))
+              (is (get service "scaling-state") (str service))
+              (is (pos? (get-in service ["service-description" "cpus"])) service)))
+
+          (testing "waiter user disabled and same user" ;; see my app as myself
+            (let [service (service waiter-url service-id {"force" "false", "run-as-user" current-user})]
+              (is service)
+              (is (contains? #{"Running" "Starting"} (get service "status")))
+              (is (-> (get service "last-request-time") du/str-to-date .getMillis pos?))
+              (is (get service "scaling-state") (str service))
+              (is (pos? (get-in service ["service-description" "cpus"])) service)))
+
+          (testing "different run-as-user" ;; no such app
+            (let [service (service waiter-url service-id {"run-as-user" "test-user"}
+                                   :interval 2, :timeout 10)]
+              (is (nil? service))))
+
+          (testing "should not provide effective service description by default"
+            (let [service (service waiter-url service-id {})]
+              (is (nil? (get service "effective-parameters")))))
+
+          (testing "should not provide effective service description when explicitly not requested"
+            (let [service (service waiter-url service-id {"effective-parameters" "false"})]
+              (is (nil? (get service "effective-parameters")))))
+
+          (testing "should provide effective service description when requested"
+            (let [service (service waiter-url service-id {"effective-parameters" "true"})]
+              (is (= (disj sd/service-parameter-keys "image" "namespace" "scheduler")
+                     (set (keys (get service "effective-parameters")))))))))
+
+      (let [{:keys [cookies service-id]} (make-request-with-debug-info
+                                           {:x-waiter-name (rand-name)
+                                            :x-waiter-run-as-user current-user}
+                                           #(make-kitchen-request waiter-url %))]
+        (with-service-cleanup
+          (assert-service-on-all-routers waiter-url service-id cookies)
+          ;; wait for scaling state to become available on the service endpoint
+          (is (wait-for (fn [] (get (service waiter-url service-id {}) "scaling-state"))))
+          (testing "list-apps-with-waiter-user-disabled-and-see-another-app" ;; can see another user's app
+            (let [service (service waiter-url service-id {"force" "false", "run-as-user" current-user})]
+              (is service)
+              (is (contains? #{"Running" "Starting"} (get service "status")))
+              (is (-> (get service "last-request-time") du/str-to-date .getMillis pos?))
+              (is (get service "scaling-state") (str service))
+              (is (pos? (get-in service ["service-description" "cpus"])) service))))))))

 (deftest ^:parallel ^:integration-fast test-delete-service
   (testing-using-waiter-url


Refactor consumer.clj

Refactor consumer.clj

--- worker/src/clinicico/worker/consumer.clj
+++ worker/src/clinicico/worker/consumer.clj
@@ -35,26 +35,26 @@

 (defn- create-reconnecter
   [consumer]
-  (let [reconnect (q/zloop-handler
+  (let [interval (atom interval-init)
+        reconnect (q/zloop-handler
                    (fn []
-                     (doseq [f [:connect :initialize]]
-                       ((get @consumer f))) 0))
-        interval (atom interval-init)]
+                     (do
+                       (reset! interval (min (* 2 @interval) interval-max))
+                       ((@consumer :initialize))
+                       (swap! consumer assoc :liveness heartbeat-liveness)) 0))]
     (fn []
+      (log/debug "[consumer] connection to router lost; reconnecting in" @interval)
       (.close (@consumer :socket))
       (swap! consumer dissoc :socket)
       (.removePoller (@consumer :zloop) (.getItem (@consumer :poller) 0))
-      (.addTimer (@consumer :zloop) @interval 1 reconnect (Object.))
-      (reset! interval (max (* 2 @interval) interval-max)))))
+      (.addTimer (@consumer :zloop) @interval 1 reconnect (Object.)))))

 (defn- with-heartbeat
   [consumer]
   (let [reconnecter (atom (create-reconnecter consumer))
-        pong (fn [_] (do (log/debug "[consumer] pong")
-                        (reset! reconnecter (create-reconnecter consumer))
+        pong (fn [_] (do (reset! reconnecter (create-reconnecter consumer))
                         (swap! consumer assoc :liveness heartbeat-liveness)))
-        ping #(do (log/debug "[consumer] ping!")
-                  (send! (@consumer :protocol) (@consumer :socket) [q/MSG-PING]))
+        ping #(do (send! (@consumer :protocol) (@consumer :socket) [q/MSG-PING]))
         heartbeat (fn []
                     (when (contains? @consumer :socket)
                       (let [next-liveness (dec (get @consumer :liveness (inc heartbeat-liveness)))]
@@ -63,8 +63,7 @@
                           (ping)
                           (@reconnecter)))))]
     (swap! consumer assoc :handlers (merge (@consumer :handlers) {q/MSG-PONG pong}))
-    (.addTimer (@consumer :zloop) heartbeat-interval 0 (q/zloop-handler (fn [] (do (heartbeat) (int 0)))) (Object.))
-  consumer))
+    (.addTimer (@consumer :zloop) heartbeat-interval 0 (q/zloop-handler (fn [] (do (heartbeat) (int 0)))) (Object.))))

 (defn- handle-request
   [consumer handler]
@@ -90,31 +89,27 @@
   [method handler]
   (let [protocol (MessageProtocol. method)
         context (zmq/context)
+        zloop (ZLoop.)
         consumer (atom {:handlers  {}
-                         :protocol protocol
-                         :zloop (ZLoop.)
-                         :poller (zmq/poller context)
-                         :socket nil})
-        connect #(swap! consumer assoc :socket (create-socket context :dealer "tcp://localhost:7740"))
-        initialize #(do
-                      (zmq/register (@consumer :poller) (@consumer :socket) :pollin)
+                        :protocol protocol
+                        :zloop zloop
+                        :socket nil})
+        initialize #(let [poller (zmq/poller context 1)
+                          socket (create-socket context :dealer "tcp://localhost:7740")]
+                      (swap! consumer assoc :socket socket :poller poller)
+                      (zmq/register poller socket :pollin)
                       (.addPoller (@consumer :zloop)
-                                  (.getItem (@consumer :poller) 0)
+                                  (.getItem poller 0)
                                   (q/zloop-handler (fn [] ((handle-incoming consumer)) (int 0)))
                                   (Object.))
-                      (send! protocol (@consumer :socket) [q/MSG-READY]) consumer)]
-    (dosync
-     (swap! consumer assoc
-            :handlers {q/MSG-REQ (handle-request consumer handler)}
-            :initialize initialize
-            :connect connect)
-     (doseq [f [:connect :initialize]]
-       ((get @consumer f))))
+                      (send! protocol socket [q/MSG-READY]))]
+    (swap! consumer assoc
+           :handlers {q/MSG-REQ (handle-request consumer handler)}
+           :initialize initialize)
+    ((@consumer :initialize))
+    (.start (Thread. #(.start zloop)))
     consumer))

 (defn start
   [method handler]
-  (let [consumer (with-heartbeat (create-consumer method handler))
-        zloop (@consumer :zloop)
-        loop (agent {})]
-    (.start (Thread. #(.start zloop)))))
+  (with-heartbeat (create-consumer method handler)))


Add demo

Add demo

--- system-int-test/src/cmr/system_int_test/data2/opendata.clj
+++ system-int-test/src/cmr/system_int_test/data2/opendata.clj
@@ -117,7 +117,8 @@
                             :landingPage (odrh/landing-page concept-id)
                             :language [odrh/LANGUAGE_CODE]
                             :references (not-empty (map :url related-urls))
-                            :issued (when insert-time (str insert-time))})))
+                            :issued (when insert-time (str insert-time))}
+                           odrh/VALUE_NOT_PROVIDED)))

 (defn collections->expected-opendata
   [collections]


(PE-3140) Removed unnecessary :ShutdownService shutdown-on-error reference

This commit removes an unnecessary reference to the shutdown-on-error
function in the :ShutdownService from the jetty9-service defservice.

--- src/puppetlabs/trapperkeeper/services/webserver/jetty9_service.clj
+++ src/puppetlabs/trapperkeeper/services/webserver/jetty9_service.clj
@@ -20,8 +20,7 @@
 (defservice jetty9-service
   "Provides a Jetty 9 web server as a service"
   WebserverService
-  [[:ConfigService get-in-config]
-   [:ShutdownService shutdown-on-error]]
+  [[:ConfigService get-in-config]]
   (init [this context]
         (log/info "Initializing web server.")
         (assoc context :jetty9-server (core/create-handlers)))


CMR-2893 Removes debug code

CMR-2893 Removes debug code

--- access-control-app/int_test/cmr/access_control/int_test/access_control_group_crud_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/access_control_group_crud_test.clj
@@ -239,8 +239,7 @@
                 (u/create-acl token {:group_permissions [{:user_type :registered
                                                           :permissions ["update"]}]
                                      :single_instance_identity {:target "GROUP_MANAGEMENT"
-                                                                :target_id group-2-concept-id}}))
-        _ (println "acl-2-concept-id" acl-2-concept-id)]
+                                                                :target_id group-2-concept-id}}))]
     (u/wait-until-indexed)
     (is (= #{acl-1-concept-id acl-2-concept-id}
            (set


fix compat deftest, thrown?, and thrown-with-msg?

--- src/main/clojure/com/stuartsierra/lazytest/compat.clj
+++ src/main/clojure/com/stuartsierra/lazytest/compat.clj
@@ -1,10 +1,16 @@
-(ns #^{:doc "Compatibility layer for clojure.test"}
+(ns #^{:doc "Compatibility layer for clojure.test
+
+  :use this namespace instead of clojure.test, and your tests will be
+  runnable with lazytest.  Failures in clojure.test will be reported
+  as AssertionError by lazytest.
+
+  Does not support clojure.test fixtures."}
   com.stuartsierra.lazytest.compat
   (:require clojure.test
             [com.stuartsierra.lazytest :as t]))

 (defmacro deftest [name & body]
-  `(t/spec-do ~name [] ~body))
+  `(t/spec-do ~name [] ~@body))

 (defmacro testing [string & body]
   `(do ~@body))
@@ -25,5 +31,8 @@
 (defn run-all-tests []
   (t/run-spec (all-ns)))

-(defmacro thrown? [& args]
-  true)
+(defmacro thrown? [klass & body]
+  `(try ~@body (catch ~klass e# true)))
+
+(defmacro thrown-with-msg? [klass msg & body]
+  `(try ~@body (catch ~klass e# (re-find ~msg (.getMessage e#)))))


TLOG-7: avoid reflection

TLOG-7: avoid reflection

--- src/main/clojure/clojure/tools/logging/impl.clj
+++ src/main/clojure/clojure/tools/logging/impl.clj
@@ -43,7 +43,7 @@
         (extend org.slf4j.Logger
           Logger
           {:enabled?
-           (fn [logger# level#]
+           (fn [^org.slf4j.Logger logger# level#]
              (condp = level#
                :trace (.isTraceEnabled logger#)
                :debug (.isDebugEnabled logger#)
@@ -90,7 +90,7 @@
          (extend org.apache.commons.logging.Log
            Logger
            {:enabled?
-            (fn [logger# level#]
+            (fn [^org.apache.commons.logging.Log logger# level#]
               (condp = level#
                 :trace (.isTraceEnabled logger#)
                 :debug (.isDebugEnabled logger#)
@@ -100,7 +100,7 @@
                 :fatal (.isFatalEnabled logger#)
                 (throw (IllegalArgumentException. (str level#)))))
             :write!
-            (fn [logger# level# e# msg#]
+            (fn [^org.apache.commons.logging.Log logger# level# e# msg#]
               (if e#
                 (condp = level#
                   :trace (.trace logger# msg# e#)
@@ -141,13 +141,13 @@
          (extend org.apache.log4j.Logger
            Logger
            {:enabled?
-            (fn [logger# level#]
+            (fn [^org.apache.log4j.Logger logger# level#]
               (.isEnabledFor logger#
                  (or
                    (levels# level#)
                    (throw (IllegalArgumentException. (str level#))))))
             :write!
-            (fn [logger# level# e# msg#]
+            (fn [^org.apache.log4j.Logger logger# level# e# msg#]
               (let [level# (or
                              (levels# level#)
                              (throw (IllegalArgumentException. (str level#))))]
@@ -177,13 +177,13 @@
          (extend java.util.logging.Logger
            Logger
            {:enabled?
-            (fn [logger# level#]
+            (fn [^java.util.logging.Logger logger# level#]
               (.isLoggable logger#
                 (or
                   (levels# level#)
                   (throw (IllegalArgumentException. (str level#))))))
             :write!
-            (fn [logger# level# ^Throwable e# msg#]
+            (fn [^java.util.logging.Logger logger# level# ^Throwable e# msg#]
               (let [^java.util.logging.Level level#
                     (or
                       (levels# level#)


adds logging for resolved IP address (#1444)

--- waiter/src/waiter/statsd.clj
+++ waiter/src/waiter/statsd.clj
@@ -59,6 +59,7 @@
     [host]
     (try
       (when-let [host-ip (resolve-ip host)]
+        (log/info host "resolved to IP" host-ip)
         (swap! config assoc :host host-ip))
       (catch Throwable e
         (log/warn e "Error resolving IP for host" host)))
@@ -186,9 +187,11 @@
           (when config-histogram-max-size
             (reset! histogram-max-size config-histogram-max-size))
           (when (pos? config-publish-interval-ms)
+            (log/info "publishing statsd metrics every" config-publish-interval-ms "ms")
             (du/start-timer-task (t/millis config-publish-interval-ms) trigger-publish
                                  :delay-ms config-publish-interval-ms))
           (when (pos? config-refresh-interval-ms)
+            (log/info "refreshing statsd host ip every" config-refresh-interval-ms "ms")
             (du/start-timer-task (t/millis config-refresh-interval-ms) #(refresh-host-ip host)
                                  :delay-ms config-refresh-interval-ms)))))


add test for reading of test-relevant project file. (see #45)

--- test/leiningen/ancient/artifact/reader_test.clj
+++ test/leiningen/ancient/artifact/reader_test.clj
@@ -26,3 +26,15 @@
       (with-temp-file [f "{:plugins [[plugin \"0.1.0\"]]}"]
         (let [m (read-profiles-map! f [:profiles :prof])]
           (-> m :profiles :prof :plugins) => '[[plugin "0.1.0"]])))
+
+(fact "about project file parsing (for tests)."
+      (with-temp-file [new-project (str "(defproject project-x \"a\"\n"
+                                        "  :dependencies [[artifact \"0.1.1\"]])")]
+        (with-temp-file [old-project (str "(defproject project-x \"a\"\n"
+                                          "  :dependencies [[artifact \"0.1.0\"]])")]
+          (let [parent-path #(.getCanonicalPath (.getParentFile (io/file %)))
+                m (read-project-for-tests! (parent-path old-project) new-project)
+                {:keys [without-profiles]} (meta m)]
+            (:dependencies m) => (contains #{'[artifact/artifact "0.1.1"]})
+            (:dependencies without-profiles) => (contains #{'[artifact/artifact "0.1.1"]})
+            (-> without-profiles :root parent-path) => (parent-path old-project)))))


[fix 6508] user own picture should be unclickable in chats

Signed-off-by: yenda <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@status.im>

--- src/status_im/ui/screens/desktop/main/chat/views.cljs
+++ src/status_im/ui/screens/desktop/main/chat/views.cljs
@@ -75,24 +75,17 @@
        [react/text {:style styles/author :font :medium} name]])))

 (views/defview member-photo [from]
-  (views/letsubs [photo-path [:get-photo-path from]]
+  (views/letsubs [current-public-key [:get-current-public-key]
+                  photo-path [:get-photo-path from]]
     [react/view {:style {:width 40 :margin-horizontal 16}}
      [react/view {:style {:position :absolute}}
-      [react/touchable-highlight {:on-press #(re-frame/dispatch [:show-profile-desktop from])}
+      [react/touchable-highlight {:on-press #(when-not (= current-public-key from)
+                                               (re-frame/dispatch [:show-profile-desktop from]))}
        [react/view {:style styles/member-photo-container}
         [react/image {:source {:uri (if (string/blank? photo-path)
                                       (identicon/identicon from)
                                       photo-path)}
                       :style  styles/photo-style}]]]]]))
-
-(views/defview my-photo [from]
-  (views/letsubs [account [:get-current-account]]
-    (let [{:keys [photo-path]} account]
-      [react/view
-       [react/image {:source {:uri (if (string/blank? photo-path)
-                                     (identicon/identicon from)
-                                     photo-path)}
-                     :style  styles/photo-style}]])))

 (views/defview quoted-message [{:keys [from text]} outgoing current-public-key]
   (views/letsubs [username [:get-contact-name-by-identity from]]


[#244] Adds answer filtering test

[#244] Adds answer filtering test

- We have 2 questions for the same form id, one of them is "orphan"
  (no parent form instance)

--- api/test/clojure/org/akvo/flow_api/datastore/stats_test.clj
+++ api/test/clojure/org/akvo/flow_api/datastore/stats_test.clj
@@ -91,3 +91,21 @@
            :count 129}
           (stats/number-question-stats dss {:formId form-id
                                             :questionId question-id}))))))
+
+(deftest test-filter-anwers
+  (ds/with-remote-api (:remote-api fixtures/*system*) "akvoflowsandbox"
+    (let [dss (DatastoreServiceFactory/getDatastoreService)
+          form-id (System/currentTimeMillis)
+          form-instance-id (inc form-id)
+          question-id (inc form-id)
+          v (rand)
+          now (Date.)]
+      (doseq [e [(new-question form-id question-id "NUMBER" now)
+                 (new-form-instance form-id form-instance-id now)
+                 (new-answer form-id form-instance-id question-id "VALUE" (str v) now)
+                 (new-answer form-id 0 question-id "VALUE" "1" now)]]
+        (.put dss ^Entity e))
+      (let [answers (stats/get-answers dss form-id question-id)
+            answer (first answers)]
+        (is (= 1 (count answers)))
+        (is (= v answer))))))


added color to the printed exception notifications

--- sidecar/src/figwheel_sidecar/build_middleware/notifications.clj
+++ sidecar/src/figwheel_sidecar/build_middleware/notifications.clj
@@ -191,6 +191,26 @@

 (let [foreground-red "\u001b[31m"
       reset-color "\u001b[0m"]
+  (defmulti report-exception (fn [exception cause] (or (:type cause) (:tag cause))))
+
+  (defmethod report-exception :reader-exception [e {:keys [file line column]}]
+    (println (str foreground-red
+                  (format "ERROR: %s on file %s, line %d, column %d"
+                     (some-> e (.getCause) (.getMessage))
+                     file line column)
+                  reset-color)))
+
+  (defmethod report-exception :cljs/analysis-error [e {:keys [file line column]}]
+    (println (str foreground-red
+                  (format "ANALYSIS ERROR: %s on file %s, line %d, column %d"
+                          (some-> e (.getCause) (.getMessage))
+                          file line column)
+                  reset-color)))
+
+  (defmethod report-exception :default [e _]
+    #_(clj-stacktrace.repl/pst+ e)
+    (stack/print-stack-trace e 30))
+
   (defn handle-exceptions [figwheel-server {:keys [build-options exception id] :as build}]
     (println
      (str foreground-red "Compiling \"" (:output-to build-options) "\" failed."))


Set enrollment cap to be empty string when 0, fix cancel button to be div so it doesn't submit the form

--- src/cljs/elevent_client/pages/events/id/activities/id/edit.cljs
+++ src/cljs/elevent_client/pages/events/id/activities/id/edit.cljs
@@ -50,7 +50,9 @@
       (if-let [activity (seq (d/entity @api/activities-db activity-id))]
         (reset! form (let [activity (into {} activity)]
                        (assoc activity
-                         :EnrollmentCap (str (:EnrollmentCap activity))
+                         :EnrollmentCap (if (> (:EnrollmentCap activity) 0)
+                                          (str (:EnrollmentCap activity))
+                                          "")
                          :TicketPrice   (if (> (:TicketPrice activity) 0)
                                           (string/format "%.2f" (:TicketPrice activity))
                                           ""))))
@@ -63,7 +65,9 @@
                                                       activity-id))]
                                (assoc activity
                                  :EnrollmentCap
-                                 (str (:EnrollmentCap activity))
+                                 (if (> (:EnrollmentCap activity) 0)
+                                   (str (:EnrollmentCap activity))
+                                   "")
                                  :TicketPrice
                                  (if (> (:TicketPrice activity) 0)
                                    (string/format "%.2f" (:TicketPrice activity))
@@ -242,7 +246,7 @@
                (if activity-id "Edit" "Add")
                (create-activity @form)]
               (when activity-id
-                [:button.ui.button
+                [:div.ui.button
                  {:on-click #(js/location.replace (routes/event-activity-add event))}
                  "Cancel"])]]
             [:div.ui.vertical.segment


Typo.

Typo.

--- examples/benchmarks/src/benchmarks/neanderthal_vs_nd4j.clj
+++ examples/benchmarks/src/benchmarks/neanderthal_vs_nd4j.clj
@@ -8,7 +8,7 @@
   (:import org.nd4j.linalg.factory.Nd4j
            org.nd4j.linalg.api.ndarray.INDArray
            org.nd4j.linalg.cpu.nativecpu.NDArray
-           java.util.SplittableRandom.))
+           java.util.SplittableRandom))

 (def m1 (Nd4j/rand 4 4))
 (def m2 (Nd4j/rand 4 4))


Remove serve task from dev-frontend

Remove serve task from dev-frontend

The files will be served from the backend, serve is only needed for debugging/development time, see
README.

--- resources/leiningen/new/lambone/common/dev/boot.clj
+++ resources/leiningen/new/lambone/common/dev/boot.clj
@@ -146,18 +146,15 @@
         cljs-repl (resolve 'adzerk.boot-cljs-repl/cljs-repl)
         cljs (resolve 'adzerk.boot-cljs/cljs)
         cljs-build-deps (resolve 'adzerk.boot-cljs/deps)
-        serve (resolve 'pandeiro.boot-http/serve)
         sass (resolve 'mathias.boot-sassc/sass)]
-    (comp (serve :dir "target")
-          (built-in/watch)
+    (comp (built-in/watch)
           (apply sass (flatten (seq (:sass options))))
           (apply reload (flatten (seq (:reload options))))
           (apply cljs-repl (flatten (seq (:cljs-repl options))))
           (apply cljs (flatten (seq (:cljs options))))
           (if (> @boot.util/*verbosity* 1)
             (built-in/show :fileset true)
-            identity)
-          (built-in/target :dir #{"target"}))))
+            identity))))

 (defn boot-cljs-test-opts
   [options namespaces exit?]


optionally get context from system property

--- dev/bake/core.clj
+++ dev/bake/core.clj
@@ -38,7 +38,8 @@
   (boolean (or (:v *opts*) (:verbose *opts*))))

 (defn current-context []
-  (when-let [context (get-in *opts* [:context 0])]
+  (when-let [context (or (get-in *opts* [:context 0])
+                         (System/getProperty "cake.context"))]
     (symbol context)))

 (defn project-with-context [context]


Minor style tweaks as discussed.

Minor style tweaks as discussed.

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspaces.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspaces.cljs
@@ -69,8 +69,8 @@
 (defn- filter-workspaces [f workspaces]
   (case f
     :all workspaces
-    :complete  (filter (fn [ws] (= "Complete"  (ws "status"))) workspaces)
-    :running   (filter (fn [ws] (= "Running"   (ws "status"))) workspaces)
+    :complete (filter (fn [ws] (= "Complete" (ws "status"))) workspaces)
+    :running (filter (fn [ws] (= "Running" (ws "status"))) workspaces)
     :exception (filter (fn [ws] (= "Exception" (ws "status"))) workspaces)))

 (react/defc WorkspaceList
@@ -145,9 +145,9 @@
              build-text (fn [name f]
                           (str name " (" (count (filter-workspaces f (:workspaces @state))) ")"))]
          [:div {:style {:display "inline-block" :marginLeft "-1em"}}
-          [Button {:text (build-text "All"       :all)       :state state :filter :all}]
-          [Button {:text (build-text "Complete"  :complete)  :state state :filter :complete}]
-          [Button {:text (build-text "Running"   :running)   :state state :filter :running}]
+          [Button {:text (build-text "All" :all) :state state :filter :all}]
+          [Button {:text (build-text "Complete" :complete) :state state :filter :complete}]
+          [Button {:text (build-text "Running" :running) :state state :filter :running}]
           [Button {:text (build-text "Exception" :exception) :state state :filter :exception}]
           [:div {:style {:clear "both"}}]]))}))

@@ -325,7 +325,9 @@
   (map #(assoc % "status" "Complete") workspaces))

 (react/defc Page
-  {:render
+  {:get-initial-state
+   (fn [] {:active-filter :all})
+   :render
    (fn [{:keys [state refs]}]
      [:div {}
       (render-overlay state refs)
@@ -344,8 +346,6 @@
         (:error-message @state) [:div {:style {:color "red"}}
                                   "FireCloud service returned error: " (:error-message @state)]
         :else [comps/Spinner {:text "Loading workspaces..."}])])
-   :get-initial-state
-   (fn [] {:active-filter :all})
    :component-did-mount
    (fn [{:keys [state]}]
      (utils/ajax-orch


+TODO

+TODO

--- src/babel/reader.clj
+++ src/babel/reader.clj
@@ -141,7 +141,7 @@
         target-expression
         (target-timing-fn (babel.generate/generate target-spec target-model))
         source-spec
-        (unify/strip-refs
+        (unify/strip-refs ;; TODO: consider removing strip-refs; not clear if there is any reason why we need to do it.
          (unify/unify
           {:synsem {:sem (unify/get-in target-expression [:synsem :sem])}}
           basic-spec))


throw exception on generation failure earlier than before to permit more accurate diagnostics

--- src/babel/writer.clj
+++ src/babel/writer.clj
@@ -38,11 +38,13 @@

         sentence (engine/generate spec model :enrich true)

+        check (if (nil? sentence)
+                (let [message (str "Could not generate a sentence for spec: " spec " for language: " (:language model)
+                                   " with model named: " (:name model))]
+                  (log/error message)
+                  (throw (Exception. message))))
+
         sentence (merge sentence {:spec spec})
-
-        check (if (nil? sentence)
-                (throw (Exception. (str "Could not generate a sentence for spec: " spec " for language: " (:language model)
-                                        " with model named: " (:name model)))))

         sentence (if (:morph-walk-tree model)
                    (merge ((:morph-walk-tree model) sentence)
@@ -222,10 +224,9 @@
             fo (:morph model)
             surface (fo sentence)]
         (if (empty? surface)
-          (let [err-mesg (str "Surface was empty for expression generated from spec: " spec)]
-            (log/error err-mesg)
-            (log/error (str " expression with empty surface has structure: " (strip-refs sentence)))
-            (throw (Exception. err-mesg))))
+          (let [warn-mesg (str "Surface was empty for expression generated from spec: " spec)]
+            (log/warn (str "sentence: " sentence))
+            (log/warn warn-mesg)))
         (log/info (str "populate-with-language:" language ": surface='"
                        surface "'"))
         (log/debug (str "populate-with-language:" language ": spec='"


Whitespace

Whitespace

--- src/braid/lib/s3.clj
+++ src/braid/lib/s3.clj
@@ -45,14 +45,14 @@
        :auth {:policy policy
               :key api-key
               :signature (->>
-                          (aws/str->bytes policy)
-                          (aws/hmac-sha256
-                           (aws/signing-key
-                            {:aws-api-secret api-secret
-                             :aws-region region
-                             :day day
-                             :service "s3"}))
-                          Hex/encodeHexString)
+                           (aws/str->bytes policy)
+                           (aws/hmac-sha256
+                             (aws/signing-key
+                               {:aws-api-secret api-secret
+                                :aws-region region
+                                :day day
+                                :service "s3"}))
+                           Hex/encodeHexString)
               :credential credential
               :date date}})))


shutdown-agents before reload! to avoid leaking classes

--- src/cake/project.clj
+++ src/cake/project.clj
@@ -35,7 +35,10 @@
     cl))

 (defn reload! []
-  (alter-var-root #'classloader (fn [_] (make-classloader))))
+  (alter-var-root #'classloader
+    (fn [cl]
+      (when cl (eval-in cl '(shutdown-agents)))
+      (make-classloader))))

 (defn reload []
   (alter-var-root #'classloader


Add devcards to test card activation and drag start/end

--- src/cards/cards.cljs
+++ src/cards/cards.cljs
@@ -95,3 +95,39 @@
   {:id 1 :text "Card with a reasonable amount of text in a 300px wide parent"
    :assignees [{:id 2 :username "ada" :name "Ada Lovelace"}
                {:id 3 :username "zuse" :name "Konrad Zuse"}]})
+
+(defcard
+  "## Behaviour")
+
+(defcard
+  "### Card with an activate callback"
+  (fn [state _]
+    (dom/div nil
+      (kanban-card/card
+        (om/computed (:card @state)
+                     {:activate-fn #(swap! state update :counter inc)}))
+      (dom/div nil (str "Activated: " (:counter @state) " times"))))
+  {:card {:id 1 :text "Initial text"} :counter 0}
+  {:inspect-data true :history true})
+
+(defcard
+  "### Card with a drag start callback"
+  (fn [state _]
+    (dom/div nil
+      (kanban-card/card
+        (om/computed (:card @state)
+                     {:drag-fns {:start #(swap! state update :counter inc)}}))
+      (dom/div nil (str "Drag initiated: " (:counter @state) " times"))))
+  {:card {:id 1 :text "Initial text"} :counter 0}
+  {:inspect-data true :history true})
+
+(defcard
+  "### Card with a drag end callback"
+  (fn [state _]
+    (dom/div nil
+      (kanban-card/card
+        (om/computed (:card @state)
+                     {:drag-fns {:end #(swap! state update :counter inc)}}))
+      (dom/div nil (str "Drag ended: " (:counter @state) " times"))))
+  {:card {:id 1 :text "Initial text"} :counter 0}
+  {:inspect-data true :history true})


Deploy to AWS Beanstalk via boot

Deploy to AWS Beanstalk via boot

--- build.boot
+++ build.boot
@@ -7,6 +7,29 @@
 ;; (e.g. CIDER).

 ;; See README.md for more details.
+
+(require '[clojure.java.shell :as sh])
+
+(defn next-version [version]
+  (when version
+    (let [[a b] (next (re-matches #"(.*?)([\d]+)" version))]
+      (when (and a b)
+        (str a (inc (Long/parseLong b)))))))
+
+(defn deduce-version-from-git
+  "Avoid another decade of pointless, unnecessary and error-prone
+  fiddling with version labels in source code."
+  []
+  (let [[version commits hash dirty?]
+        (next (re-matches #"(.*?)-(.*?)-(.*?)(-dirty)?\n"
+                          (:out (sh/sh "git" "describe" "--dirty" "--long" "--tags" "--match" "[0-9].*"))))]
+    (cond
+      dirty? (str (next-version version) "-" hash "-dirty")
+      (pos? (Long/parseLong commits)) (str (next-version version) "-" hash)
+      :otherwise version)))
+
+(def project "edge")
+(def version (deduce-version-from-git))

 (set-env!
  :source-paths #{"sass" "src"}
@@ -36,7 +59,7 @@
    [org.clojure/tools.namespace "0.2.11"]
    [prismatic/schema "1.0.4"]
    [selmer "1.0.4"]
-   [yada "1.1.33" :exclusions [aleph manifold ring-swagger prismatic/schema]]
+   [yada "1.1.35" :exclusions [aleph manifold ring-swagger prismatic/schema]]

    [aleph "0.4.2-alpha8"]
    [manifold "0.1.6-alpha1"]
@@ -65,18 +88,17 @@
          '[edge.system :refer [new-system]])

 (def repl-port 5600)
-(def version "0.1.0-SNAPSHOT")

 (task-options!
  repl {:client true
        :port repl-port}
- pom {:project 'edge
+ pom {:project (symbol project)
       :version version
       :description "A complete Clojure project you can leap from"
       :license {"The MIT License (MIT)" "http://opensource.org/licenses/mit-license.php"}}
  aot {:namespace #{'edge.main}}
  jar {:main 'edge.main
-      :file (str "edge-" version "-standalone.jar")})
+      :file (str project "-" version "-standalone.jar")})

 (deftask dev-system
   "Develop the server backend. The system is automatically started in
@@ -152,3 +174,59 @@
    (uber)
    (jar)
    (target)))
+
+(deftask aws
+  "Call out to AWS"
+  []
+  (dosh "aws" "help"))
+
+(def environment-name (str project "-prod"))
+(def aws-region "eu-west-1")
+(def aws-account-id "247806367507")
+(def zipfile (format "edge-aws-ebs-upload-%s.zip" version))
+
+(deftask create-application
+  "Create AWS Beanstalk application and environment, only call this once."
+  []
+  (println "Creating application:" project)
+  (dosh "aws" "elasticbeanstalk" "create-application"
+        "--application-name" project)
+  (println "Creating environment:" project environment-name)
+  (dosh "aws" "elasticbeanstalk" "create-environment"
+        "--application-name" project
+        "--environment-name" environment-name
+        "--cname-prefix" environment-name
+        "--solution-stack-name" "64bit Amazon Linux 2016.03 v2.1.6 running Docker 1.11.2"))
+
+(deftask docker "Create a zip" []
+  (with-pre-wrap fileset
+    (dosh "zip"
+          (str "target/" zipfile)
+          "Dockerfile"
+          (str "target/" project "-" version "-standalone.jar"))
+    fileset))
+
+(deftask deploy "Deploy application to beanstalk environment" []
+  (comp
+   (println "Building zip file:" zipfile)
+   (dosh "zip"
+          (str "target/" zipfile)
+          "Dockerfile"
+          (str "target/" project "-" version "-standalone.jar"))
+   (println "Uploading zip file to S3:" zipfile)
+   (dosh "aws" "s3" "cp" (str "target/" zipfile)
+         (format "s3://elasticbeanstalk-%s-%s/%s" aws-region aws-account-id zipfile))
+   (println "Creating application version:" version)
+   (dosh "aws" "elasticbeanstalk" "create-application-version"
+         "--application-name" project
+         "--version-label" version
+         "--source-bundle" (format "S3Bucket=elasticbeanstalk-%s-%s,S3Key=%s" aws-region aws-account-id zipfile))
+   (println "Updating environment:" environment-name "->" version)
+   (dosh "aws" "elasticbeanstalk" "update-environment"
+         "--application-name" project
+         "--environment-name" environment-name
+         "--version-label" version)
+   (println "Done")
+   identity))
+
+(deftask show-version "Show version" [] (println version))


Squash - removed blaze graph references from boot script

--- build.boot
+++ build.boot
@@ -22,7 +22,7 @@
          (with-pre-wrap fileset
                         ;; ensure that only one of the server back ends has been selected, otherwise error
                         (if (not= 1 (+ (if allegrograph 1 0)
-                                       (if blazegraph 1 0)
+                                       ;(if blazegraph 1 0)
                                        (if stardog 1 0)))
                           (throw (IllegalArgumentException.
                                    "More than one server implementation has been requested. Please select only one.")) true)
@@ -35,7 +35,7 @@
                                         :server-url  server-url
                                         :server-impl (cond
                                                        allegrograph "allegrograph"
-                                                       blazegraph "blazegraph"
+                                                       ;blazegraph "blazegraph"
                                                        stardog "stardog")}
                                 kb (open-kb params)

@@ -93,7 +93,7 @@
          (with-pre-wrap fileset
                         ;; ensure that only one of the server back ends has been selected, otherwise error
                         (if (not= 1 (+ (if allegrograph 1 0)
-                                       (if blazegraph 1 0)
+                                       ;(if blazegraph 1 0)
                                        (if stardog 1 0)))
                           (throw (IllegalArgumentException.
                                    "Either no or more than one server implementation has been requested. Please select only one.")) true)
@@ -103,11 +103,11 @@
                                         :kb-ice-directory      "/kabob_data/rdf"
                                         :kb-server-impl        (cond
                                                                  allegrograph :allegrograph
-                                                                 blazegraph :blazegraph
+                                                                 ;blazegraph :blazegraph
                                                                  stardog :stardog)}
                                (cond
                                  allegrograph (allegrograph-params)
-                                 blazegraph (blazegraph-params)
+                                 ;blazegraph (blazegraph-params)
                                  stardog (stardog-params))
                                )))

@@ -126,7 +126,7 @@
                         (println "Initializing the KB...")
                         (let [server-impl (:kb-server-impl fileset)]
                           (cond
-                            (= server-impl :blazegraph) :default
+                            ;(= server-impl :blazegraph) :default
                             (= server-impl :allegrograph) :default
                             (= server-impl :stardog) (init-stardog-kb)
                             :else (throw (IllegalArgumentException.
@@ -259,24 +259,13 @@

-(deftask drop-rule []
-         "drops the graph for the active rule"
-         (with-pre-wrap fileset
-                        (let [graph-name (str "<file://" (:data-directory fileset) rule-name ".nt>")]
-
-                          )
-                        fileset))
-
-
-;; Blazegraph-specific tasks
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-
-(deftask virtual-graph-gen []
-         "create a virtual graph encompassing all named graphs so that queries can cross named graphs"
-         (comp (rule :path-to-rule "rules/util/blazegraph/virtualgraph") (print-rule) (run-rule) (print-rule) (load-rule)))
+;(deftask drop-rule []
+;         "drops the graph for the active rule"
+;         (with-pre-wrap fileset
+;                        (let [graph-name (str "<file://" (:data-directory fileset) rule-name ".nt>")]
+;
+;                          )
+;                        fileset))

 ;; KaBOB implementation tasks


Use boot/core 2.7.1 for testing

Use boot/core 2.7.1 for testing

--- build.boot
+++ build.boot
@@ -11,7 +11,7 @@
   :dependencies '[[org.clojure/clojure "1.9.0-alpha15" :scope "provided"]
                   [byte-streams "0.2.2"]
                   [me.raynes/fs     "1.4.6"    :scope "test"]
-                  [boot/core "2.6.0"           :scope "test"]
+                  [boot/core "2.7.1"           :scope "test"]
                   [adzerk/boot-test "1.1.2"    :scope "test"]])

 ;; https://github.com/boot-clj/boot/blob/master/doc/boot.task.built-in.md


Fix check-sources task

Fix check-sources task

--- build.boot
+++ build.boot
@@ -40,14 +40,14 @@
  jar {:main 'github-changelog.cli}
  aot {:all true})

-#_(deftask check-sources
+(deftask check-sources
   "Checks source code for possible improvements/simplifications"
   []
   (comp
    (check/with-bikeshed)
-   check/with-eastwood)
+   (check/with-eastwood)
    (check/with-yagni)
-   (check/with-kibit))
+   (check/with-kibit)))

 (deftask testing-helper
   "Sets up the environment for testing"


boot-flyway dependency updated

boot-flyway dependency updated

--- build.boot
+++ build.boot
@@ -5,7 +5,7 @@
  :dependencies '[[org.clojure/clojure "1.8.0"]
                  [com.taoensso/carmine "2.14.0"]
                  [org.mindrot/jbcrypt "0.3m"]
-                 [mbuczko/boot-flyway "0.1.0-SNAPSHOT"]
+                 [mbuczko/boot-flyway "0.1.1"]
                  [ring/ring-defaults "0.3.0-beta1"]
                  [adzerk/bootlaces "0.1.13" :scope "test"]
                  [zilti/boot-midje "0.2.1-SNAPSHOT" :scope "test"]
@@ -26,7 +26,7 @@
                  [ring-anti-forgery "0.3.0"]
                  [ring-middleware-format "0.7.0"]])

-(def +version+ "0.1.2")
+(def +version+ "0.1.3")

 ;; to check the newest versions:
 ;; boot -d boot-deps ancient


remove bower task from basic build

remove bower task from basic build

--- build.boot
+++ build.boot
@@ -67,9 +67,6 @@
   "Build theLounge for basic deployment"
   []
   (comp
-   (bower :install {:iron-elements  "PolymerElements/iron-elements#^1.0.4"
-                    :paper-elements "PolymerElements/paper-elements#^1.0.5"
-                    :neon-elements  "PolymerElements/neon-elements#^1.0.0"})
    (hoplon :pretty-print true)
    (cljs   :optimizations :advanced :source-map true)
    (serve :handler 'lounge.api/app :port 80)


Fixing settings carnage, adding a clone-index feature

--- joplin.elasticsearch/src/joplin/elasticsearch/database.clj
+++ joplin.elasticsearch/src/joplin/elasticsearch/database.clj
@@ -107,12 +107,17 @@
     (apply merge-with deep-merge maps)
     (last maps)))

+(defn- get-index-settings [es-client index]
+  (-> (esi/get-settings es-client (name index))
+      (get (keyword index))
+      :settings))
+
 (defn update-index
   "Create an index based on a previous index, with updates applied."
   [es-client alias-name & updates]
   (let [current-index (first (find-index-names es-client alias-name))
         mappings (:mappings (get (esi/get-mapping es-client current-index) (keyword current-index)))
-        settings (-> (esi/get-settings es-client (name current-index))
+        settings (-> (get-index-settings es-client current-index)
                      (update-in [:index] dissoc :uuid :version))
         update-map (apply hash-map updates)
         mappings-u (or (:mappings update-map) {})
@@ -121,6 +126,18 @@
                   alias-name
                   :mappings (deep-merge mappings mappings-u)
                   :settings (deep-merge settings settings-u))))
+
+(defn clone-index
+  "Create an index with the same settings and mappings as another index"
+  [es-client source-index-alias target-index-alias]
+  (let [source-index (first (find-index-names es-client source-index-alias))
+        mappings (:mappings (get (esi/get-mapping es-client source-index) (keyword source-index)))
+        settings (-> (get-index-settings es-client source-index)
+                     (update-in [:index] dissoc :uuid :version))]
+    (create-index es-client
+                  target-index-alias
+                  :mappings mappings
+                  :settings settings)))

 (defn- rollback-index-to [es-client alias-name current previous]
   (assign-alias es-client alias-name previous current)


Expression replacement functions for nearly everything

--- src/atom_finder/classifier/macro-operator-precedence.clj
+++ src/atom_finder/classifier/macro-operator-precedence.clj
@@ -1,7 +1,11 @@
 (in-ns 'atom-finder.classifier)
-(import '(org.eclipse.cdt.core.dom.ast IASTNode IASTName IASTIdExpression IASTBinaryExpression IASTUnaryExpression IASTExpressionStatement IASTPreprocessorFunctionStyleMacroDefinition IASTDoStatement IASTLiteralExpression IASTPreprocessorMacroExpansion cpp.ICPPASTTemplateId IASTCastExpression IASTFunctionCallExpression IASTEqualsInitializer IASTIfStatement IASTWhileStatement IASTForStatement IASTDoStatement IASTArraySubscriptExpression IASTExpressionList IASTFieldReference)
+(import '(org.eclipse.cdt.core.dom.ast IASTNode IASTName IASTIdExpression IASTBinaryExpression IASTUnaryExpression IASTExpressionStatement IASTPreprocessorFunctionStyleMacroDefinition IASTDoStatement IASTLiteralExpression IASTPreprocessorMacroExpansion cpp.ICPPASTTemplateId IASTCastExpression IASTFunctionCallExpression IASTEqualsInitializer IASTIfStatement IASTWhileStatement IASTForStatement IASTDoStatement IASTArraySubscriptExpression IASTExpressionList IASTFieldReference
+IASTArrayModifier IASTBinaryExpression IASTCaseStatement IASTCastExpression IASTConditionalExpression IASTDoStatement IASTEnumerationSpecifier IASTExpressionStatement IASTFieldDeclarator IASTFieldReference IASTForStatement IASTFunctionCallExpression IASTIfStatement IASTInitializerExpression IASTReturnStatement IASTSimpleDeclSpecifier IASTSwitchStatement IASTUnaryExpression IASTWhileStatement)
+        '(org.eclipse.cdt.core.dom.ast.cpp ICPPASTArrayDesignator ICPPASTConstructorChainInitializer ICPPASTConstructorInitializer ICPPASTDeleteExpression ICPPASTFunctionDeclarator ICPPASTNewExpression ICPPASTPackExpansionExpression ICPPASTSimpleTypeConstructorExpression ICPPASTTemplatedTypeTemplateParameter ICPPASTTypenameExpression)
+        '(org.eclipse.cdt.core.dom.ast.gnu cpp.IGPPASTSimpleDeclSpecifier c.IGCCASTArrayRangeDesignator c.IGCCASTSimpleDeclSpecifier IGNUASTGotoStatement )
+        '(org.eclipse.cdt.core.dom.ast.c ICASTArrayDesignator)
         '(org.eclipse.cdt.internal.core.parser.scanner ASTFunctionStyleMacroDefinition ASTMacroDefinition)
-        '(org.eclipse.cdt.internal.core.dom.parser.cpp CPPASTUnaryExpression CPPASTExpressionList)
+        '(org.eclipse.cdt.internal.core.dom.parser.cpp CPPASTUnaryExpression CPPASTExpressionList )
         )

 ;; ExpressionWriter adds superfluous parens to cast statements.
@@ -172,28 +176,58 @@
        (map #(-maybe-set-operand! %1 node replacements))
        doall
        (some identity)))
+(def expression-sites [
+[IASTArrayModifier "ConstantExpression"]
+[IASTArraySubscriptExpression "Argument" "ArrayExpression"]
+[IASTBinaryExpression "Operand1" "Operand2"]
+[IASTCaseStatement "Expression"]
+[IASTCastExpression "Operand"]
+[IASTConditionalExpression "LogicalConditionExpression" "PositiveResultExpression" "NegativeResultExpression"]
+[IASTDoStatement "Condition"]
+[IASTEnumerationSpecifier "Value"]
+[IASTEqualsInitializer "InitializerClause"]
+[IASTExpressionStatement "Expression"]
+[IASTFieldDeclarator "BitFieldSize"]
+[IASTFieldReference "FieldOwner" "FieldName"]
+[IASTForStatement "ConditionExpression" "IterationExpression"]
+[IASTFunctionCallExpression "FunctionNameExpression"]
+[IASTIfStatement "ConditionExpression"]
+[IASTInitializerExpression "Expression"]
+[IASTReturnStatement "ReturnValue"]
+[IASTSimpleDeclSpecifier "DeclTypeExpression"]
+[IASTSwitchStatement "ControllerExpression"]
+[IASTUnaryExpression "Operand"]
+[IASTWhileStatement "Condition"]
+[ICASTArrayDesignator "SubscriptExpression"]
+[ICPPASTArrayDesignator "SubscriptExpression"]
+[ICPPASTConstructorChainInitializer "InitializerValue"]
+[ICPPASTConstructorInitializer "Expression"]
+[ICPPASTDeleteExpression "Operand"]
+[ICPPASTFunctionDeclarator "NoexceptExpression"]
+[ICPPASTNewExpression "NewPlacement" "NewInitializer" "PlacementArguments"]
+[ICPPASTPackExpansionExpression  "Pattern"]
+[ICPPASTSimpleTypeConstructorExpression "InitialValue"]
+[ICPPASTTemplatedTypeTemplateParameter "DefaultValue"]
+[ICPPASTTypenameExpression "InitialValue"]
+[IGCCASTArrayRangeDesignator "RangeFloor" "RangeCeiling"]
+[IGCCASTSimpleDeclSpecifier "TypeofExpression"]
+[IGNUASTGotoStatement "LabelNameExpression"]
+[IGPPASTSimpleDeclSpecifier "TypeofExpression"]
+[IASTFunctionCallExpression -maybe-set-args!]
+[IASTExpressionList         -maybe-set-expr-list!]
+ ])

 (s/defn -replace-identifier!
   "If this node is capable of causing syntax ambiguities,
    try replacing parts of it to observe the ambiguity"
   [node :- IASTNode replacements :- {s/Str IASTNode}]
-  (condp instance? node
-    IASTFunctionCallExpression   (-maybe-set-args!      node replacements)
-    IASTExpressionList           (-maybe-set-expr-list! node replacements)
-    IASTIfStatement              (-maybe-set-operands!  node replacements "ConditionExpression")
-    IASTForStatement             (-maybe-set-operands!  node replacements "ConditionExpression")
-    IASTWhileStatement           (-maybe-set-operands!  node replacements "Condition")
-    IASTDoStatement              (-maybe-set-operands!  node replacements "Condition")
-    IASTEqualsInitializer        (-maybe-set-operands!  node replacements "InitializerClause")
-    IASTCastExpression           (-maybe-set-operands!  node replacements "Operand")
-    IASTUnaryExpression          (-maybe-set-operands!  node replacements "Operand")
-    IASTBinaryExpression         (-maybe-set-operands!  node replacements "Operand1" "Operand2")
-    IASTArraySubscriptExpression (-maybe-set-operands!  node replacements "Argument" "ArrayExpression")
-    IASTFieldReference           (-maybe-set-operands!  node replacements "FieldOwner" "FieldName")
-    IASTConditionalExpression    (-maybe-set-operands!  node replacements "LogicalConditionExpression"
-                                                         "PositiveResultExpression" "NegativeResultExpression")
-
-      nil))
+  (->> expression-sites
+       (some
+        (fn [[type & methods]]
+          (when (instance? type node)
+            (if (instance? String (first methods))
+              (apply -maybe-set-operands! node replacements methods)
+              ((first methods) node replacements)))))))

 (s/defn parse-macro
   [macro-exp :- IASTPreprocessorMacroExpansion]


Fix from arohner's review.

Fix from arohner's review.

Use :keys with destructuring
Don't use (do) within

--- src/circle/proto.clj
+++ src/circle/proto.clj
@@ -37,20 +37,18 @@
     (throw (Exception. (str "Failed thing: " args)))))

 (defn autotools-handler
-  [{type :type
-    srcdir :srcdir
-    configurations :configurations
+  [{:keys [type srcdir configurations]
     {autoconf-version :version} :autoconf}]
+
   (when (= type "autotools")
     (let [autoconf-version (or autoconf-version "")
           configurations (or configurations [])
           srcdir (or srcdir "")
           automake "automake"]
-      (do
-        (shell-out (autoconf autoconf-version) :dir srcdir)
-        (shell-out "./configure" :dir srcdir)
-        (shell-out "make" :dir srcdir)
-        (shell-out "make" "check" :dir srcdir)))))
+      (shell-out (autoconf autoconf-version) :dir srcdir)
+      (shell-out "./configure" :dir srcdir)
+      (shell-out "make" :dir srcdir)
+      (shell-out "make" "check" :dir srcdir))))

 (defn download
@@ -63,7 +61,7 @@
 (defn untar
   "Untar a file, into directory"
   [tar-file directory]
-;  (shell-out "tar" "jxf" tar-file "-C" directory)
+  (shell-out "tar" "jxf" tar-file "-C" directory)
   )

 (defn tar-get-directory
@@ -83,10 +81,9 @@
   [url]
   (let [dir "scratch/"
         tar-file (str dir "tip.tar.bz2")]
-    (do
-      (download (str url "/archive/tip.tar.bz2") tar-file)
-      (untar tar-file dir)
-      {:srcdir (fs/join dir (tar-get-directory tar-file))})))
+    (download (str url "/archive/tip.tar.bz2") tar-file)
+    (untar tar-file dir)
+    {:srcdir (fs/join dir (tar-get-directory tar-file))}))

 (defn try-github
   [url]
@@ -101,8 +98,7 @@
         {:srcdir (fs/join dir (tar-get-directory tar-file))}))))

 (defn repo-handler
-  [{repo :repo
-    subdir :subdir :or ""}]
+  [{:keys [repo subdir] :or {subdir ""}}]
   ; if they dont match, return non-nil and try the next one. If they
   ; do match, return the directory the code was checked out into on
   ; success, and raise an exception on failure.


! update clojure deps

! update clojure deps

--- Clojure/benchmark/project.clj
+++ Clojure/benchmark/project.clj
@@ -3,7 +3,8 @@
   :url "http://example.com/FIXME"
   :license {:name "BSD"
             :url ""}
-  :dependencies [[org.clojure/clojure "1.6.0"]]
+  :dependencies [[org.clojure/clojure "1.8.0"]]
   :main ^:skip-aot benchmark.core
   :target-path "target/%s"
-  :profiles {:uberjar {:aot :all}})
+  :profiles {:uberjar {:aot :all}}
+  :certificates ["ZscalerRootCertificate-2048-SHA256.crt.pem"])


(maint) Remove unused args

(maint) Remove unused args

--- src/clj/puppetlabs/services/jruby/jruby_metrics_core.clj
+++ src/clj/puppetlabs/services/jruby/jruby_metrics_core.clj
@@ -246,7 +246,6 @@

 (schema/defn track-successful-borrow-instance!
   [{:keys [borrow-count borrowed-instances]} :- JRubyMetrics
-   jruby-instance :- JRubyInstance
    reason :- jruby-schemas/JRubyEventReason
    id :- jruby-schemas/JRubyWorkerId]
   (.inc borrow-count)
@@ -261,12 +260,12 @@
   (swap! requested-instances assoc event (timestamped-reason reason)))

 (schema/defn track-borrow-instance!
-  [{:keys [borrow-timeout-count borrow-retry-count requested-instances wait-timer] :as metrics} :- JRubyMetrics
+  [{:keys [borrow-timeout-count requested-instances wait-timer] :as metrics} :- JRubyMetrics
    {jruby-instance :instance requested-event :requested-event reason :reason worker-id :worker-id :as event} :- jruby-schemas/JRubyBorrowedEvent]
   (condp (fn [pred instance] (pred instance)) jruby-instance
     nil? (.inc borrow-timeout-count)
     jruby-schemas/shutdown-poison-pill? (log/warn (trs "Not tracking jruby instance borrowed because server is shutting down"))
-    jruby-schemas/jruby-instance? (track-successful-borrow-instance! metrics jruby-instance reason worker-id))
+    jruby-schemas/jruby-instance? (track-successful-borrow-instance! metrics reason worker-id))
   (if-let [ta (get @requested-instances requested-event)]
     (do
       (.update wait-timer
@@ -277,7 +276,7 @@

 (schema/defn track-return-instance!
   [{:keys [return-count borrowed-instances borrow-timer] :as metrics} :- JRubyMetrics
-   {:keys [instance reason worker-id]} :- jruby-schemas/JRubyReturnedEvent]
+   {:keys [instance worker-id]} :- jruby-schemas/JRubyReturnedEvent]
   (.inc return-count)
   (when (jruby-schemas/jruby-instance? instance)
     (if-let [ta (get @borrowed-instances worker-id)]


append! should return the appended node.

--- src/cljs/c2/dom.cljs
+++ src/cljs/c2/dom.cljs
@@ -48,10 +48,11 @@

 (defn append! [container el]
-  (gdom/appendChild (select container)
-                    (if (dom-element? el)
-                      el
-                      (build-dom-elem el))))
+  (let [el (if (dom-element? el)
+             el
+             (build-dom-elem el))]
+    (gdom/appendChild (select container) el)
+    el))

 (defn attr
@@ -83,7 +84,7 @@
       (throw "Cannot merge el into node of a different type"))

     (attr dom-node (:attr el))
-
+
     (when-let [txt (first (filter string? (:children el)))]
       (text dom-node txt))
     (iter {for [dom-child el-child] in (map vector (children dom-node)


Add uniform case to svg#scale.

Add uniform case to svg#scale.

--- src/cljx/c2/svg.cljx
+++ src/cljx/c2/svg.cljx
@@ -18,7 +18,8 @@
 (defn scale [coordinates]
   (match [coordinates]
          [[x y]] (str "scale(" x "," y ")")
-         [{:x x :y y}] (recur [x y])))
+         [{:x x :y y}] (recur [x y])
+         [s] (str "scale(" s ")")))

 (defn ^:cljs get-bounds


Print user@host

Print user@host

--- src/control/core.clj
+++ src/control/core.clj
@@ -269,7 +269,7 @@
         ~else)))

 (defn- perform [host user cluster task taskName arguments]
-  (do (if *enable-logging* (println (cli-bash-bold "Performing " (name taskName) " for " host)))
+  (do (if *enable-logging* (println (cli-bash-bold "Performing " (name taskName) " for " (ssh-client host user))))
       (apply task host user cluster arguments)))

 (defn- arg-count [f]


CMR-2149: Correcting comment.

CMR-2149: Correcting comment.

--- mock-echo-app/src/cmr/mock_echo/client/mock_urs_client.clj
+++ mock-echo-app/src/cmr/mock_echo/client/mock_urs_client.clj
@@ -13,7 +13,7 @@
   (format "%s/users" (conn/root-url conn)))

 (defn create-users
-  "Creates the providers in mock urs given an array of maps with :username and :password"
+  "Creates the users in mock urs given an array of maps with :username and :password"
   [context users]
   (let [{:keys [status body]} (h/request context :urs
                                          {:url-fn create-users-url


Ensure scheduler is started before adding a TriggerListener

--- modules/scheduling/src/test/clojure/wunderboss/scheduling_tests.clj
+++ modules/scheduling/src/test/clojure/wunderboss/scheduling_tests.clj
@@ -228,6 +228,8 @@
   (is (empty? (.scheduledJobs default)))
   (let [p (promise)
         id "auto-unschedule"]
+    ;; Ensure scheduler is started
+    (.start default)
     (-> (.scheduler default)
       .getListenerManager
       (.addTriggerListener (proxy [TriggerListenerSupport] []


only append lot-items if there are any

only append lot-items if there are any

--- src/clj_money/models/transactions.clj
+++ src/clj_money/models/transactions.clj
@@ -180,18 +180,28 @@
                 (select-transaction-items-by-transaction-id storage)
                 (map after-item-read)))))

+(defn- append-lot-items
+  [transaction storage]
+  (if transaction
+    (let [lot-items (fetch-lot-items storage (:id transaction))]
+      (if (seq lot-items)
+        (assoc transaction
+               :lot-items
+               (->> lot-items
+                    (map #(-> %
+                              (dissoc :transaction-id)
+                              (update-in [:lot-action] keyword)))))
+        transaction))
+    transaction))
+
 (defn- after-read
   "Returns a transaction that is ready for public use"
   [storage transaction]
   (when transaction
     (-> transaction
         (update-in [:transaction-date] tc/to-local-date)
-        (assoc :lot-items (->> (:id transaction)
-                               (fetch-lot-items storage)
-                               (map #(-> %
-                                         (dissoc :transaction-id)
-                                         (update-in [:lot-action] keyword)))))
-        (append-items storage))))
+        (append-items storage)
+        (append-lot-items storage))))

 (defn- get-previous-item
   "Finds the transaction item that immediately precedes the specified item"


user into [] instead of dorun

user into [] instead of dorun

--- src/clj_money/models/transactions.clj
+++ src/clj_money/models/transactions.clj
@@ -67,11 +67,11 @@
       validated
       (let [storage (storage storage-spec)
             result (create-transaction storage (before-save validated))
-            items (dorun (map #(->> (assoc % :transaction-id (:id result))
-                                    before-save-item
-                                    (create-transaction-item storage)
-                                    (prepare-item-for-return))
-                              (:items validated)))]
+            items (into [] (map #(->> (assoc % :transaction-id (:id result))
+                                      before-save-item
+                                      (create-transaction-item storage)
+                                      prepare-item-for-return)
+                                (:items validated)))]
         (assoc result :items items)))))

 (defn find-by-id