reduce logging noise; increase levels for errors

--- cimi/src/com/sixsq/slipstream/ssclj/middleware/logger.clj
+++ cimi/src/com/sixsq/slipstream/ssclj/middleware/logger.clj
@@ -39,6 +39,14 @@
     (display-elapsed-time-millis start current-time-millis)
     formatted-request))

+(defn log-response
+  [status formatted-message]
+  (cond
+    (<= 100 status 399) (log/debug formatted-message)
+    (<= 400 status 499) (log/warn formatted-message)
+    (<= 500 status 599) (log/error formatted-message)
+    :else (log/error formatted-message)))
+
 (defn wrap-logger
   "Logs both request and response e.g:
   2016-02-02 11:32:19,310 INFO  - GET /vms [no-authn-info] ?cloud=&offset=0&limit=20&moduleResourceUri=&activeOnly=1 no-body
@@ -48,7 +56,7 @@
   (fn [request]
     (let [start (System/currentTimeMillis)
           formatted-request (format-request request)
-          _ (log/info formatted-request)
-          response (handler request)
-          _ (log/info (format-response formatted-request response start (System/currentTimeMillis)))]
+          _ (log/trace formatted-request)
+          {:keys [status] :as response} (handler request)
+          _ (log-response status (format-response formatted-request response start (System/currentTimeMillis)))]
       response)))


Conditionally turn off CLJS-1989 workaround

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -1859,11 +1859,12 @@
         (orig-print-err-fn (:reset-font theme))))))

 (defn- register-speced-vars
-  "Facilitates temporary workaround for CLJS-1989."
+  "Facilitates workaround if CLJS-1989 not in place."
   [& speced-vars]
-  (let [_speced_vars (eval 'cljs.spec.alpha$macros/_speced_vars)]
-    (doseq [speced-var speced-vars]
-      (swap! _speced_vars conj speced-var))))
+  (when (neg? (gstring/compareVersions *clojurescript-version* "1.9.655"))
+    (let [_speced_vars (eval 'cljs.spec.alpha$macros/_speced_vars)]
+      (doseq [speced-var speced-vars]
+        (swap! _speced_vars conj speced-var)))))

 (register-speced-vars
   `get-arglists)


:lipstick: Minor improvements on outlines component.

--- frontend/src/uxbox/main/ui/workspace/viewport.cljs
+++ frontend/src/uxbox/main/ui/workspace/viewport.cljs
@@ -116,6 +116,21 @@

 (declare remote-user-cursors)

+(mf/defc shape-outlines
+  {::mf/wrap-props false}
+  [props]
+  (let [objects   (unchecked-get props "objects")
+        selected? (or (mf/deref refs/selected-shapes) #{})
+        hover?    (or (mf/deref refs/current-hover) #{})
+        outline?  (set/union selected? hover?)
+        shapes    (->> (vals objects) (filter (comp outline? :id)))
+        transform (mf/deref refs/current-transform)]
+    (when (nil? transform)
+      [:g.outlines
+       (for [shape shapes]
+         [:& outline {:key (str "outline-" (:id shape))
+                      :shape (gsh/transform-shape shape)}])])))
+
 (mf/defc frames
   {:wrap [mf/memo]}
   []
@@ -124,27 +139,17 @@
         root    (get objects uuid/zero)
         shapes  (->> (:shapes root)
                      (map #(get objects %)))]
-    [:g.shapes
-     (for [item shapes]
-       (if (= (:type item) :frame)
-         [:& frame-wrapper {:shape item
-                            :key (:id item)
-                            :objects objects}]
-         [:& shape-wrapper {:shape item
-                            :key (:id item)}]))]))
-
-(mf/defc shape-outlines []
-  (let [selected-shape? (or (mf/deref refs/selected-shapes) #{})
-        hover? (or (mf/deref refs/current-hover) #{})
-        outline? (set/union selected-shape? hover?)
-        data    (mf/deref refs/workspace-data)
-        shapes (->> data :objects vals (filter (comp outline? :id)))
-        current-transform (mf/deref refs/current-transform)]
-    (when (nil? current-transform)
-      [:g.outlines
-       (for [shape shapes]
-         [:& outline {:key (str "outline-" (:id shape))
-                      :shape (gsh/transform-shape shape)}])])))
+    [:*
+     [:g.shapes
+      (for [item shapes]
+        (if (= (:type item) :frame)
+          [:& frame-wrapper {:shape item
+                             :key (:id item)
+                             :objects objects}]
+          [:& shape-wrapper {:shape item
+                             :key (:id item)}]))]
+
+     [:& shape-outlines {:objects objects}]]))

 (mf/defc viewport
   [{:keys [page local layout] :as props}]
@@ -432,8 +437,6 @@
      [:g
       [:& frames {:key (:id page)}]

-      [:& shape-outlines]
-
       (when (seq selected)
         [:& selection-handlers {:selected selected
                                 :zoom zoom


Updating acl test to add more non existent entry titles to acls that are created.

--- test/cmr/system_int_test/search/acls/granule_acl_search_test.clj
+++ test/cmr/system_int_test/search/acls/granule_acl_search_test.clj
@@ -59,7 +59,7 @@
   (do
     ;; -- PROV1 --
     ;; Guests have access to coll1
-    (e/grant-guest (e/gran-catalog-item-id "provguid1" (e/coll-id ["coll1"])))
+    (e/grant-guest (e/gran-catalog-item-id "provguid1" (e/coll-id ["coll1" "collnonexist"])))
     ;; coll 2 has no granule permissions
     ;; Permits granules with access values.
     (e/grant-guest (e/gran-catalog-item-id "provguid1" nil (e/gran-id {:min-value 10
@@ -120,7 +120,7 @@

         ;; - PROV1 -
         gran1 (make-gran 1 coll1)
-        gran2 (make-gran 2 coll1)
+        gran2 (make-gran 2 coll1 {:access-value 1000})

         ;; Permitted through undefined access value
         gran3 (make-gran 3 coll2)
@@ -198,7 +198,7 @@
            guest-permitted-granules {:token guest-token}
            user-permitted-granules {:token user1-token}

-           ;; Test searching with each collecion id as guest and user
+           ;; Test searching with each collection id as guest and user
            ;; Entry title searches
            [gran1 gran2] {:token guest-token :entry-title "coll1"}
            [gran3 gran5] {:token guest-token :entry-title "coll2"}


[#146] Fix instance aliasing in POST "/check_permissions"

--- api/src/clojure/org/akvo/flow_api/endpoint/flumenfly.clj
+++ api/src/clojure/org/akvo/flow_api/endpoint/flumenfly.clj
@@ -5,6 +5,7 @@
             [compojure.core :refer :all]
             [org.akvo.flow-api.boundary.survey :as survey]
             [org.akvo.flow-api.middleware.resolve-alias]
+            [org.akvo.flow-api.boundary.resolve-alias :as resolve-alias]
             [org.akvo.flow-api.middleware.jdo-persistent-manager :as jdo-pm]
             [ring.util.response :refer [response]]
             [org.akvo.flow-api.endpoint.spec :as spec]))
@@ -19,18 +20,21 @@
   (fn [m]
     (rename-keys m rename-map)))

-(defn surveys [remote-api email body]
-  (let [surveys (spec/validate-params survey-list-spec
-                  (map (rename renames) body))]
+(defn surveys [akvo-flow-server-config remote-api email body]
+  (let [surveys (spec/validate-params survey-list-spec (map (rename renames) body))]
     (->> remote-api
-      (survey/filter-surveys email surveys)
-      (map (rename renames-revert))
-      response)))
+         (map #(update %
+                       :instance-id
+                       (fn [instance-id]
+                         (resolve-alias/resolve akvo-flow-server-config instance-id))))
+         (survey/filter-surveys email surveys)
+         (map (rename renames-revert))
+         response)))

 (defn endpoint* [{:keys [remote-api akvo-flow-server-config]}]
   (routes
     (POST "/check_permissions" {:keys [email body]}
-      (surveys remote-api email body))))
+      (surveys akvo-flow-server-config remote-api email body))))

 (defn endpoint [{:keys [akvo-flow-server-config] :as deps}]
   (-> (endpoint* deps)
@@ -49,4 +53,4 @@
     ;(try (catch Exception e (ex-data e)))
     ;:body
     ;(cheshire.core/parse-string true)
-    ))+    ))


Get pixel rendering working.

Get pixel rendering working.

--- dev/org/playasophy/wonderdome/display/processing.clj
+++ dev/org/playasophy/wonderdome/display/processing.clj
@@ -82,8 +82,8 @@
   "Draws a single pixel with the given color. The pixel should be a spherical
   coordinate map."
   [coordinate color]
-  (quil/stroke-weight 5)
-  (quil/stroke (quil/color 255))
+  (quil/stroke-weight 3)
+  (quil/stroke color)
   (->> coordinate
        layout/sphere->cartesian
        scale-point
@@ -152,4 +152,4 @@
   (let [dome (-> radius (+ 0.05) (geodesic/edges 3) geodesic/slice set)]
     (ProcessingDisplay.
       size dome nil
-      (atom [] :validator vector?))))
+      (atom []))))


CMR-4323 fixes entry-titles to entry-title in migration (#174)

--- metadata-db-app/src/migrations/057_regenerate_collection_identifiers.clj
+++ metadata-db-app/src/migrations/057_regenerate_collection_identifiers.clj
@@ -30,7 +30,7 @@
       (for [concept-id concept-ids
             :let [result (j/query (config/db) [(format "select distinct entry_title from metadata_db.%s where concept_id = ?" t)
                                                concept-id])]]
-        (:entry_titles (first result))))))
+        (:entry_title (first result))))))

 (defn up
   "Migrates the database up to version 57."


No longer take unused onyx-id as arg

No longer take unused onyx-id as arg

--- src/leiningen/new/onyx_app/src/onyx_app/jobs/sample_submit_job.clj
+++ src/leiningen/new/onyx_app/src/onyx_app/jobs/sample_submit_job.clj
@@ -48,7 +48,7 @@
                                                    :metrics/sender-fn :onyx.lifecycle.metrics.timbre/timbre-sender}){{/metrics?}}
       true (add-logging :write-lines))))

-(defn -main [onyx-id & args]
+(defn -main [& args]
   (let [config (read-config (clojure.java.io/resource "config.edn") {:profile :dev})
         peer-config (get config :peer-config)
         job (build-job :prod)]


Fixing problem when returing ATOM JSON with date times.

--- search-app/src/cmr/search/results_handlers/atom_json_results_handler.clj
+++ search-app/src/cmr/search/results_handlers/atom_json_results_handler.clj
@@ -12,7 +12,8 @@
             [cmr.search.results-handlers.atom-results-handler :as atom]
             [cmr.search.results-handlers.atom-spatial-results-handler :as atom-spatial]
             [cmr.common.util :as util]
-            [camel-snake-kebab.core :as csk]))
+            [camel-snake-kebab.core :as csk]
+            [cmr.common.joda-time]))

 (defmethod elastic-search-index/concept-type+result-format->fields [:collection :json]
   [concept-type query]


Stop, options and topics working; more testing needed.

--- modules/messaging/src/main/clojure/immutant/messaging.clj
+++ modules/messaging/src/main/clojure/immutant/messaging.clj
@@ -55,10 +55,25 @@
         (.close connection)
         (throw e)))))

-(defn start-queue [name & opts]
+(defn stop-queue [name]
   (if-let [manager (lookup/service "jboss.messaging.default.jms.manager")]
-    (.createQueue manager false name "" false (into-array String []))
+    (.destroyQueue manager name)))
+
+(defn start-queue [name & {:keys [durable selector] :or {durable false selector ""}}]
+  (if-let [manager (lookup/service "jboss.messaging.default.jms.manager")]
+    (and (.createQueue manager false name selector durable (into-array String []))
+         (at-exit #(do (stop-queue name) (println "JC: stopped queue" name))))
     (println "WARN: unable to start queue," name)))
+
+(defn stop-topic [name]
+  (if-let [manager (lookup/service "jboss.messaging.default.jms.manager")]
+    (.destroyTopic manager name)))
+
+(defn start-topic [name & opts]
+  (if-let [manager (lookup/service "jboss.messaging.default.jms.manager")]
+    (and (.createTopic manager false name (into-array String []))
+         (at-exit #(do (stop-topic name) (println "JC: stopped topic" name))))
+    (println "WARN: unable to start topic," name)))

 (defn wait-for-destination [f & [count]]
   "Ignore exceptions, retrying until destination starts up"


(maint) Remove unused import in master_core

It stowed away in a rebase.

--- src/clj/puppetlabs/services/master/master_core.clj
+++ src/clj/puppetlabs/services/master/master_core.clj
@@ -3,7 +3,6 @@
            (clojure.lang IFn)
            (java.util Map Map$Entry)
            (org.jruby RubySymbol)
-           (java.util Map)
            (org.eclipse.jetty.util URIUtil))
   (:require [me.raynes.fs :as fs]
             [puppetlabs.puppetserver.ringutils :as ringutils]


Add info about next planned update

Add info about next planned update

--- src/clj_simple_chart/eurostat/charts/london_ny.clj
+++ src/clj_simple_chart/eurostat/charts/london_ny.clj
@@ -12,6 +12,9 @@
             [clj-simple-chart.line :as line]
             [clj-simple-chart.dateutils :as dateutils]
             [clojure.test :as test]))
+
+; https://ec.europa.eu/eurostat/statistics-explained/index.php/Air_transport_statistics
+; Next planned update: November 2018

 (def marg 10)
 (def two-marg (* 2 marg))


Update petroskatt to new scheme

Update petroskatt to new scheme

--- src/clj_simple_chart/ssb/petroskatt/petroskatt.clj
+++ src/clj_simple_chart/ssb/petroskatt/petroskatt.clj
@@ -23,7 +23,9 @@
         "ContentsCode" "Skatt"
         "Tid"          "*"})

-(def all-data (->> (ssb/fetch 7022 q)
+(test/is (= [:region :skatt :skatteart] (:columns (ssb/fetch 7022 q))))
+
+(def all-data (->> (:data (ssb/fetch 7022 q))
                    (map #(set/rename-keys % {:skatt :value}))))

 (def flat-data (filter #(re-matches #"^\d{2} .*?$" (:region %)) all-data))


Remove use of clj->js because it's slow

Remove use of clj->js because it's slow

Use mutation instead to construct an array of items for use with rbush
since we know what the data should look like and we don't need the
convenience

--- src/cljs/chocolatier/engine/systems/collision.cljs
+++ src/cljs/chocolatier/engine/systems/collision.cljs
@@ -65,9 +65,14 @@

 (defn update-spatial-index
   [index entity-states]
-  (-> index
-      (rbush-clear)
-      (rbush-bulk-insert (clj->js (map entity-state->bounding-box entity-states)))))
+  (let [items (array)]
+    ;; YUK! This is to prevent having to call clj->js which is slow so
+    ;; we will use side effects instead
+    (doseq [e entity-states]
+      (.push items (entity-state->bounding-box e)))
+    (-> index
+        (rbush-clear)
+        (rbush-bulk-insert items))))

 (def spatial-index-location
   [:state :spatial-index])


Update profile version to match firecloud-orchestration

--- src/cljs/org/broadinstitute/firecloud_ui/main.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/main.cljs
@@ -211,7 +211,7 @@
         (fn [{:keys [success? status-text get-parsed-response]}]
           (let [parsed-values (when success? (common/parse-profile (get-parsed-response)))]
             (cond
-              (and success? (>= (int (:isRegistrationComplete parsed-values)) 2))
+              (and success? (>= (int (:isRegistrationComplete parsed-values)) 3))
               (swap! state assoc :registration-status :registered
                 :name (let [name (str (:firstName parsed-values) " " (:lastName parsed-values))]
                         (if (-> name clojure.string/trim empty?)


Using build timings parent for the width. Will also redraw on updates.

--- src-cljs/frontend/components/build_timings.cljs
+++ src-cljs/frontend/components/build_timings.cljs
@@ -3,7 +3,8 @@
             [frontend.models.build :as build])
   (:require-macros [frontend.utils :refer [html]]))

-(def timings-width 800)
+(defn timings-width []  (-> (.querySelector js/document ".build-timings")
+                            (.-offsetWidth)))
 (def bar-height 20)
 (def bar-gap 10)
 (def container-bar-height (- bar-height bar-gap))
@@ -14,12 +15,12 @@
         stop-time  (js/Date. stop-time)]
     (-> (js/d3.time.scale)
         (.domain #js [start-time stop-time])
-        (.range  #js [0 timings-width]))))
+        (.range  #js [0 (timings-width)]))))

 (defn create-root-svg []
   (-> (.select js/d3 ".build-timings")
-      (.append "svg")
-      (.attr "width" timings-width)))
+      (.select "svg")
+      (.attr "width" (timings-width))))

 (defn container-position [step]
   (* bar-height (inc (aget step "index"))))
@@ -75,10 +76,19 @@
 ;;;; Main component
 (defn build-timings [build owner]
   (reify
+    om/IInitState
+    (init-state [_]
+      {:drawn? false})
     om/IDidMount
     (did-mount [_]
-     (draw-chart! build))
-    om/IRender
-    (render [_]
+      (om/set-state! owner :drawn? true)
+      (draw-chart! build))
+    om/IDidUpdate
+    (did-update [_ _ _]
+      (when (om/get-state owner :drawn?)
+        (draw-chart! build)))
+    om/IRenderState
+    (render-state [_ _]
       (html
-       [:div.build-timings]))))
+       [:div.build-timings
+        [:svg]]))))


bugfix

bugfix

--- resources/leiningen/new/closp/integtest/clj/web/admin.clj
+++ resources/leiningen/new/closp/integtest/clj/web/admin.clj
@@ -1,7 +1,7 @@
 (ns {{ns}}.web.admin
   (:require [clojure.test :refer :all]
             [clj-webdriver.taxi :refer :all]
-            [foo.bar.web.setup :as s]))
+            [{{ns}}.web.setup :as s]))

 (use-fixtures :each s/browser-setup)
 (use-fixtures :once s/server-setup)


(TK-10) Cleanup endpoint saving

(TK-10) Cleanup endpoint saving

Cleanup endpoint savings as per suggestions on the PR.
Change definition of state in let statements to (:state s).
Use update-in instead of assoc when updating state atom.

--- src/puppetlabs/trapperkeeper/services/webserver/jetty9_service.clj
+++ src/puppetlabs/trapperkeeper/services/webserver/jetty9_service.clj
@@ -50,75 +50,75 @@

   (add-context-handler [this base-path context-path]
                        (let [s             ((service-context this) :jetty9-server)
-                             state         (:state (:jetty9-server (service-context this)))
+                             state         (:state s)
                              endpoint-info {:type context-type
                                             :base-path base-path
                                             :endpoint  context-path}]
-                         (swap! state assoc :endpoints (conj (:endpoints @state) endpoint-info))
+                         (swap! state update-in [:endpoints] (partial cons endpoint-info))
                          (core/add-context-handler s base-path context-path)))

   (add-context-handler [this base-path context-path context-listeners]
                        (let [s             ((service-context this) :jetty9-server)
-                             state         (:state (:jetty9-server (service-context this)))
+                             state         (:state s)
                              endpoint-info {:type context-type
                                             :base-path base-path
                                             :endpoint  context-path}]
-                         (swap! state assoc :endpoints (conj (:endpoints @state) endpoint-info))
+                         (swap! state update-in [:endpoints] (partial cons endpoint-info))
                          (core/add-context-handler s base-path context-path context-listeners)))

   (add-ring-handler [this handler path]
                     (let [s             ((service-context this) :jetty9-server)
-                          state         (:state (:jetty9-server (service-context this)))
+                          state         (:state s)
                           endpoint-info {:type ring-type
                                          :endpoint path}]
-                      (swap! state assoc :endpoints (conj (:endpoints @state) endpoint-info))
+                      (swap! state update-in [:endpoints] (partial cons endpoint-info))
                       (core/add-ring-handler s handler path)))

   (add-servlet-handler [this servlet path]
                        (let [s             ((service-context this) :jetty9-server)
-                             state         (:state (:jetty9-server (service-context this)))
+                             state         (:state s)
                              endpoint-info {:type servlet-type
                                             :endpoint path}]
-                         (swap! state assoc :endpoints (conj (:endpoints @state) endpoint-info))
+                         (swap! state update-in [:endpoints] (partial cons endpoint-info))
                          (core/add-servlet-handler s servlet path)))

   (add-servlet-handler [this servlet path servlet-init-params]
                        (let [s             ((service-context this) :jetty9-server)
-                             state         (:state (:jetty9-server (service-context this)))
+                             state         (:state s)
                              endpoint-info {:type servlet-type
                                             :endpoint path}]
-                         (swap! state assoc :endpoints (conj (:endpoints @state) endpoint-info))
+                         (swap! state update-in [:endpoints] (partial cons endpoint-info))
                          (core/add-servlet-handler s servlet path servlet-init-params)))

   (add-war-handler [this war path]
                    (let [s             ((service-context this) :jetty9-server)
-                         state         (:state (:jetty9-server (service-context this)))
+                         state         (:state s)
                          endpoint-info {:type war-type
                                         :war war
                                         :endpoint path}]
-                     (swap! state assoc :endpoints (conj (:endpoints @state) endpoint-info))
+                     (swap! state update-in [:endpoints] (partial cons endpoint-info))
                      (core/add-war-handler s war path)))

   (add-proxy-route [this target path]
                    (let [s             ((service-context this) :jetty9-server)
-                         state         (:state (:jetty9-server (service-context this)))
+                         state         (:state s)
                          endpoint-info {:type proxy-type
                                         :host (:host target)
                                         :port (:port target)
                                         :old-prefix path
                                         :new-prefix (:path target)}]
-                     (swap! state assoc :endpoints (conj (:endpoints @state) endpoint-info))
+                     (swap! state update-in [:endpoints] (partial cons endpoint-info))
                      (core/add-proxy-route s target path {})))

   (add-proxy-route [this target path options]
                    (let [s             ((service-context this) :jetty9-server)
-                         state         (:state (:jetty9-server (service-context this)))
+                         state         (:state s)
                          endpoint-info {:type proxy-type
                                         :host (:host target)
                                         :port (:port target)
                                         :old-prefix path
                                         :new-prefix (:path target)}]
-                     (swap! state assoc :endpoints (conj (:endpoints @state) endpoint-info))
+                     (swap! state update-in [:endpoints] (partial cons endpoint-info))
                      (core/add-proxy-route s target path options)))

   (override-webserver-settings! [this overrides]


attributes cleanup: nuvlabox

attributes cleanup: nuvlabox

--- ssclj/tools/src/com/sixsq/slipstream/tools/cli/ssconfigmigrate.clj
+++ ssclj/tools/src/com/sixsq/slipstream/tools/cli/ssconfigmigrate.clj
@@ -53,6 +53,7 @@
   [con]
   (cond
     (= "ec2" (:cloudServiceType con)) (dissoc con :securityGroup)
+    (= "nuvlabox" (:cloudServiceType con)) (dissoc con :orchestratorInstanceType :pdiskEndpoint)
     :else con))

 (defn persist-config!


Remove logging statement

Remove logging statement

--- src/cider_ci/dispatcher/dispatch/next_trial.clj
+++ src/cider_ci/dispatcher/dispatch/next_trial.clj
@@ -114,7 +114,7 @@

 ;#### debug ###################################################################
 ;(debug/wrap-with-log-debug #'next-trial-for-pull)
-(logging-config/set-logger! :level :debug)
+;(logging-config/set-logger! :level :debug)
 ;(logging-config/set-logger! :level :info)
 ;(debug/debug-ns 'cider-ci.utils.http)
-(debug/debug-ns *ns*)
+;(debug/debug-ns *ns*)


Remove unused function

Remove unused function

--- src/clj/cglossa/data_import/metadata_values.clj
+++ src/clj/cglossa/data_import/metadata_values.clj
@@ -85,20 +85,6 @@
                                      (filter #(non-blank? (second %)))
                                      (cons ["corpus_cat" "value"]))))))

-(defn- create-tid-tsv! [corpus tsv-path]
-  (let [orig-tsv-path (-> (str "data/metadata_values/" corpus ".tsv") io/resource .getPath)]
-    (with-open [orig-tsv-file (io/reader orig-tsv-path)
-                tsv-file      (io/writer tsv-path)]
-      (let [[headers & rows] (utils/read-csv orig-tsv-file)
-            tid-header (first headers)]
-        (assert (= "tid" tid-header)
-                (str "Format error: Expected first line to contain column headers "
-                     "with 'tid' (text ID) as the first header."))
-        (utils/write-csv tsv-file (cons ["corpus_cat" "value"]
-                                        (map (fn [row]
-                                               [(str corpus "_tid") (first row)])
-                                             rows)))))))
-
 (defn- create-tid-config! [corpus config-path orig-tsv-path]
   (with-open [tsv-file (io/reader orig-tsv-path)]
     (let [other-cats     (->> (utils/read-csv tsv-file)


Renamed enq-read-float to enq-read-double.

--- src/clojure/uncomplicate/neanderthal/opencl.clj
+++ src/clojure/uncomplicate/neanderthal/opencl.clj
@@ -30,7 +30,7 @@
     (enq-read! queue cl-buf res)
     (aget res 0)))

-(defn ^:private enq-read-float ^double [queue cl-buf]
+(defn ^:private enq-read-double ^double [queue cl-buf]
   (let [res (double-array 1)]
     (enq-read! queue cl-buf res)
     (aget res 0)))
@@ -106,15 +106,15 @@
     (do
       (set-arg! dot-reduce-kernel 2 cl-y)
       (enq-reduce queue dot-reduce-kernel sum-reduction-kernel max-local-size n)
-      (enq-read-float queue reduce-acc)))
+      (enq-read-double queue reduce-acc)))
   (s-nrm2 [_ _]
     (do
       (enq-reduce queue nrm2-reduce-kernel sum-reduction-kernel max-local-size n)
-      (sqrt (enq-read-float queue reduce-acc))))
+      (sqrt (enq-read-double queue reduce-acc))))
   (s-asum [_ _]
     (do
       (enq-reduce queue asum-reduce-kernel sum-reduction-kernel max-local-size n)
-        (enq-read-float queue reduce-acc)))
+        (enq-read-double queue reduce-acc)))
   (s-rot [_ _ cl-y c s]
     (throw (UnsupportedOperationException.
             "TODO.")))


Fixed.

Fixed.

--- src/clj/funstructor/commands.clj
+++ src/clj/funstructor/commands.clj
@@ -97,7 +97,7 @@
         card-idx (get-in command [:data :card-idx])
         target (get-in command [:data :target])
         funstr-idx (get-in command [:data :funstruct-idx])]
-    (update-global-state update-game game-id use-card player-id card-idx funstr-idx)
+    (update-global-state update-game game-id f/use-card player-id card-idx funstr-idx)
     (send-game-updates game-id)))

 (defmethod handle-command "end-turn" [command channel]


advance entity editing logic

advance entity editing logic

--- src/cljs/clj_money/entities.cljs
+++ src/cljs/clj_money/entities.cljs
@@ -1,10 +1,22 @@
 (ns clj-money.entities
-  (:require [clj-money.data :as data]
-            [clj-money.notifications :refer [notify]]))
+  (:require [reagent.core :as r]
+            [clj-money.data :as data]
+            [clj-money.notifications :as notify]))
+
+(def editing-entity (r/atom nil))

 (defn- edit
-  [entity entities]
-  (notify "Edit coming soon!" :info))
+  [entity]
+  (reset! editing-entity entity))
+
+(defn- finish-edit
+  []
+  (notify/warning "Not implemented.")
+  (reset! editing-entity nil))
+
+(defn- cancel-edit
+  []
+  (reset! editing-entity nil))

 (defn- delete
   [entity entities]
@@ -15,8 +27,7 @@
                                             #(= (:id %)
                                                 (:id entity))
                                             old-list))))
-                      (fn [message]
-                        (notify message :danger))))
+                      notify/danger))

 (defn- entity-row
@@ -25,13 +36,20 @@
   [:tr
    [:td (:name entity)]
    [:td
-    [:div.btn-group
-     [:button.btn.btn-xs.btn-info {:on-click #(edit entity entities)
+    [:div.btn-group {:class (when @editing-entity "hidden")}
+     [:button.btn.btn-xs.btn-info {:on-click #(edit entity)
                                    :title "Click here to edit this entity."}
       [:span.glyphicon.glyphicon-pencil {:arial-hidden true}]]
      [:button.btn.btn-xs.btn-danger {:on-click #(delete entity entities)
                                      :title "Click here to remove this entity."}
-      [:span.glyphicon.glyphicon-remove {:arial-hidden true}]]]]])
+      [:span.glyphicon.glyphicon-remove {:arial-hidden true}]]]
+    [:div.btn-group {:class (when (not= (:id @editing-entity) (:id entity)) "hidden")}
+     [:button.btn.btn-xs.btn-success {:on-click finish-edit
+                                      :title "Click here to save your changes to this entity"}
+      [:span.glyphicon.glyphicon-ok {:arial-hidden true}]]
+     [:button.btn.btn-xs.btn-danger {:on-click cancel-edit
+                                     :title "Click here to cancel this edit."}
+      [:span.glyphicon.glyphicon-ban-circle{:arial-hidden true}]]]]])

 (defn- entity-table
   [entities]


A few more helpful reducers functions.

A few more helpful reducers functions.

--- src/clojure/parkour/reducers.clj
+++ src/clojure/parkour/reducers.clj
@@ -1,5 +1,5 @@
 (ns parkour.reducers
-  (:refer-clojure :exclude [map-indexed reductions distinct count first])
+  (:refer-clojure :exclude [map-indexed reductions distinct count first keep])
   (:require [clojure.core.reducers :as r]
             [clojure.core.protocols :as ccp]
             [transduce.reducers :as tr]
@@ -117,6 +117,10 @@
   "Like `second`, but more efficient for indexed collections."
   [coll] (nth coll 1))

+(defn nth2
+  "Third element from indexed collection `coll`."
+  [coll] (nth coll 2))
+
 (defn count
   "Like `count`, but implemented in terms of `reduce`."
   [coll] (reduce (comp inc arg0) 0 coll))
@@ -129,6 +133,10 @@
   "Returns the first item in `coll` for which `(pred item)` is true."
   ([coll] (ffilter identity coll))
   ([pred coll] (reduce (fn [_ x] (if (pred x) (reduced x))) nil coll)))
+
+(def keep
+  "Like `keep`, but implemented in terms of `reduce`"
+  (comp (partial r/remove nil?) r/map))

 (defn distinct-by
   "Remove adjacent duplicate values of `(f x)` for each `x` in `coll`."


Added instructions that build tag-related instructions from integers and push them onto the :exec stack: integer_tagged_instruction integer_tag_exec_instruction integer_tag_code_instruction integer_tag_integer_instruction integer_tag_float_instruction integer_tag_boolean_instruction integer_tag_char_instruction integer_tag_string_instruction integer_tag_zip_instruction integer_tag_genome_instruction

--- src/clojush/instructions/tag.clj
+++ src/clojush/instructions/tag.clj
@@ -155,3 +155,113 @@
                         "_"
                         (str (lrand-int limit))))))
   ([types] (return-tag-instruction-erc types @global-tag-limit)))
+
+(define-registered
+  integer_tagged_instruction
+  ^{:stack-types [:integer :tag :exec]}
+  (fn [state]
+    (if (not (empty? (:integer state)))
+      (push-item (symbol (str "tagged_" (mod (#(if (neg? %) (= %) %) (stack-ref :integer 0 state))
+                                             @global-tag-limit)))
+                 :exec
+                 (pop-item :integer state))
+      state)))
+
+(define-registered
+  integer_tag_exec_instruction
+  ^{:stack-types [:integer :tag :exec]}
+  (fn [state]
+    (if (not (empty? (:integer state)))
+      (push-item (symbol (str "tag_exec_" (mod (#(if (neg? %) (= %) %) (stack-ref :integer 0 state))
+                                               @global-tag-limit)))
+                 :exec
+                 (pop-item :integer state))
+      state)))
+
+(define-registered
+  integer_tag_code_instruction
+  ^{:stack-types [:integer :tag :exec :code]}
+  (fn [state]
+    (if (not (empty? (:integer state)))
+      (push-item (symbol (str "tag_code_" (mod (#(if (neg? %) (= %) %) (stack-ref :integer 0 state))
+                                               @global-tag-limit)))
+                 :exec
+                 (pop-item :integer state))
+      state)))
+
+(define-registered
+  integer_tag_integer_instruction
+  ^{:stack-types [:integer :tag :exec]}
+  (fn [state]
+    (if (not (empty? (:integer state)))
+      (push-item (symbol (str "tag_integer_" (mod (#(if (neg? %) (= %) %) (stack-ref :integer 0 state))
+                                                  @global-tag-limit)))
+                 :exec
+                 (pop-item :integer state))
+      state)))
+
+(define-registered
+  integer_tag_float_instruction
+  ^{:stack-types [:integer :tag :exec :float]}
+  (fn [state]
+    (if (not (empty? (:integer state)))
+      (push-item (symbol (str "tag_float_" (mod (#(if (neg? %) (= %) %) (stack-ref :integer 0 state))
+                                                @global-tag-limit)))
+                 :exec
+                 (pop-item :integer state))
+      state)))
+
+(define-registered
+  integer_tag_boolean_instruction
+  ^{:stack-types [:integer :tag :exec :boolean]}
+  (fn [state]
+    (if (not (empty? (:integer state)))
+      (push-item (symbol (str "tag_boolean_" (mod (#(if (neg? %) (= %) %) (stack-ref :integer 0 state))
+                                                  @global-tag-limit)))
+                 :exec
+                 (pop-item :integer state))
+      state)))
+
+(define-registered
+  integer_tag_char_instruction
+  ^{:stack-types [:integer :tag :exec :char]}
+  (fn [state]
+    (if (not (empty? (:integer state)))
+      (push-item (symbol (str "tag_char_" (mod (#(if (neg? %) (= %) %) (stack-ref :integer 0 state))
+                                               @global-tag-limit)))
+                 :exec
+                 (pop-item :integer state))
+      state)))
+
+(define-registered
+  integer_tag_string_instruction
+  ^{:stack-types [:integer :tag :exec :string]}
+  (fn [state]
+    (if (not (empty? (:integer state)))
+      (push-item (symbol (str "tag_string_" (mod (#(if (neg? %) (= %) %) (stack-ref :integer 0 state))
+                                                 @global-tag-limit)))
+                 :exec
+                 (pop-item :integer state))
+      state)))
+
+(define-registered
+  integer_tag_zip_instruction
+  ^{:stack-types [:integer :tag :exec :zip]}
+  (fn [state]
+    (if (not (empty? (:integer state)))
+      (push-item (symbol (str "tag_zip_" (mod (#(if (neg? %) (= %) %) (stack-ref :integer 0 state))
+                                              @global-tag-limit)))
+                 :exec
+                 (pop-item :integer state))
+      state)))
+
+(define-registered
+  integer_tag_genome_instruction
+  ^{:stack-types [:integer :tag :exec :genome]}
+  (fn [state]
+    (if (not (empty? (:integer state)))
+      (push-item (symbol (str "tag_genome_" (mod (#(if (neg? %) (= %) %) (stack-ref :integer 0 state))
+                                                 @global-tag-limit)))
+                 :exec
+                 (pop-item :integer state))
+      state)))


Fix failing test

Fix failing test

--- code/system-tests/test/system_tests/test_create_seating_plan.clj
+++ code/system-tests/test/system_tests/test_create_seating_plan.clj
@@ -6,5 +6,5 @@
   (testing "Selenium WebDriver"
     (taxi/set-driver! {:browser :phantomjs})
     (taxi/to "http://www.example.com/")
-    (is (.contains (taxi/text "body") "used for illustrative examplez"))
+    (is (.contains (taxi/text "body") "used for illustrative examples"))
     (taxi/quit)))


Omni Complete now also completes imported classes

--- src/de/kotka/gorilla/backend.clj
+++ src/de/kotka/gorilla/backend.clj
@@ -70,14 +70,16 @@
    :children (map #(-> % second var-info) (ns-interns the-namespace))})

 ; Omni Completion
-(defn type-of-var
-  [the-var]
-  (let [the-val (var-get the-var)]
-    (cond
-      (:macro (meta the-var)) "m"
-      (fn? the-val)           "f"
-      (instance? clojure.lang.MultiFn the-val) "f"
-      :else                   "v")))
+(defn type-of
+  [thing]
+  (cond
+    (class? thing)        "c"
+    (:macro (meta thing)) "m"
+    :else                 (let [value (var-get thing)]
+                            (cond
+                              (instance? clojure.lang.MultiFn value) "f"
+                              (fn? value) "f"
+                              :else       "v"))))

 (defn complete-in-namespace
   "Complete the given symbol name in the given namespace."
@@ -91,8 +93,8 @@
                          (every? identity (map #(.startsWith %1 %2)
                                                sym-parts name-parts)))
                   (let [sym-var  (ns-resolve (symbol the-space) (symbol sym))
-                        sym-meta (meta sym-var)
-                        sym-type (type-of-var sym-var)
+                        sym-meta (when (var? sym-var) (meta sym-var))
+                        sym-type (type-of sym-var)
                         arglists (:arglists sym-meta)
                         info     (map #(str "  "
                                             (prn-str (cons (symbol sym) %)))


Update VimClojure for the changes from the lazy branch

--- src/de/kotka/vimclojure/util.clj
+++ src/de/kotka/vimclojure/util.clj
@@ -96,9 +96,10 @@
            argmap (hash-map)]
       (let [arg (first args)]
         (cond
-          (nil? args)  (if-not rest-arg
-                         (thunk argmap)
-                         (throw (Exception. "Missing command line arguments")))
+          (empty? args)  (if-not rest-arg
+                           (thunk argmap)
+                           (throw
+                             (Exception. "Missing command line arguments")))

           (some #{arg} ["-h" "--help" "-?"])
           (print-usage description specs)
@@ -114,7 +115,7 @@
             (condp = (options option)
               :flag   (recur (rest args) (assoc argmap option true))
               :option (if-let [value (second args)]
-                        (recur (nthrest args 2) (assoc argmap option value))
+                        (recur (nthnext args 2) (assoc argmap option value))
                         (throw (Exception.
                                  (str "Missing value for option: " arg))))
               nil     (throw (Exception. (str "Unknown option: " option)))))


Fix bookkeeper log command name

Fix bookkeeper log command name

--- src/onyx/log/commands/assign_bookkeeper_log_id.clj
+++ src/onyx/log/commands/assign_bookkeeper_log_id.clj
@@ -7,21 +7,21 @@
             [onyx.schema :refer [Replica LogEntry Reactions ReplicaDiff State]]
             [onyx.extensions :as extensions]))

-(s/defmethod extensions/apply-log-entry :signal-ready :- Replica
+(s/defmethod extensions/apply-log-entry :assign-bookkeeper-log-id :- Replica
   [{:keys [args]} :- LogEntry replica]
   (update-in replica
              [:state-logs (:job-id args) (:task-id args) (:slot-id args)]
              (fn [logs]
                (conj (vec logs) (:ledger-id args)))))

-(s/defmethod extensions/replica-diff :signal-ready :- ReplicaDiff
+(s/defmethod extensions/replica-diff :assign-bookkeeper-log-id :- ReplicaDiff
   [{:keys [args]} :- LogEntry old new]
   (second (diff (:state-logs old) (:state-logs new))))

-(s/defmethod extensions/reactions :signal-ready :- Reactions
+(s/defmethod extensions/reactions :assign-bookkeeper-log-id :- Reactions
   [{:keys [args]} :- LogEntry old new diff peer-args]
   [])

-(s/defmethod extensions/fire-side-effects! :signal-ready :- State
+(s/defmethod extensions/fire-side-effects! :assign-bookkeeper-log-id :- State
   [{:keys [args message-id]} :- LogEntry old new diff state]
   state)


(SERVER-2917) Ensure old cadir symlink has same perms as actual cadir

This commit updates the `symlink-cadir` function to ensure that the ownership
of the symlink from the old cadir matches those on the new cadir.

--- src/clj/puppetlabs/puppetserver/certificate_authority.clj
+++ src/clj/puppetlabs/puppetserver/certificate_authority.clj
@@ -676,7 +676,16 @@
     (when base
       (when (fs/exists? old-cadir)
         (fs/delete-dir old-cadir))
-      (fs/sym-link old-cadir cadir))))
+      (fs/sym-link old-cadir cadir)
+      ;; Ensure the symlink has the same ownership as the actual cadir.
+      ;; Symlink permissions are ignored in favor of the target's permissions,
+      ;; so we don't have to change those.
+      (let [old-cadir-path (ks-file/str->path old-cadir)
+            cadir-path (ks-file/str->path cadir)
+            owner (Files/getOwner cadir-path ks-file/nofollow-links)
+            group (Files/getAttribute cadir-path "posix:group" ks-file/nofollow-links)]
+        (Files/setOwner old-cadir-path owner)
+        (Files/setAttribute old-cadir-path "posix:group" group ks-file/nofollow-links)))))

 (schema/defn generate-ssl-files!
   "Given the CA settings, generate and write to disk all of the necessary


[#6958] Only render command message when relevant

Signed-off-by: Andrey Shovkoplyas <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/ui/screens/chat/message/message.cljs
+++ src/status_im/ui/screens/chat/message/message.cljs
@@ -15,7 +15,8 @@
             [status-im.utils.platform :as platform]
             [status-im.i18n :as i18n]
             [status-im.ui.components.colors :as colors]
-            [status-im.ui.components.icons.vector-icons :as icons]))
+            [status-im.ui.components.icons.vector-icons :as icons]
+            [status-im.chat.commands.protocol :as protocol]))

 (defn install-extension-message [extension-id outgoing]
   [react/touchable-highlight {:on-press #(re-frame/dispatch
@@ -30,11 +31,16 @@
 (defview message-content-command
   [command-message]
   (letsubs [id->command [:chats/id->command]]
-    (if-let [command (commands-receiving/lookup-command-by-ref command-message id->command)]
-      (commands/generate-preview command command-message)
-      (if-let [extension-id (get-in command-message [:content :params :extension-id])]
+    (let [{:keys [type] :as command} (commands-receiving/lookup-command-by-ref command-message id->command)
+          extension-id (get-in command-message [:content :params :extension-id])]
+      (if (and platform/mobile? extension-id (or (not type) (and type (satisfies? protocol/Extension type)
+                                                                 (not= extension-id (protocol/extension-id type)))))
+        ;; Show install message only for mobile and if message contains extension id and there is no extension installed
+        ;; or installed extension has differen extension id
         [install-extension-message extension-id (:outgoing command-message)]
-        [react/text (str "Unhandled command: " (-> command-message :content :command-path first))]))))
+        (if command
+          (commands/generate-preview command command-message)
+          [react/text (str "Unhandled command: " (-> command-message :content :command-path first))])))))

 (defview message-timestamp [t justify-timestamp? outgoing command? content]
   (when-not command?


Replace deprecated call to .setAutoCommit with .begin

--- src/grafter/rdf4j/repository.clj
+++ src/grafter/rdf4j/repository.clj
@@ -312,7 +312,7 @@

   RepositoryConnection
   (begin [repo]
-    (-> repo (.setAutoCommit false)))
+    (-> repo .begin))

   (commit [repo]
     (-> repo .commit))


unnecessary select removed

unnecessary select removed

--- Clojure-Websockets/MainApp/src/cljs/birdwatch/charts/wordcount_chart.cljs
+++ Clojure-Websockets/MainApp/src/cljs/birdwatch/charts/wordcount_chart.cljs
@@ -15,8 +15,7 @@
 (def ts-w (aget ts-elem "offsetWidth"))
 (def text-defaults {:stroke "none" :fill "#DDD" :fontWeight 500 :fontSize "0.8em" :dy ".35em" :textAnchor "end"})

-(def opts1 [[10 "10 seconds"][30 "30 seconds"][60 "1 minute"][300 "5 minutes"][600 "10 minutes"]])
-(def opts2 [[10 "10 tweets"][100 "100 tweets"][500 "500 tweets"][1000 "1000 tweets"]])
+(def opts [[10 "10 tweets"][100 "100 tweets"][500 "500 tweets"][1000 "1000 tweets"]])

 (def arrows
   {:RIGHT      ["#428bca" "-600,100 200,100 -200,500 100,500 600,0 100,-500 -200,-500 200,-100 -600,-100 "]
@@ -54,12 +53,12 @@
        (for [[idx [text cnt]] indexed]
          ^{:key text}[bar text cnt (* idx 15) 15 (* (- ts-w 190) (/ cnt mx)) idx])
        [:line {:transform "translate(168, 0)" :y 0 :y2 (* cnt 15) :stroke "black"}]]]
-     [:p.legend [:strong "1st trend indicator:"] " position changes in last "
-      [:select {:defaultValue 300000}
-       (for [[v t] opts1] ^{:key v} [:option {:value (* v 1000)} t])]]
-     [:p.legend [:strong "2nd trend indicator:"] " ratio change termCount / totalTermsCounted over last "
+     [:p.legend [:strong "1st trend indicator:"]
+      " recent position changes"]
+     [:p.legend [:strong "2nd trend indicator:"]
+      " ratio change termCount / totalTermsCounted over last "
       [:select {:defaultValue 100}
-       (for [[v t] opts2] ^{:key v} [:option {:value v} t])]]]))
+       (for [[v t] opts] ^{:key v} [:option {:value v} t])]]]))

 (r/render-component [wordcount-barchart] ts-elem)


CMR-2809 Moves a paren

CMR-2809 Moves a paren

--- metadata-db-app/src/cmr/metadata_db/services/concept_service.clj
+++ metadata-db-app/src/cmr/metadata_db/services/concept_service.clj
@@ -27,8 +27,7 @@
             [clojure.string]
             [clj-time.core :as t]
             [cmr.common.time-keeper :as time-keeper]
-            [cmr.metadata-db.services.concept-constraints :as cc])
-  )
+            [cmr.metadata-db.services.concept-constraints :as cc]))

 (def num-revisions-to-keep-per-concept-type


Add a ping point for ELB.

Add a ping point for ELB.

--- src/kixi/eventlog/web_server.clj
+++ src/kixi/eventlog/web_server.clj
@@ -8,6 +8,8 @@

 (defroutes all-routes
   (POST "/events" []  index-resource)
+  (GET "/_elb_status" []  "ALL GOOD")
+  (POST "/_elb_status" []  "ALL GOOD")
   (not-found {:headers {"Content-Type" "application/json"}
               :body "{\"error\": \"No Such Endpoint\"}"}))


Swapped programmes and projects to fix a authz bug

--- src/kixi/hecuba/api/entities.clj
+++ src/kixi/hecuba/api/entities.clj
@@ -60,7 +60,7 @@
           project_id (when entity_id (:project_id (entities/get-by-id (:hecuba-session store) entity_id)))
           programme_id (when project_id (:programme_id (projects/get-by-id (:hecuba-session store) project_id)))]
       (if (and project_id programme_id)
-        (allowed?* programme_id project_id projects programmes roles request-method)
+        (allowed?* programme_id project_id programmes projects roles request-method)
         true))))

 (defn index-post! [store ctx]


Split task loop into more lifecycles

Split task loop into more lifecycles

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -160,6 +160,8 @@
             (advance)))
       (goto-next-batch! state))))

+;; TODO, offer-barrier-syncs via subscription backchannels
+;; Prepare subscribers, do similar thing to offer barriers
 (defn offer-barriers [state]
   (let [event (get-event state)
         messenger (get-messenger state)
@@ -171,11 +173,11 @@
           (if (pos? ret)
             (recur (rest pubs))
             (set-context! state (assoc context :publishers pubs))))
-        (do
-         ;; Move this into separate lifecycle?
-         (println "Unblocking for, windowed?" (:windowed-task? event) "rve" (m/replica-version messenger) (m/epoch messenger))
-         (m/unblock-subscribers! messenger)
-         (advance state))))))
+        (advance state)))))
+
+(defn unblock-subscribers [state]
+  (m/unblock-subscribers! (get-messenger state))
+  (advance state))

 ;; After offer barriers, have notify publishers?
 ;; Then we can unblock subscribers
@@ -193,7 +195,8 @@
                                        :slot-id slot-id})]
     (println "Job completed" job-id task-id (:args entry))
     (info "job completed:" job-id task-id (:args entry))
-    (>!! outbox-ch entry)))
+    (>!! outbox-ch entry)
+    (set-sealed! state true)))

 (defn seal-barriers [state]
   (advance
@@ -203,9 +206,7 @@
         (m/unblock-subscribers! messenger)
         (when (and (m/all-barriers-completed? messenger)
                    (not (sealed? state)))
-          (-> state
-              (set-sealed! true)
-              (complete-job!)))
+          (complete-job! state))
         (m/next-epoch! messenger)
         (let [{:keys [job-id task-id slot-id log]} (get-event state)
               replica-version (m/replica-version messenger)
@@ -226,7 +227,7 @@
     (fn [state]
       (advance (set-event! state (f (get-event state)))))))

-(defn recover-stored-checkpoint
+(defn read-checkpoint
   [{:keys [log job-id task-id slot-id] :as event} checkpoint-type recover]
   (let [checkpointed (extensions/read-checkpoint log job-id recover task-id slot-id checkpoint-type)]
     (if-not (= :beginning checkpointed)
@@ -236,7 +237,7 @@
   (let [{:keys [recover] :as context} (get-context state)
         pipeline (get-pipeline state)
         event (get-event state)
-        stored (recover-stored-checkpoint event :input recover)
+        stored (read-checkpoint event :input recover)
         _ (assert recover)
         _ (println "RECOVER pipeline checkpoint" (:job-id event) (:task-id event) stored)
         next-pipeline (oi/recover pipeline stored)]
@@ -246,9 +247,9 @@

 (defn recover-state
   [state]
-  (let [{:keys [recover] :as context} (get-context state)
-        {:keys [log-prefix task-map windows triggers] :as event} (get-event state)
-        stored (recover-stored-checkpoint event :state recover)
+  (let [{:keys [log-prefix task-map windows triggers] :as event} (get-event state)
+        {:keys [recover] :as context} (get-context state)
+        stored (read-checkpoint event :state recover)
         _ (assert recover)
         recovered-windows (->> windows
                                (mapv (fn [window] (wc/resolve-window-state window triggers task-map)))
@@ -405,6 +406,8 @@
       (#{:input :function} task-type)         (conj {:lifecycle :offer-barriers
                                                      :fn offer-barriers
                                                      :blockable? true})
+      (#{:input :function} task-type)         (conj {:lifecycle :unblock-subscribers
+                                                     :fn unblock-subscribers})
       (#{:input} task-type)                   (conj {:lifecycle :recover-input
                                                      :fn recover-input})
       windowed?                               (conj {:lifecycle :recover-state
@@ -425,6 +428,8 @@
       (#{:input :function} task-type)         (conj {:lifecycle :offer-barriers
                                                      :fn offer-barriers
                                                      :blockable? true})
+      (#{:input :function} task-type)         (conj {:lifecycle :unblock-subscribers
+                                                     :fn unblock-subscribers})
       (#{:input :function :output} task-type) (conj {:lifecycle :before-batch
                                                      :fn (build-lifecycle-invoke-fn event :compiled-before-batch-fn)})
       (#{:input} task-type)                   (conj {:lifecycle :read-batch


removed core async include

removed core async include

--- src/server/client-interface.cljs
+++ src/server/client-interface.cljs
@@ -8,8 +8,7 @@
             [moomoo.config :as config]
             [moomoo.file-hash :as file-hash]
             [moomoo.lastfm :as lastfm])
-  (:require-macros [moomoo.socket :as s :refer [defevent]]
-                   [cljs.core.async.macros :refer [go go-loop]]))
+  (:require-macros [moomoo.socket :as s :refer [defevent]]))

 (defonce socketio (nodejs/require "socket.io"))
 (defonce socketio-redis (nodejs/require "socket.io-redis"))


minor: rename variables

minor: rename variables

--- src/storaged/src/leela/storaged/cassandra/connection.clj
+++ src/storaged/src/leela/storaged/cassandra/connection.clj
@@ -88,17 +88,20 @@
      (warn (format "creating index on %s.%s (%s)" *keyspace* ~table ~column))
      (cql/create-index *cluster* (conn/fqn ~table) ~column (stmt/if-not-exists) ~@body)))

-(defmacro with-connection [[conn endpoint options] & body]
-  `(let [~conn (.connect (client/build-cluster {:hosts ~endpoint
-                                                :retry-policy (policies/logging-retry-policy (policies/retry-policy :fallthrough))
-                                                :credentials (:credentials ~options)
-                                                :load-balancing-policy (policies/token-aware-policy (policies/round-robin-policy))
-                                                :connections-per-host (:connections ~options)
-                                                :max-connections-per-host (:max-connections ~options)}))]
+(defmacro with-connection [[sess endpoint options] & body]
+  `(let [cluster# (client/build-cluster {:hosts ~endpoint
+                                         :retry-policy (policies/logging-retry-policy (policies/retry-policy :fallthrough))
+                                         :credentials (:credentials ~options)
+                                         :load-balancing-policy (policies/token-aware-policy (policies/round-robin-policy))
+                                         :connections-per-host (:connections ~options)
+                                         :max-connections-per-host (:max-connections ~options)})
+         ~sess    (.connect cluster#)]
      (info (format "cassandra/with-connection %s" (dissoc ~options :credentials)))
      (try
        ~@body
-       (finally (.close ~conn)))))
+       (finally
+         (client/disconnect ~sess)
+         (client/shutdown-cluster cluster#)))))

 (defmacro with-consistency [tag & body]
   `(policies/with-consistency-level (policies/consistency-level ~tag)


obsolete file delete

obsolete file delete

--- src/clj_hypergraph_db/hg_parser/hypergraph_config_parser.clj
+++ src/clj_hypergraph_db/hg_parser/hypergraph_config_parser.clj
@@ -1,32 +0,0 @@
-(ns clj_hypergraph_db.hg_parser.hypergraph_config_parser
-  (:require [clj_hypergraph_db.common_parser.common_config_parser :refer :all]))
-
-
-(defn def-type
-  [name & attributes]
-  (def-item :type name attributes))
-
-
-(defn def-named-link
-  [name & attributes]
-  (def-item :named-link name attributes))
-
-
-(defn def-unnamed-link
-  [name & attributes]
-  (def-item :unnamed-link name attributes))
-
-
-(defn with-classifier
-  [name]
-  {:classifier (list name)})
-
-
-(defn from
-  [attribute]
-  {:from (list attribute)})
-
-
-(defn to
-  [attribute]
-  {:to (list attribute)})


Generative check flux-policy :recover, including slot-ids

--- test/onyx/scheduler/balanced_grouping_generative_test.clj
+++ test/onyx/scheduler/balanced_grouping_generative_test.clj
@@ -245,3 +245,68 @@
        (is (= 0 (count (get (get (:allocations replica) job-2-id) t4))))
        (is (= 0 (count (get (get (:allocations replica) job-2-id) t5))))
        (is (= 0 (count (get (get (:allocations replica) job-2-id) t6))))))))
+
+(def grouping-slot-job-id #uuid "f55c14f0-a847-42eb-81bb-0c0390a88608")
+
+(def grouping-slot-job
+  {:workflow [[:a :b] [:b :c]]
+   :catalog [{:onyx/name :a
+              :onyx/plugin :onyx.test-helper/dummy-input
+              :onyx/type :input
+              :onyx/medium :dummy
+              :onyx/batch-size 20}
+
+             {:onyx/name :b
+              :onyx/fn :mock/fn
+              :onyx/type :function
+              :onyx/group-by-kw :mock-key
+              :onyx/min-peers 4
+              :onyx/max-peers 4
+              :onyx/flux-policy :recover
+              :onyx/batch-size 20}
+
+             {:onyx/name :c
+              :onyx/plugin :onyx.test-helper/dummy-output
+              :onyx/type :output
+              :onyx/medium :dummy
+              :onyx/batch-size 20}]
+   :task-scheduler :onyx.task-scheduler/balanced})
+
+(deftest recover-slots
+  (let [job-1-rets (api/create-submit-job-entry
+                    grouping-slot-job-id
+                    peer-config
+                    grouping-slot-job
+                    (planning/discover-tasks (:catalog grouping-slot-job) (:workflow grouping-slot-job)))]
+    (checking
+     "Checking grouping task recovers slots when peers leave"
+     (times 50)
+     [{:keys [replica log peer-choices]}
+      (log-gen/apply-entries-gen
+       (gen/return
+        {:replica {:job-scheduler :onyx.job-scheduler/balanced
+                   :messaging {:onyx.messaging/impl :dummy-messenger}}
+         :message-id 0
+         :entries (-> (log-gen/generate-join-queues (log-gen/generate-peer-ids 11))
+                      (assoc :job-1 {:queue [job-1-rets]})
+                      (assoc :leave-1 {:predicate (fn [replica entry]
+                                                    (some #{:p1} (:peers replica)))
+                                       :queue [{:fn :leave-cluster :args {:id :p1}}]})
+                      (assoc :leave-2 {:predicate (fn [replica entry]
+                                                    (some #{:p2} (:peers replica)))
+                                       :queue [{:fn :leave-cluster :args {:id :p2}}]})
+                      (assoc :leave-3 {:predicate (fn [replica entry]
+                                                    (some #{:p3} (:peers replica)))
+                                       :queue [{:fn :leave-cluster :args {:id :p3}}]})
+                      (assoc :leave-4 {:predicate (fn [replica entry]
+                                                    (some #{:p4} (:peers replica)))
+                                       :queue [{:fn :leave-cluster :args {:id :p4}}]})
+                      (assoc :leave-5 {:predicate (fn [replica entry]
+                                                    (some #{:p5} (:peers replica)))
+                                       :queue [{:fn :leave-cluster :args {:id :p5}}]}))
+         :log []
+         :peer-choices []}))]
+     (let [[t1 t2 t3] (:tasks (:args job-1-rets))]
+       (standard-invariants replica)
+       (is (= #{0 1 2 3} (set (vals (get-in replica [:task-slot-ids grouping-slot-job-id t2])))))
+       (is (= 4 (count (get (get (:allocations replica) grouping-slot-job-id) t2))))))))


fix(cider-nrepl): context information is provided correctly whenever wherever

--- ccw.core/src/clj/ccw/editors/clojure/clojure_proposal_processor.clj
+++ ccw.core/src/clj/ccw/editors/clojure/clojure_proposal_processor.clj
@@ -119,47 +119,6 @@
 (def completion-limit
   "Maximum number of returned results" 50)

-; TODO introduce polymorphism?
-(defn completion-proposal
-  [replacement-string
-   replacement-offset
-   replacement-length
-   cursor-position
-   image
-   display-string
-   filter
-   context-information
-   additional-proposal-info-delay]
-  (let [cp (CompletionProposal.
-             (or replacement-string "")
-             replacement-offset
-             replacement-length
-             cursor-position
-             image
-             (or display-string "")
-             context-information
-             "")] ;; additional-proposal is computed on demand
-    (reify
-      ICompletionProposal
-      (apply [this document] (.apply cp document))
-      (getSelection [this document] (.getSelection cp document))
-      (getAdditionalProposalInfo [this] @additional-proposal-info-delay)
-      (getDisplayString [this] (.getDisplayString cp))
-      (getImage [this] (.getImage cp))
-      (getContextInformation [this] @additional-proposal-info-delay)
-
-      ICompletionProposalExtension6
-      (getStyledDisplayString [this]
-        (let [s (StyledString. (or display-string ""))]
-          (when (seq filter)
-            (doseq [i (reductions (partial + 1) filter)]
-              (if (< i (count display-string))
-                (.setStyle s i 1 StyledString/COUNTER_STYLER)
-                (printf (str "ERROR: Completion proposal trying to apply color style"
-                             "at invalid offset %d for display-string '%s'")
-                        i display-string))))
-          s)))))
-
 (defn context-information
   [context-display-string
    image
@@ -177,6 +136,46 @@
        (getContextInformationPosition [this] position-start))
      {:start position-start
       :stop  position-stop}))
+
+(defn completion-proposal
+  [replacement-string
+   replacement-offset
+   replacement-length
+   cursor-position
+   image
+   display-string
+   filter
+   context-information-delay
+   additional-proposal-info-delay]
+  (let [cp (CompletionProposal.
+             (or replacement-string "")
+             replacement-offset
+             replacement-length
+             cursor-position
+             image
+             (or display-string "")
+             nil ;; context-information is computed on demand
+             nil)] ;; additional-proposal is computed on demand
+    (reify
+      ICompletionProposal
+      (apply [this document] (.apply cp document))
+      (getSelection [this document] (.getSelection cp document))
+      (getAdditionalProposalInfo [this] @additional-proposal-info-delay)
+      (getDisplayString [this] (.getDisplayString cp))
+      (getImage [this] (.getImage cp))
+      (getContextInformation [this] @context-information-delay)
+
+      ICompletionProposalExtension6
+      (getStyledDisplayString [this]
+        (let [s (StyledString. (or display-string ""))]
+          (when (seq filter)
+            (doseq [i (reductions (partial + 1) filter)]
+              (if (< i (count display-string))
+                (.setStyle s i 1 StyledString/COUNTER_STYLER)
+                (printf (str "ERROR: Completion proposal trying to apply color style"
+                             "at invalid offset %d for display-string '%s'")
+                        i display-string))))
+          s)))))

 (defn complete-command
   "Create the complete command to be sent remotely to get back a list of
@@ -343,20 +342,24 @@
                        doc line file]
                 :as metadata} :metadata
                } suggestions]
-          (completion-proposal
-            completion
-            prefix-offset
-            (- offset prefix-offset)
-            (count completion)
-            nil
-            (cond-> completion
-              (and ns (not (.startsWith completion (str ns "/"))))
-                (str " (" ns ")")
-              type
-                (str " - " type))
-            filter
-            (context-info-data completion (+ prefix-offset (count completion)) metadata)
-            (delay (doc/var-doc-info-html (find-var-metadata current-namespace repl completion))))))))) ;; todo remove metadata
+          (let [md-ref (delay (find-var-metadata current-namespace repl completion))]
+            (completion-proposal
+              completion
+              prefix-offset
+              (- offset prefix-offset)
+              (count completion)
+              nil
+              (cond-> completion
+                (and ns (not (.startsWith completion (str ns "/"))))
+                  (str " (" ns ")")
+                type
+                  (str " - " type))
+              filter
+              (delay (context-info-data
+                       completion
+                       (+ prefix-offset (count completion))
+                       @md-ref))
+              (delay (doc/var-doc-info-html @md-ref)))))))))

 (def activation-characters
   "Characters which will trigger auto-completion"


preventing figwheel/start from executing when-not opt none

--- support/src/figwheel/client.cljs
+++ support/src/figwheel/client.cljs
@@ -313,21 +313,22 @@

 (defn start
   ([opts]
-   (defonce __figwheel-start-once__
-     (js/setTimeout
-      #(let [plugins' (:plugins opts) ;; plugins replaces all plugins
-             merge-plugins (:merge-plugins opts) ;; merges plugins
-             system-options (handle-deprecated-jsload-callback
-                             (merge config-defaults
-                                    (dissoc opts :plugins :merge-plugins)))
-             plugins  (if plugins'
-                        plugins'
-                        (merge (base-plugins system-options) merge-plugins))]
-         (set! utils/*print-debug* (:debug opts))
-         #_(enable-repl-print!)
-         (add-plugins plugins system-options)
-         (reloading/patch-goog-base)
-         (socket/open system-options)))))
+   (when-not (nil? goog/dependencies_)
+       (defonce __figwheel-start-once__
+         (js/setTimeout
+          #(let [plugins' (:plugins opts) ;; plugins replaces all plugins
+                 merge-plugins (:merge-plugins opts) ;; merges plugins
+                 system-options (handle-deprecated-jsload-callback
+                                 (merge config-defaults
+                                        (dissoc opts :plugins :merge-plugins)))
+                 plugins  (if plugins'
+                            plugins'
+                            (merge (base-plugins system-options) merge-plugins))]
+             (set! utils/*print-debug* (:debug opts))
+             #_(enable-repl-print!)
+             (add-plugins plugins system-options)
+             (reloading/patch-goog-base)
+             (socket/open system-options))))))
   ([] (start {})))

 ;; legacy interface


Small test refactor.

Small test refactor.

--- test/open_company/integration/authorization/entry_point_auth.clj
+++ test/open_company/integration/authorization/entry_point_auth.clj
@@ -3,9 +3,8 @@
   (:require [midje.sweet :refer :all]
             [open-company.lib.test-setup :as ts]
             [open-company.lib.rest-api-mock :as mock]
+            [open-company.lib.hateoas :as hateoas]
             [open-company.api.common :as common]))
-
-(def options "OPTIONS, GET")

 ;; ----- Test Cases -----

@@ -21,34 +20,35 @@

 ;; ----- Tests -----

+(def options (hateoas/options-response [:options :get]))
+
 (with-state-changes [(before :contents (ts/setup-system!))
                      (after :contents (ts/teardown-system!))]

-  (facts "about OPTIONS on the API entry point"
+  (facts "about failing to access the API entry point"

-    (fact "with a bad JWToken"
-      (let [response (mock/api-request :options "/" {:auth mock/jwtoken-bad})]
-        (:status response) => 401
-        (:body response) => common/unauthorized)))
+    (doseq [method [:options :get]]
+
+      (fact "with a bad JWToken"
+        (let [response (mock/api-request method "/" {:auth mock/jwtoken-bad})]
+          (:status response) => 401
+          (:body response) => common/unauthorized))))
+
+  (fact "about OPTIONS access on the API entry point"

     (fact "with no JWToken"
       (let [response (mock/api-request :options "/" {:skip-auth true})]
         (:status response) => 204
         (:body response) => ""
         ((:headers response) "Allow") => options))
-
+
     (fact "with a valid JWToken"
       (let [response (mock/api-request :options "/")]
         (:status response) => 204
         (:body response) => ""
-        ((:headers response) "Allow") => options))
+        ((:headers response) "Allow") => options)))

-  (facts "about GET on the API entry point"
-
-    (fact "with a bad JWToken"
-      (let [response (mock/api-request :get "/" {:auth mock/jwtoken-bad})]
-        (:status response) => 401
-        (:body response) => common/unauthorized))
+  (fact "about GET access on the API entry point"

     (fact "with no JWToken"
       (let [response (mock/api-request :get "/" {:skip-auth true})]


update cats.labs.promise-spec tests following Promesa version bump

* change the implemenation of `future-ok` to use `delay`.
* remove the unused `future-fail` fn.
* remove the `extract-from-rejected-promise` test.

  It’s not possible to implement this test under the new version of Promesa (as
  the values returned from `promesa.core/rejected` don’t implement the
  `-extract` method.)

  As it’s very unclear what value this test is adding (i.e. it’s not actually
  testing any required or advertised functionality) it seems safer to just
  remove it than reimplement it.

--- test/cats/labs/promise_spec.cljc
+++ test/cats/labs/promise_spec.cljc
@@ -4,31 +4,21 @@
                      [cats.context :as ctx :include-macros true]
                      [cats.core :as m :include-macros true]
                      [cats.labs.promise :as pm]
-                     [promesa.core :as p])
+                     [promesa.core :as p]
+                     [promesa.impl :as pi]
+                     [promesa.exec :as pe])
      :clj  (:require [clojure.test :as t]
                      [cats.builtin :as b]
                      [cats.context :as ctx]
                      [cats.core :as m]
                      [cats.labs.promise :as pm]
-                     [promesa.core :as p])))
+                     [promesa.core :as p]
+                     [promesa.exec :as pe])))

 (defn future-ok
   [sleep value]
-  (p/promise (fn [resolve reject]
-               (p/schedule sleep #(resolve value)))))
-
-(defn future-fail
-  [sleep value]
-  (p/promise (fn [_ reject]
-               (p/schedule sleep #(reject value)))))
-
-
-#?(:cljs
-   (t/deftest extract-from-rejected-promise
-     (let [p1 (p/rejected 42)]
-       (t/is (p/rejected? p1))
-       (t/is (= (p/extract p1) 42)))))
+  (p/delay sleep value))

 (t/deftest chaining-using-bind
   #?(:cljs


Create query operators with somewhat less confusing code.

--- clj_record/query.clj
+++ clj_record/query.clj
@@ -2,43 +2,32 @@
   (:require [clojure.contrib.str-utils :as str-utils]))

-(defmacro generate-where-clauses
-  "Run thru the arguments (collection of vectors), creating each query function
-  using the first item of each vector as the fucntion name, the second item as the
-  operator format for the clause, the third (optional) as the function's argument
-  vector (if not supplied, the generated query accepts one argument), and the fourth to
-  join the operator parameters if the query accepts more than one argument."
-  [& operators]
-  `(do ~@(map
-          (fn [operator]
-            (let [operator-name (symbol (name (first operator)))
-                  operator-format (second operator)
-                  args (nth operator 2 '[value])
-                  params (if (= "&" (name (first args))) (symbol (name (second args))) args)
-                  join-with (nth operator 3 nil)]
-              `(defn ~operator-name ~args
-                 (fn [attribute#]
-                   (let [clause-params-vector#
-                         (reduce
-                          (fn [operator-params# value#]
-                           (conj operator-params# (if (nil? value#) (throw (Exception. "A query argument must not be nil.")) "?"))) [] ~params)
-                         clause-params#
-                         (if (nil? ~join-with)
-                          (apply str clause-params-vector#)
-                          (str-utils/str-join ~join-with clause-params-vector#))]
-                     [(format (str "%s " ~operator-format) (name attribute#) clause-params#) (filter (complement nil?) ~params)])))))
-          operators)))
+(defmacro query-operator
+  ([operator-format]               (query-operator operator-format '[value]))
+  ([operator-format args]          (query-operator operator-format args nil))
+  ([operator-format args join-with]
+    (let [params (if (= "&" (name (first args))) (symbol (name (second args))) args)]
+      `(fn ~args
+        (fn [attribute#]
+          (let [clause-params-vector#
+                  (reduce
+                    (fn [operator-params# value#]
+                      (conj operator-params# (if (nil? value#) (throw (Exception. "A query argument must not be nil.")) "?"))) [] ~params)
+                clause-params#
+                  (if (nil? ~join-with)
+                    (apply str clause-params-vector#)
+                    (str-utils/str-join ~join-with clause-params-vector#))]
+            [(format (str "%s " ~operator-format) (name attribute#) clause-params#) (filter (complement nil?) ~params)]))))))

-(generate-where-clauses
- [:equal "= %s"]
- [:not-equal "<> %s"]
- [:greater-than "> %s"]
- [:greater-than-or-equal ">= %s"]
- [:less-than "< %s"]
- [:less-than-or-equal "<= %s"]
- [:like "LIKE %s" [pattern]]
- [:not-like "NOT LIKE %s" [pattern]]
- [:between "BETWEEN %s" [value1 value2] " AND "]
- [:not-between "NOT BETWEEN %s" [value1 value2] " AND "]
- [:in "IN (%s)" [& values] ", "]
- [:not-in "NOT IN (%s)" [& values] ", "])+(def equal (query-operator "= %s"))
+(def not-equal (query-operator "<> %s"))
+(def greater-than (query-operator "> %s"))
+(def greater-than-or-equal (query-operator ">= %s"))
+(def less-than (query-operator "< %s"))
+(def less-than-or-equal (query-operator "<= %s"))
+(def like (query-operator "LIKE %s" [pattern]))
+(def not-like (query-operator "NOT LIKE %s" [pattern]))
+(def between (query-operator "BETWEEN %s" [value1 value2] " AND "))
+(def not-between (query-operator "NOT BETWEEN %s" [value1 value2] " AND "))
+(def in (query-operator "IN (%s)" [& values] ", "))
+(def not-in (query-operator "NOT IN (%s)" [& values] ", "))


GAWB-1161 -- UI portion (#560)

GAWB-1161 -- UI portion (#560)

--- src/cljs/org/broadinstitute/firecloud_ui/common/components.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/common/components.cljs
@@ -273,6 +273,7 @@
       [:div {:style {:float "left"}}
        (make-field entity "createDate" "Created: " false common/format-date)
        (make-field entity "entityType" "Entity Type: " false)
+       (make-field entity "managers" "Owners: " false (partial clojure.string/join ", "))
        (make-field entity "synopsis" "Synopsis: " false)]
       (common/clear-both)
       [:div {:style {:fontWeight 500 :padding "0.5em 0 0.3em 0"}}


fix missing parens

fix missing parens

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@8945 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- acqEngine/src/org/micromanager/config_editor.clj
+++ acqEngine/src/org/micromanager/config_editor.clj
@@ -171,10 +171,10 @@
           (editingStopped [this e]
             (handle-group-text-changed e))))))

-(defn group-table-model
+(defn group-table-model []
   (proxy [AbstractTableModel] []
     (getColumnCount [] 1)
-    (getRowCount [] (count (core getAvailableConfigGroups))))
+    (getRowCount [] (count (core getAvailableConfigGroups)))))

 (defn show []


adds logging to help with debugging of fallback support (#471)

--- waiter/src/waiter/descriptor.clj
+++ waiter/src/waiter/descriptor.clj
@@ -42,6 +42,12 @@
   "Returns true if the requested service-id has a healthy instance as per the state in the fallback-state."
   [fallback-state service-id]
   (-> fallback-state :healthy-service-ids (contains? service-id)))
+
+(defn retrieve-fallback-state-for
+  "Returns the fallback state for the provided service-ids."
+  [{:keys [available-service-ids healthy-service-ids]} service-ids]
+  {:available-service-ids (set/intersection available-service-ids service-ids)
+   :healthy-service-ids (set/intersection healthy-service-ids service-ids)})

 (defn missing-run-as-user?
   "Returns true if the exception is due to a missing run-as-user validation on the service description."
@@ -85,6 +91,14 @@
             (meters/mark! (metrics/waiter-meter "core" "process-errors"))
             (utils/exception->response e request)))))))

+(defn- log-service-changes
+  "Logs changes to the tracker service ids."
+  [new-service-ids old-service-ids qualifier]
+  (when-let [old-ids-delta (seq (set/difference old-service-ids new-service-ids))]
+    (log/info "no longer" qualifier "services:" old-ids-delta))
+  (when-let [new-ids-delta (seq (set/difference new-service-ids old-service-ids))]
+    (log/info "newly" qualifier "services:" new-ids-delta)))
+
 (defn fallback-maintainer
   "Long running daemon process that listens for scheduler state updates and triggers changes in the
    fallback state. It also responds to queries for the fallback state."
@@ -120,10 +134,13 @@

                     router-state-chan
                     (let [{:keys [all-available-service-ids service-id->healthy-instances]} message
+                          healthy-service-ids' (-> service-id->healthy-instances keys set)
                           current-state' (assoc current-state
                                            :available-service-ids all-available-service-ids
-                                           :healthy-service-ids (-> service-id->healthy-instances keys set))]
+                                           :healthy-service-ids healthy-service-ids')]
                       (reset! fallback-state-atom current-state')
+                      (log-service-changes all-available-service-ids available-service-ids "available")
+                      (log-service-changes healthy-service-ids' healthy-service-ids "healthy")
                       current-state')))
                 (catch Exception e
                   (log/error e "error in fallback-maintainer")
@@ -147,27 +164,36 @@
   [descriptor->previous-descriptor search-history-length fallback-state request-time descriptor]
   (when (-> descriptor :sources :token-sequence seq)
     (let [{{:keys [token->token-data]} :sources} descriptor
+          current-service-id (:service-id descriptor)
           fallback-period-secs (descriptor->fallback-period-secs descriptor)]
-      (when (and (pos? fallback-period-secs)
-                 (let [most-recently-modified-token (sd/retrieve-most-recently-modified-token token->token-data)
-                       token-last-update-time (get-in token->token-data [most-recently-modified-token "last-update-time"] 0)]
-                   (->> (t/seconds fallback-period-secs)
-                        (t/plus (tc/from-long token-last-update-time))
-                        (t/before? request-time))))
-        (loop [iteration 1
-               loop-descriptor descriptor]
-          (when (<= iteration search-history-length)
-            (when-let [previous-descriptor (descriptor->previous-descriptor loop-descriptor)]
-              (let [{:keys [service-id]} previous-descriptor]
-                (if (service-healthy? fallback-state service-id)
-                  (do
-                    (log/info (str "iteration-" iteration) (:service-id descriptor) "falling back to" service-id)
-                    previous-descriptor)
-                  (do
-                    (log/debug (str "iteration-" iteration) "skipping" service-id "as the fallback service"
-                               {:available (service-exists? fallback-state service-id)
-                                :healthy (service-healthy? fallback-state service-id)})
-                    (recur (inc iteration) previous-descriptor)))))))))))
+      (when (pos? fallback-period-secs)
+        (let [most-recently-modified-token (sd/retrieve-most-recently-modified-token token->token-data)
+              token-last-update-time (get-in token->token-data [most-recently-modified-token "last-update-time"] 0)]
+          (if (->> (t/seconds fallback-period-secs)
+                   (t/plus (tc/from-long token-last-update-time))
+                   (t/before? request-time))
+            (loop [iteration 1
+                   loop-descriptor descriptor
+                   attempted-service-ids #{}]
+              (if (<= iteration search-history-length)
+                (if-let [previous-descriptor (descriptor->previous-descriptor loop-descriptor)]
+                  (let [{:keys [service-id]} previous-descriptor]
+                    (if (service-healthy? fallback-state service-id)
+                      (do
+                        (log/info (str "iteration-" iteration) current-service-id "falling back to" service-id)
+                        previous-descriptor)
+                      (recur (inc iteration)
+                             previous-descriptor
+                             (conj attempted-service-ids service-id))))
+                  (log/info "no fallback service found for" current-service-id "after entire history lookup"
+                            {:attempted-service-ids attempted-service-ids
+                             :fallback-state (retrieve-fallback-state-for fallback-state attempted-service-ids)}))
+                (log/info "no fallback found for" current-service-id "after exhausting search history length"
+                          {:attempted-service-ids attempted-service-ids
+                           :fallback-state (retrieve-fallback-state-for fallback-state attempted-service-ids)})))
+            (log/info "fallback period expired for" current-service-id
+                      {:most-recently-modified-token most-recently-modified-token
+                       :token-last-update-time token-last-update-time})))))))

 (defn resolve-descriptor
   "Resolves the descriptor that should be used based on available healthy services.


(TK-258) Change required-or-key from a vector to a set

For consistency with the approach we take in puppet-server.

Addresses: https://github.com/puppetlabs/trapperkeeper-authorization/pull/2#discussion_r37571997

--- src/puppetlabs/trapperkeeper/services/authorization/authorization_core.clj
+++ src/puppetlabs/trapperkeeper/services/authorization/authorization_core.clj
@@ -15,7 +15,7 @@

 (def required-or-key
   "At least one of these keys is required in an auth rule map."
-  [:deny :allow])
+  #{:deny :allow})

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Private


fix 'BETWEEN' for dates in QP

fix 'BETWEEN' for dates in QP

--- src/metabase/driver/generic_sql/query_processor.clj
+++ src/metabase/driver/generic_sql/query_processor.clj
@@ -135,19 +135,22 @@
                                                                                {lon-kw ['< lon-max]}
                                                                                {lon-kw ['> lon-min]}]))
     [_ field-id & _] {(field-id->kw field-id)
-                      (match subclause
-                        ["NOT_NULL" _]        ['not= nil]
-                        ["IS_NULL" _]         ['=    nil]
-                        ["BETWEEN" _ min max] ['between [min max]]
-                        [_ _ value]           (let [value (if (date-field-id? field-id) `(raw ~(format "CAST('%s' AS DATE)" value)) ; cast YYYY-MM-DD string from UI
-                                                              value)]                                                               ; to SQL date if applicable
-                                                (match subclause
-                                                  [">"  _ _] ['>    value]
-                                                  ["<"  _ _] ['<    value]
-                                                  [">=" _ _] ['>=   value]
-                                                  ["<=" _ _] ['<=   value]
-                                                  ["="  _ _] ['=    value]
-                                                  ["!=" _ _] ['not= value])))}))
+                      ;; If the field in question is a date field we need to cast the YYYY-MM-DD string that comes back from the UI to a SQL date
+                      (let [cast-value-if-needed (if (date-field-id? field-id) (fn [value]
+                                                                                `(raw ~(format "CAST('%s' AS DATE)" value)))
+                                                     identity)]
+                        (match subclause
+                          ["NOT_NULL" _]        ['not= nil]
+                          ["IS_NULL" _]         ['=    nil]
+                          ["BETWEEN" _ min max] ['between [(cast-value-if-needed min) (cast-value-if-needed max)]]
+                          [_ _ value]           (let [value (cast-value-if-needed value)]
+                                                  (match subclause
+                                                    [">"  _ _] ['>    value]
+                                                    ["<"  _ _] ['<    value]
+                                                    [">=" _ _] ['>=   value]
+                                                    ["<=" _ _] ['<=   value]
+                                                    ["="  _ _] ['=    value]
+                                                    ["!=" _ _] ['not= value]))))}))

 (defmethod apply-form :filter [[_ filter-clause]]
   (match filter-clause


Add more specs for (is (thrown? ...)) assertions

--- src/test/clojure/com/stuartsierra/lazytest_spec.clj
+++ src/test/clojure/com/stuartsierra/lazytest_spec.clj
@@ -3,7 +3,8 @@
          :only (describe spec spec?
                          is given defcontext
                          context? ok? success?
-                         pending? error? container?)]))
+                         pending? error? container?
+                         thrown? thrown-with-msg?)]))

 (defcontext dummy-context-1 [] 1)

@@ -20,8 +21,26 @@
 (defcontext failing-assertion [it is-without-givens]
   (second (:children it)))

+(defcontext is-that-throws []
+  (is (/ 1 0)))
+
+(defcontext throwing-assertion [it is-that-throws]
+  (first (:children it)))
+
+(defcontext is-thrown-assertion []
+  (first (:children (is (thrown? java.lang.ArithmeticException (/ 1 0))))))
+
+(defcontext is-thrown-assertion-wrong-type []
+  (first (:children (is (thrown? java.lang.IndexOutOfBoundsException (/ 1 0))))))
+
+(defcontext is-thrown-assertion-no-throw []
+  (first (:children (is (thrown? java.lang.Exception (= 1 1))))))
+
+(defcontext empty-is []
+  (is ))
+
 (describe
- *ns*
+ *ns*
  (spec is-spec "The 'is' macro"
        (given [it is-without-givens]
               (spec "without any givens"
@@ -81,36 +100,92 @@
                                         (every? context? (:contexts (first (:children it)))))))))))

  (spec assertions-spec "Assertions, when invoked"
-       (given [it passing-assertion]
+       (given [a passing-assertion]
               (spec "should return an object"
-                    (is (not (nil? (it)))
+                    (is (not (nil? (a)))
                         "that supports success?"
-                        (ok? (success? (it)))
+                        (ok? (success? (a)))
                         "that supports pending?"
-                        (ok? (pending? (it)))
+                        (ok? (pending? (a)))
                         "that supports error?"
-                        (ok? (error? (it)))
+                        (ok? (error? (a)))
                         "that supports container?"
-                        (ok? (container? (it)))))))
+                        (ok? (container? (a))))))

- (spec passing-assertion "A passing assertion"
-       (given [it passing-assertion]
-              (is "should return true for success?"
+       (spec "and passing"
+             (given [a passing-assertion]
+                    (is "should be success?"
+                        (true? (success? (a)))
+                        "should not be error?"
+                        (false? (error? (a)))
+                        "should not be pending?"
+                        (false? (pending? (a)))
+                        "should not be container?"
+                        (false? (container? (a))))))
+
+       (spec "and failing"
+             (given [a failing-assertion]
+                    (is "should not be success?"
+                        (false? (success? (a)))
+                        "should not be error?"
+                        (false? (error? (a)))
+                        "should not be pending?"
+                        (false? (pending? (a)))
+                        "should not be container?"
+                        (false? (container? (a))))))
+
+       (spec "and throwing an exception"
+             (given [a throwing-assertion]
+                    (is "should not be success?"
+                        (false? (success? (a)))
+                        "should be error?"
+                        (true? (error? (a)))
+                        "should not be pending?"
+                        (false? (pending? (a)))
+                        "should not be container?"
+                        (false? (container? (a)))))))
+
+ (spec empty-is-spec "An empty 'is' expression"
+       (given [it empty-is]
+              (is "should not be success?"
                   (true? (success? (it)))
-                  "should return false for error?"
+                  "should not be error?"
                   (false? (error? (it)))
-                  "should return false for pending?"
-                  (false? (pending? (it)))
-                  "should return false for container?"
-                  (false? (pending? (it))))))
+                  "should be pending?"
+                  (true? (pending? (it)))
+                  "should be container?"
+                  (false? (true? (it))))))

-  (spec failing-assertion "A failing assertion"
-       (given [it failing-assertion]
-              (is "should return false for success?"
-                  (false? (success? (it)))
-                  "should return false for error?"
-                  (false? (error? (it)))
-                  "should return false for pending?"
-                  (false? (pending? (it)))
-                  "should return false for container?"
-                  (false? (pending? (it)))))))
+ (spec is-thrown-spec "An (is (thrown? ...)) assertion"
+       (given [a is-thrown-assertion]
+              (spec "that passes"
+                    (is "should be success?"
+                        (true? (success? (a)))
+                        "should not be error?"
+                        (false? (error? (a)))
+                        "should not be pending?"
+                        (false? (pending? (a)))
+                        "should not be container?"
+                        (false? (container? (a))))))
+
+       (given [a is-thrown-assertion-wrong-type]
+              (spec "that throws the wrong type"
+                    (is "should not be success?"
+                        (false? (success? (a)))
+                        "should be error?"
+                        (true? (error? (a)))
+                        "should not be pending?"
+                        (false? (pending? (a)))
+                        "should not be container?"
+                        (false? (container? (a))))))
+
+       (given [a is-thrown-assertion-no-throw]
+              (spec "that throws nothing"
+                    (is "should not be success?"
+                        (false? (success? (a)))
+                        "should not be error?"
+                        (false? (error? (a)))
+                        "should not be pending?"
+                        (false? (pending? (a)))
+                        "should not be container?"
+                        (false? (container? (a))))))))