WIP on Welcome

WIP on Welcome

--- src/re_demo/welcome.cljs
+++ src/re_demo/welcome.cljs
@@ -2,29 +2,24 @@
   (:require [re-com.core   :refer [h-box v-box box gap line title label hyperlink-href input-text p]]
             [re-demo.utils :refer [panel-title title2]]))

-(defn named-params
+
+(defn welecome
   []
   [v-box
+   :size     "auto"
+   ;:width    "600px"
    :children [
-              [title :level :level2 :label "Named Parameters"]
+              [p
+               "Re-com is a library of ClojureScript UI components, built on top of "
+               [hyperlink-href
+                :label "Reagent"
+                :href "https://github.com/reagent-project/reagent"
+                :target "_blank"]
+               "."]
+              [p "It contains the sort of layout and controls you'd need to build a desktop-class app."]

-               [p  "re-com components take " [:span.bold "named parameters"] ", rather than " [:span.bold "positional parameters "]]
-               [p "When you use a re-com component like " [:code "checkbox"] ", you will not be asked to use positional parameters like this:"
-               [:pre "[checkbox
-               \"Show Status Icon?\"
-               status-icon?
-               (fn [new-val] (reset! status-icon? new-val))]"]
-               ]
-              [:pre
-               {:style {:width "40em"}}
-               "[checkbox
-  :label     \"Show Status Icon?\" "
-               [input-text  :model "hello" :on-change #()]

-               "
-  :model     status-icon?      ; a ratom
-  :on-change (fn [new-val] (reset! status-icon? new-val))]"]]])
-
+              ]])

 (defn this-app
   []
@@ -39,24 +34,44 @@
                 [:li "something of a test harness"]]]]])

-(defn first-column
+(defn named-params
   []
   [v-box
-   :size     "auto"
-   ;:width    "600px"
    :children [
-              [p
-               "Re-com is a library of ClojureScript UI components, built on top of "
+              [title :level :level2 :label "Named Parameters"]
+
+              [p  "re-com components take " [:span.bold "named parameters"] ", rather than " [:span.bold "positional parameters"] "."]
+              [p "So, use of a re-com component like " [:span.bold "checkbox"] ", looks like this:"]
+              [:pre
+               {:style {:width "450px"}}
+               "[checkbox
+  :label     \"Show Status Icon?\"
+  :model     status-icon?      ; a ratom
+  :on-change (fn [new-val] (reset! status-icon? new-val))]"]
+              [p "Notice how each parameter has a short, leading keyword name."]
+              [p "Using positional parameters (no naming), is more concise while using named parameters is more explicit.
+              Both approaches have their merits - a situation which invariably leads to highly contested
+              Religious Wars. "]
+              [p "We've gone with named parameters in the API because:"
+               [:ol
+                [:li "the code seems easier to read (despite being longer)"]
+                [:li "as a result the code seems more understandable - something we value above all other considerations."]
+                [:li "optionality - not all parameters have to be supplied, defaults can be introduced"]
+                [:li "API flexibility - new parameters are easily added"]]]
+              [p "Read further analysis "
                [hyperlink-href
-                :label "Reagent"
-                :href "https://github.com/reagent-project/reagent"
-                :target "_blank"]
-               "."]
-              [p "It contains the sort of layout and controls you'd need to build a desktop-class app."]
-              [this-app]
-              [gap :size "30px"]
-              [line]
-              [named-params]]])
+                :label "here"
+                :href "https://clojurefun.wordpress.com/2012/08/13/keyword-arguments-in-clojure/"
+                :target "_blank"] "."]
+              ]])
+
+
+(defn param-validation
+  []
+  [v-box
+   :children [
+              [title :level :level2 :label "Named Parameters"]
+              ]])

 (defn panel2
@@ -66,10 +81,14 @@
    ;:width    "600px"
    :children [[panel-title "Welcome"]
               [gap :size "15px"]
+              [welecome]
+              [this-app]
+              [gap :size "30px"]
+              [line]
+
               [h-box
                :gap      "100px"
-               :children [[first-column]
-                          [first-column]]]]])
+               :children [[named-params]]]]])


register-pure: added code to enable spec checking of the fn args

--- src/re_frame/subs-2.cljs
+++ src/re_frame/subs-2.cljs
@@ -34,9 +34,6 @@
     (map? data)  (fmap deref data)
     (coll? data) (map deref data)
     :else @data))
-
-(s/fdef register-pure
-        :args ::args)

 (defn register-pure
   "This fn allows the user to write a 'pure' subscription
@@ -99,4 +96,9 @@
       (subs/register ;; the simple case with no subs
          sub-name
          (fn [db q-vec d-vec]
-           (ratom/make-reaction (fn [] (f @db q-vec d-vec))))))))+           (ratom/make-reaction (fn [] (f @db q-vec d-vec))))))))
+
+#_(s/fdef register-pure
+        :args ::args)
+
+#_(s/instrument #'register-pure)


Using let in aput to avoid multiple evals.

--- src/cbfg/ago.clj
+++ src/cbfg/ago.clj
@@ -55,10 +55,11 @@
          result#)))

 (defmacro aput [actx ch msg]
-  `(do (actx-event ~actx [:aput :before '~ch ~ch ~msg])
-       (let [result# (cljs.core.async/>! ~ch ~msg)]
-         (actx-event ~actx [:aput :after '~ch ~ch ~msg result#])
-         result#)))
+  `(let [msg# ~msg]
+     (actx-event ~actx [:aput :before '~ch ~ch msg#])
+     (let [result# (cljs.core.async/>! ~ch msg#)]
+       (actx-event ~actx [:aput :after '~ch ~ch msg# result#])
+       result#)))

 (defmacro aalts [actx chs]
   `(do (actx-event ~actx [:aalts :before '~chs ~chs])
@@ -70,5 +71,6 @@
   `(cljs.core.async/timeout ~delay))

 (defmacro aput-close [actx ch msg]
-  `(do (aput ~actx ~ch ~msg)
-       (aclose ~actx ~ch)))
+  `(let [msg# ~msg]
+     (aput ~actx ~ch msg#)
+     (aclose ~actx ~ch)))


whitespace adjust

whitespace adjust

--- src/polismath/darwin/core.clj
+++ src/polismath/darwin/core.clj
@@ -1,4 +1,5 @@
 ;; Copyright (C) 2012-present, Polis Technology Inc. This program is free software: you can redistribute it and/or  modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 (ns polismath.darwin.core
   "The darwin.core namespace wraps the more pure (+ writing files/zips) code in darwin.export. Deals with parsing the
   params, updating the db status, uploading to aws, etc. This gets hooked up in the tasks namespace."


fix infinite nils error

fix infinite nils error

--- src/cake/core.clj
+++ src/cake/core.clj
@@ -145,7 +145,7 @@
         (.write (prn-str [ns ns-forms body] *vars*))
         (.flush))
       (loop [line (.readLine reader)]
-        (when-not (= ":bake.core/result" line)
+        (when-not (or (nil? line) (= ":bake.core/result" line))
           (println line)
           (recur (.readLine reader))))
       (let [result (read-string (.readLine reader))]


fix subprojects

fix subprojects

--- src/cake/deps.clj
+++ src/cake/deps.clj
@@ -30,8 +30,7 @@
         (get *config* (str "subproject." (name dep))))))

 (defn install-subprojects! []
-  (doseq [type (keys dep-types)
-          dep  (keys (*project* type))]
+  (doseq [dep (keys (:dependencies *project*))]
     (when-let [path (subproject-path dep)]
       (with-root path
         (cake-exec "install")))))


Don't return until peer has been stopped. Avoids stack traces in logs.

--- src/onyx/api.clj
+++ src/onyx/api.clj
@@ -125,26 +125,32 @@

                        (let [restart-ch (:dead-restart-tail-ch (:peer live))
                              [v ch] (alts!! [stop-ch restart-ch] :priority true)]
-                         (if (= ch stop-ch)
-                           (try
-                             (component/stop live)
-                             :stopped
-                             (catch Exception e
-                               (warn e)
-                               :stopped))
-                           (try
-                             (component/stop live)
-                             nil
-                             (catch Exception e
-                               (warn e)
-                               :stopped)))))
+                         (try
+                           (if (= ch stop-ch)
+                             (try
+                               (component/stop live)
+                               :stopped
+                               (catch Exception e
+                                 (warn e)
+                                 :stopped))
+                             (try
+                               (component/stop live)
+                               nil
+                               (catch Exception e
+                                 (warn e)
+                                 :stopped)))
+                           (finally
+                            (>!! v true)))))
                      (catch Exception e
                        (warn e)
                        (warn "Virtual peer failed, backing off and rebooting...")
                        (Thread/sleep (or (:onyx.peer/retry-start-interval config) 2000))
                        nil))]
                (or rets (recur)))))
-         :shutdown-fn (fn [] (>!! stop-ch true))}))
+         :shutdown-fn (fn []
+                        (let [ack-ch (chan)]
+                          (>!! stop-ch ack-ch)
+                          (<!! ack-ch)))}))
     (range n))))

 (defn start-distributed-coordinator [opts]


Delete trailing whitespaces.

Delete trailing whitespaces.

--- src/cljs/map.cljs
+++ src/cljs/map.cljs
@@ -9,9 +9,9 @@
                    [shoreleave.remotes.macros :as macros]))

 (blade/bootstrap)
-
+
 (def mymap (-> L .-mapbox (.map "map" "examples.map-9ijuk24y")
-               (.setView [45 3.215] 6)))
+               (.setView [45 3.215] 6)))

 (def stopper "stop")
 (def lang (.-language js/navigator))


Increase Kafka's max message size (same as prod)

--- resources/spec.clj
+++ resources/spec.clj
@@ -2,12 +2,12 @@
 ;; License, v. 2.0. If a copy of the MPL was not distributed with this
 ;; file, You can obtain one at http://mozilla.org/MPL/2.0/.

-;;;; Production settings.
+;;;; Development settings.

 {:http-kit {:port 8080
             :max-body 52428800} ; 50 mb
  :netty {:port 8090
-         :zero-copy false
+         :zero-copy true
          :max-http-chunk-length 1073741824 ; 1 gb
          :max-channel-memory-size 1048576 ; 1 mb
          :max-total-memory-size 1048576} ; 1 mb
@@ -18,11 +18,10 @@
         :port 9042}
  :session-store {:ttl 60}
  :kafka {:server {:port 9090
-                  :brokerid 1
+                  :broker.id 1
+                  :message.max.bytes 16777216
                   :log.dir "target/kafka-log"
-                  :zk.connect "localhost:2181"}
-         :producer {:serializer.class "nl.storm.MessagePackVOSerializer"
-                    :zk.connect "localhost:2181"}}
+                  :zookeeper.connect "localhost"}}
  :elastic {}
  :modules {:resolve-dependencies true
            :isolates ["containium.*"
@@ -43,4 +42,5 @@
                       "potemkin.*"
                       "flatland.*"
                       "useful.*"]}
- :fs {:deployments "deployments"}}
+ :repl {:port 13337}
+ :fs {:deployments "dev-resources/deployments"}}


Prevent play! from throwing on systems with no audio output

It's possible that we could detect the presence/absence of an audio
device using the Java Sound API AudioSystem, but it's not clear to me
that would be more robust.  This will also change problems like trying to
play an supported format, or passing a non-existent file name into a
printed warning instead of a hard-failure.

--- boot/worker/src/boot/notify.clj
+++ boot/worker/src/boot/notify.clj
@@ -17,13 +17,17 @@

 (defn play! [file]
   (fg-first-time!
-    (future
-      (-> (or (.getResourceAsStream (clojure.lang.RT/baseLoader) file)
-            (FileInputStream. (io/file file))
-            (or (throw (RuntimeException. (str file " not found.")))))
-        java.io.BufferedInputStream.
-        javazoom.jl.player.Player.
-        .play))))
+   (future
+     (try
+       (-> (or (.getResourceAsStream (clojure.lang.RT/baseLoader) file)
+               (FileInputStream. (io/file file))
+               (throw (RuntimeException. (str file " not found."))))
+           java.io.BufferedInputStream.
+           javazoom.jl.player.Player.
+           .play)
+       (catch Exception e
+         (util/warn "\nError attempting to play sound file: %s\n\n"
+                    (.getMessage e)))))))

 (defn success! [theme file] (play! (or file (path-for theme "success"))))
 (defn failure! [theme file] (play! (or file (path-for theme "failure"))))


Update core.clj

Update core.clj

--- src/swagger_gen/core.clj
+++ src/swagger_gen/core.clj
@@ -95,11 +95,12 @@
          (normalize-swagger-spec)))

 (defn render-swagger
-  "Render a swagger spec to a given template. If options are passed then
-   merge them into the data from spec.
+  "Render a swagger spec to a given template.

    We can optionally pass in a transfomer function that takes a swagger spec
-   and enriches or alters it with a customer function
+   and enriches or alters it with a customer function. This could be used
+   to merge additional arguments or transform a swagger spec by restructuring it
+   in a way that is more acceptable for template rendering.

    Examples:
    *************************************************************************


Remove unnecessary `batch-get-item` work

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -527,8 +527,6 @@
      :friends {:prim-kvs [{:catagory \"favorites\" :id [1 2 3]}
                           {:catagory \"recent\"    :id [7 8 9]}]}})"
   [creds requests]
-  (doto (BatchGetItemRequest.)
-        (.setRequestItems (batch-request-items requests)))
   (as-map
    (.batchGetItem (db-client creds)
      (doto (BatchGetItemRequest.) ; {table-str KeysAndAttributes}


Headers are on

Headers are on

--- src/client.clj
+++ src/client.clj
@@ -1,21 +1,44 @@
 (ns async.client
-
+  (:use [de.kotka.lazymap :only (lazy-hash-map)])
   (:import (com.ning.http.client AsyncHttpClient AsyncHandler
 				 HttpResponseStatus HttpResponseHeaders
-				 HttpResponseBodyPart RequestBuilder
+				 HttpResponseBodyPart Request RequestBuilder
 				 RequestType)))

 (def ahc (AsyncHttpClient.))

-(defstruct status :protocol :major :minor :code :text)
+(defstruct status
+  :protocol :major :minor :code :text)

-(defn statusCallback [status]
-    (println (str "Status code: " @(status :code)))
+;; default set of callbacks
+(defn body-collect [#^byteL bytes]
+  ;; TODO append to rest of the body collected already
+)
+
+(defn body-completed []
+  ;; TODO return completed body
+)
+
+(defn ignore-headers [id headers])
+
+(defn print-headers [id headers]
+  (doall (map #(println (str id "> " % ": " (get headers %))) (keys headers))))
+
+(defn accept-ok [id status]
+  (if (not (= (:code status) 200)) :abort))
+
+(defn print-status [id st]
+  (println (str id "> "
+		(:protocol st) "/" (:major st) "." (:minor st) " "
+		(:code st) " " (:text st))))
+
+(defn status-callback [id status]
+    (println (str "Status code: " (status :code)))
     :abort)

-(defn- defaultStatusCallback [status])
+(defn- default-status-callback [id status])

-(defn convertMethod [method]
+(defn- convert-method [method]
   "Converts clj method (:get, :put, ...) to Async Client specific.
    Defaults to :get"
   (cond
@@ -26,43 +49,54 @@
    (= method :head) RequestType/HEAD
    :default RequestType/GET))

-(defn prepareRequest [method #^String url]
-  (let [ahcMethod (convertMethod method)
-	rb (RequestBuilder. ahcMethod)]
+(defn prepare-request [method #^String url]
+  "Prepares request."
+  {:tag Request}
+  (let [mtd (convert-method method)
+	rb (RequestBuilder. mtd)]
     (.. rb (setUrl url) (build))))

-(defn prepareGet [#^String url]
-  (prepareRequest :get url))
+(defn prepare-get [#^String url]
+  "Prepares GET reqeust for given url."
+  {:tag Request}
+  (prepare-request :get url))

-;; How do one make
-;; (let [abc {:a (lazy)}])
-;; ?
-;; Answer: delay
-(defn testRead [#^String url]
-  (.executeRequest ahc (prepareGet url)
-    (proxy [AsyncHandler] []
-      (onStatusReceived [#^HttpResponseStatus response]
-	(let [stat (struct status
-			   (delay (.getProtocolName response))
-			   (delay (.getProtocolMajorVersion response))
-			   (delay (.getProtocolMinorVersion response))
-			   (delay (.getStatusCode response))
-			   (delay (.getStatusText response)))
-	      action (statusCallback stat)]
-	  (if (= :abort action)
-	    com.ning.http.client.AsyncHandler$STATE/ABORT
-	    com.ning.http.client.AsyncHandler$STATE/CONTINUE)))
-      (onHeadersReceived [#^HttpResponseHeaders response]
-	(do
-	  (println response)
-	  com.ning.http.client.AsyncHandler$STATE/ABORT))
-      (onBodyPartReceived [#^HttpResponseBodyPart response]
-	(do
-	  (println response)
-	  com.ning.http.client.AsyncHandler$STATE/ABORT))
-      (onCompleted []
-        (do
-	  (println "Completed")
-	  200))
-      (onThrowable [#^Throwable t]
-	(println (.getMessage t))))))
+(defn execute-request
+  "Executes provided reqeust with given callback functions."
+  ([#^Request req]
+     (execute-request req body-collect body-completed))
+  ([#^Request req body-fn completed-fn]
+     (execute-request req body-fn completed-fn print-headers))
+  ([#^Request req body-fn completed-fn headers-fn]
+     (execute-request req body-fn completed-fn headers-fn print-status))
+  ([#^Request req body-fn completed-fn headers-fn status-fn]
+     (let [id (gensym "RequestId__")]
+       (.executeRequest
+	ahc req
+	(proxy [AsyncHandler] []
+	  (onStatusReceived [#^HttpResponseStatus resp]
+	    (let [stat (lazy-hash-map
+			:protocol (.getProtocolName resp)
+			:major (.getProtocolMajorVersion resp)
+			:minor (.getProtocolMinorVersion resp)
+			:code (.getStatusCode resp)
+			:text (.getStatusText resp))
+		  action (status-fn id stat)]
+	      (if (= action :abort)
+		com.ning.http.client.AsyncHandler$STATE/ABORT
+		com.ning.http.client.AsyncHandler$STATE/CONTINUE)))
+	  (onHeadersReceived [#^HttpResponseHeaders response]
+            (let [action (headers-fn id (.getHeadersMap response))]
+	      (if (= action :abort)
+		com.ning.http.client.AsyncHandler$STATE/ABORT
+		com.ning.http.client.AsyncHandler$STATE/CONTINUE)))
+	  (onBodyPartReceived [#^HttpResponseBodyPart response]
+ 	    (do
+	      (println response)
+	      com.ning.http.client.AsyncHandler$STATE/ABORT))
+	  (onCompleted []
+	    (do
+	      (println "Completed")
+	      200))
+	  (onThrowable [#^Throwable t]
+	    (println (.getMessage t))))))))


Refactor proxy tests

Refactor proxy tests

This commit introduces a macro to simplify the proxy tests; this
will allow us to write several more tests w/o duplicating all
of the proxy setup code.

--- test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
+++ test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
@@ -31,6 +31,26 @@
    ; insecure? value of true directs the client to ignore the mismatch.
    :insecure?        true})

+(defmacro with-target-and-proxy-servers
+  [{:keys [target proxy proxy-config]} & body]
+  `(with-app-with-config proxy-target-app#
+      [jetty9-service]
+      {:webserver ~target}
+      (let [target-webserver# (get-service proxy-target-app# :WebserverService)]
+        (add-ring-handler
+          target-webserver#
+          (fn [req#]
+            (if (= "/hello/world" (:uri req#))
+              {:status 200 :body "Hello, World!"}
+              {:status 404 :body "D'oh"}))
+          "/hello"))
+      (with-app-with-config proxy-app#
+        [jetty9-service]
+        {:webserver ~proxy}
+        (let [proxy-webserver# (get-service proxy-app# :WebserverService)]
+          (add-proxy-route proxy-webserver# ~proxy-config "/hello-proxy"))
+        ~@body)))
+
 (defn validate-ring-handler
   ([base-url config-file-name]
     (validate-ring-handler base-url config-file-name {}))
@@ -298,36 +318,21 @@
         :keystore nil))))

 (deftest test-proxy-servlet
-  (testing "proxy support"
-    (with-app-with-config proxy-target-app
-      [jetty9-service]
-      {:webserver {:host "0.0.0.0"
-                   :port 9000}}
-      (let [target-webserver (get-service proxy-target-app :WebserverService)]
-        (add-ring-handler
-          target-webserver
-          (fn [req]
-            (if (= "/hello/world" (:uri req))
-              {:status 200 :body "Hello, World!"}
-              {:status 404 :body "D'oh"}))
-          "/hello"))
+  (testing "basic proxy support"
+    (with-target-and-proxy-servers
+      {:target {:host "0.0.0.0"
+                :port 9000}
+       :proxy  {:host "0.0.0.0"
+                :port 10000}
+       :proxy-config {:host    "localhost"
+                      :port    9000
+                      :path   "/hello"}}
       (let [response (http-client/get "http://localhost:9000/hello/world")]
         (is (= (:status response) 200))
         (is (= (:body response) "Hello, World!")))
-
-      (with-app-with-config proxy-app
-        [jetty9-service]
-        {:webserver {:host "0.0.0.0"
-                     :port 10000}}
-        (let [proxy-webserver (get-service proxy-app :WebserverService)]
-          (add-proxy-route proxy-webserver
-                           {:host    "localhost"
-                            :port    9000
-                            :path   "/hello"}
-                           "/hello-proxy"))
-        (let [response (http-client/get "http://localhost:10000/hello-proxy/world")]
-          (is (= (:status response) 200))
-          (is (= (:body response) "Hello, World!"))))))
+      (let [response (http-client/get "http://localhost:10000/hello-proxy/world")]
+        (is (= (:status response) 200))
+        (is (= (:body response) "Hello, World!")))))

   #_(testing "ssl proxy support"
     (is (not true))))


Blacklist don't have to contain source

Blacklist don't have to contain source

--- src/zg/html_renderer.clj
+++ src/zg/html_renderer.clj
@@ -44,6 +44,7 @@
         :whitelist    "whitelist"
         :blacklist    "blacklist"
         :atomic-typos "atomic-typos"
+        :universal    "universal"
                       "whitelist")) ; default

 (defn search-href
@@ -184,7 +185,7 @@
         [:br]])

 (defn render-front-page-for-blacklist
-    [word url-prefix emender-page mode sources]
+    [word url-prefix emender-page mode]
     [:div {:class "container-fluid"}
         [:div {:class "row"}
             "The CCS Custom Dictionary Blacklist – allows you to add and remove words that are normally correct but should be reported as errors in Red Hat documentation by Emender (" [:a {:href emender-page} "see Emender page" ] ")"
@@ -223,9 +224,9 @@
                     [:tr [:td [:div {:class "_label _label-default"} "Copyright:"]]
                          [:td " "]
                          [:td (form/check-box "copyright")]]
-                    [:tr [:td [:div {:class "_label _label-default"} "Source:"]]
-                         [:td " "]
-                         [:td (form/drop-down "source" (map (fn [i] [(:source i)(:id i)]) sources) )]]
+                   ;[:tr [:td [:div {:class "_label _label-default"} "Source:"]]
+                   ;     [:td " "]
+                   ;     [:td (form/drop-down "source" (map (fn [i] [(:source i)(:id i)]) sources) )]]
                     [:tr [:td " "]
                          [:td " "]
                          [:td (form/submit-button {:class "btn btn-primary"} "Add new word")]]]
@@ -283,7 +284,7 @@
                 (render-navigation-bar-section user-name url-prefix title mode)
             (case mode
                 :whitelist (render-front-page-for-whitelist word url-prefix emender-page mode)
-                :blacklist (render-front-page-for-blacklist word url-prefix emender-page mode sources)
+                :blacklist (render-front-page-for-blacklist word url-prefix emender-page mode)
                 :atomic-typos (render-front-page-for-atomic-typos word url-prefix emender-page mode)
                 )


CMR-350: Removed unused namespace requires

--- src/cmr/search/services/parameter_converters/equator_crossing_longitude.clj
+++ src/cmr/search/services/parameter_converters/equator_crossing_longitude.clj
@@ -2,7 +2,6 @@
   "Contains functions for converting equator-crossing-longitude search parameters to a query model."
   (:require [cmr.search.models.query :as qm]
             [cmr.search.services.parameters :as p]
-            [clojure.string :as str]
             [cmr.search.services.messages.orbit-number-messages :as msg]
             [cmr.common.services.errors :as errors]
             [cmr.common.parameter-parser :as parser])


Fix typo

Fix typo

--- test/foreclojure/test/register.clj
+++ test/foreclojure/test/register.clj
@@ -52,7 +52,7 @@
           (do-register uname pwd shpwd email) => truthy
             (provided
               (flash-error "/register" (err-msgs "settings.pwd-match")) => 1))
-      (fact "about do-register - bad emal"
+      (fact "about do-register - bad email"
           (do-register uname pwd pwd bemail) => truthy
             (provided
               (flash-error "/register" (err-msgs "settings.email-invalid")) => 1))


Removed trailing spaces.

Removed trailing spaces.

--- test/midje/data/t_metaconstant.clj
+++ test/midje/data/t_metaconstant.clj
@@ -6,12 +6,12 @@

 ;;; Metaconstant symbols

-(tabular
+(tabular
   (fact "metaconstant symbols begin and end with dots"
     '?candidate   ?arrow metaconstant-symbol?)
      ?candidate   ?arrow
-     ...foo...      =>
-     .foo.          =>
+     ...foo...      =>
+     .foo.          =>
      foo            =not=>
      .foo           =not=>
      foo.           =not=>
@@ -20,11 +20,11 @@
      ...            =not=>)

 (tabular "or they begin and end with dashes"
-  (fact
+  (fact
     '?candidate   ?arrow metaconstant-symbol?)
      ?candidate   ?arrow
-     ---foo---      =>
-     -foo-          =>
+     ---foo---      =>
+     -foo-          =>
      -a-b-          =>
      foo            =not=>
      -foo           =not=>
@@ -49,24 +49,24 @@
     (pr-str mc) => "..name.."))

 (fact "Metaconstants implement Named"
-  (name (Metaconstant. '..name. {})) => "..name.")
+  (name (Metaconstant. '..name. {})) => "..name.")

 (fact "Metaconstants are equal if their names are *comparable*."
   (fact "equal names are comparable"
     (Metaconstant.    '...name... {}) => (Metaconstant. '...name... {})
     (Metaconstant.    '...name... {}) =not=> (Metaconstant. '...other... {}))
-
+
   (fact "but so are names that have a different number of dots or dashes"
     (Metaconstant.    '...name... {}) => (Metaconstant. '.name. {})
     (Metaconstant.    '---name- {}) => (Metaconstant. '-name--- {}))
-
+
   (fact "However, dot-names are not equal to dash-names"
     (Metaconstant.    '...name... {}) =not=> (Metaconstant. '---name--- {}))
-
+
   (fact "values are irrelevant"
     (Metaconstant.    '...name... {:key "value"}) => (Metaconstant. '...name... {:key "not-value"})
     (Metaconstant.  '...NAME... {:key "value"}) =not=> (Metaconstant. '...name... {:key "value"}))
-
+
   (fact "Metaconstants are equal to symbols with a comparable name"
     (= (Metaconstant. '...name... {}) '.name.) => truthy
     (= (Metaconstant. '...name... {}) '...not-name...) => falsey
@@ -90,7 +90,7 @@
     (contains? mc :not-key) => falsey

     (find mc :key) => [:key "value"]))
-
+
 (fact "Associate extends some of Seqable and IPersistentCollection"
   (let [mc (Metaconstant. 'm {:key "value"})]
     (count mc) => 1


Add a nested-message unit test for the CCI parser

Signed-off-by: Gregory Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- test/obcc/build/test_interface.clj
+++ test/obcc/build/test_interface.clj
@@ -40,6 +40,23 @@
 (def example1-expected-result
   [[:interface [:message "ActiveMessage" [:field [:type [:scalar "string"]] [:fieldName "param1"] [:index "1"]] [:field [:type [:scalar "int32"]] [:fieldName "param2"] [:index "2"]] [:field [:type [:scalar "int64"]] [:fieldName "param3"] [:index "3"]]]] nil])

+(def example2-cci
+  "
+  message NestedMessage {
+     message Entry {
+        string key = 1;
+        int32  value = 2;
+     }
+
+    repeated Entry entries = 1;
+  }
+
+  "
+  )
+
+(def example2-expected-result
+  [[:interface [:message "NestedMessage" [:message "Entry" [:field [:type [:scalar "string"]] [:fieldName "key"] [:index "1"]] [:field [:type [:scalar "int32"]] [:fieldName "value"] [:index "2"]]] [:field [:modifier "repeated"] [:type [:userType "Entry"]] [:fieldName "entries"] [:index "1"]]]] nil])
+
 (deftest test-parser
-  (let [result (parse example1-cci)]
-    (is (= example1-expected-result result))))
+  (is (= example1-expected-result (parse example1-cci)))
+  (is (= example2-expected-result (parse example2-cci))))


Allow repeated batches in lifecycle-test

--- test/onyx/peer/lifecycles_test.clj
+++ test/onyx/peer/lifecycles_test.clj
@@ -144,12 +144,19 @@
    :batch-after
    :task-after])

+
 ;; shutdown-peer ensure peers are fully shutdown so that
 ;; :task-after will have been set
 (doseq [v-peer v-peers]
   (onyx.api/shutdown-peer v-peer))

-(fact @counter => expected-order)
+(fact (take 2 @counter) => [:task-started :task-before])
+
+(def batches
+  (butlast (drop 2 @counter)))
+
+(fact batches => (take (count batches) (cycle [:batch-before :batch-after])))
+(fact (last @counter) => :task-after)

 (onyx.api/shutdown-peer-group peer-group)


My own (probably naive) lazy breadth-first search implementation.

--- clojure/src/advent2016/core.clj
+++ clojure/src/advent2016/core.clj
@@ -1,5 +1,6 @@
 (ns advent2016.core
   (:import [java.security MessageDigest])
+  (:require [flatland.useful.seq :refer [lazy-loop]])
   (:gen-class))

 (set! *warn-on-reflection* true)
@@ -9,6 +10,21 @@
 (defn ^String md5 [^String s]
   (format "%032x" (BigInteger. 1 (.digest (doto md5-digest .reset) (.getBytes s)))))

+(defn bfs [adjacent start]
+  (lazy-loop [seen #{}
+              xs   [start]
+              ys   []]
+    (let [x (first xs)]
+      (cond
+        (and (empty? xs)
+             (empty? ys)) (list)
+        (empty? xs)       (lazy-recur seen (reverse ys) [])
+        (seen x)          (lazy-recur seen (rest xs) ys)
+        :else             (cons x (lazy-recur (conj seen x)
+                                              (rest xs)
+                                              (concat (adjacent x) ys)))))))
+
+
 (defn -main
   "I don't do a whole lot ... yet."
   [& args]


Move rendering debug and info statements to more logical places

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -506,7 +506,7 @@

   All `:entry`s will be returned, with their `:path`s set, `:has-content`
   set to `true`, and `tracer` added to `io.perun/trace`."
-  [data renderer tmp tracer]
+  [task-name data renderer tmp tracer]
   (pod/with-call-in @render-pod
     (io.perun.render/update!))
   (doall
@@ -514,6 +514,7 @@
           (for [[path render-data] data]
             (let [content (render-in-pod @render-pod renderer render-data)]
               (perun/create-file tmp path content)
+              (perun/report-debug task-name "rendered page for path" path)
               (assoc (dissoc (:entry render-data) :content)
                      :path path
                      :has-content true))))))
@@ -526,13 +527,14 @@
   that are required by `render-paths-fn`.

   Returns a boot `with-pre-wrap` result"
-  [render-paths-fn options tracer]
+  [task-name render-paths-fn options tracer]
   (let [tmp (boot/tmp-dir!)]
     (boot/with-pre-wrap fileset
       (let [render-paths (render-paths-fn fileset options)
-            new-metadata (render-to-paths render-paths (:renderer options) tmp tracer)
+            new-metadata (render-to-paths task-name render-paths (:renderer options) tmp tracer)
             rm-files (keep #(boot/tmp-get fileset (-> % :entry :path)) (vals render-paths))]
-        (perun/report-debug "render-pre-wrap" "removing files" rm-files)
+        (perun/report-info task-name "rendered %s pages" (count render-paths))
+        (perun/report-debug task-name "removing files" rm-files)
         (-> fileset
             (boot/rm rm-files)
             (commit tmp)
@@ -579,15 +581,13 @@
                                    new-path (make-path (:out-dir options) permalink path)
                                    meta-entry (merge meta entry)
                                    content-entry (assoc meta-entry :content content)]
-                               (perun/report-debug "render" "rendered page for path" path)
                                (assoc result new-path {:meta    (pm/get-global-meta fileset)
                                                        :entries (vec entries)
                                                        :entry   content-entry})))
                            {}
                            entries)]
-                (perun/report-info "render" "rendered %s pages" (count paths))
                 paths))]
-      (render-pre-wrap render-paths options :io.perun/render))))
+      (render-pre-wrap "render" render-paths options :io.perun/render))))

 (defn- grouped-paths
   "Produces path maps of the shape required by `render-to-paths`, based
@@ -674,7 +674,7 @@
           (u/fail "collection task :sortby option value should implement IFn\n")
           :else
           (let [collection-paths (partial grouped-paths "collection")]
-            (render-pre-wrap collection-paths options :io.perun/collection)))))
+            (render-pre-wrap "collection" collection-paths options :io.perun/collection)))))

 (deftask inject-scripts
   "Inject JavaScript scripts into html files.


add way to fix older docs that were around before transaction/broadcast and frontend/id

--- src/pc/replay.clj
+++ src/pc/replay.clj
@@ -9,6 +9,12 @@
 (defn- ->datom
   [[e a v tx added]]
   {:e e :a a :v v :tx tx :added added})
+
+(defn touched-eids [tx-id]
+  (d/q '{:find [[?e ...]]
+         :in [?log ?tx]
+         :where [[(tx-data ?log ?tx) [[?e]]]]}
+       (d/log (pcd/conn)) tx-id))

 (defn tx-data [tx-id]
   (->> (d/tx-range (d/log (pcd/conn)) tx-id (inc tx-id))
@@ -119,3 +125,38 @@
                            (remove #(:frontend/id (d/entity db %))
                                    (vals new-eids))))
     new-doc))
+
+(defn needs-frontend-id? [db eid]
+  (let [ent (d/entity db eid)]
+    (and (:dummy ent)
+         (not (:frontend/id ent)))))
+
+(defn ensure-deleted-frontend-ids [db doc]
+  (let [txids (get-document-tx-ids db doc)
+        eids (reduce (fn [acc tx]
+                       (set/union acc (set (filter #(and (not (contains? acc %))
+                                                         (or (needs-frontend-id? (d/as-of db tx) %)
+                                                             (needs-frontend-id? (d/as-of db (dec tx)) %)))
+                                                   (touched-eids tx)))))
+                     #{} txids)]
+    @(d/transact (pcd/conn) (map (fn [e] [:db/add e :frontend/id (UUID. (:db/id doc) e)])
+                                 eids))))
+
+(defn ensure-transaction-broadcast [db doc]
+  (let [txids (d/q '{:find [[?t ...]]
+                     :in [$ ?doc-id]
+                     :where [[?t :transaction/document ?doc-id]
+                             [?t :db/txInstant]]}
+                   db (:db/id doc))]
+    (d/transact (pcd/conn)
+                (map (fn [e]
+                       [:db/add e :transaction/broadcast true])
+                     (filter #(let [ent (d/entity db %)]
+                                (and (not (:transaction/broadcast ent))
+                                     (:session/uuid ent)))
+                             txids)))))
+
+#_(defn clear-cache [db doc]
+  (doseq [tx-id (get-document-tx-ids db doc)]
+    (pc.cache/delete (str "pc.http.sente/frontend-tx-data-" tx-id)))
+  (clojure.core.memoize/memo-clear! pc.http.sente/memo-frontend-tx-data))


fix strokeWidth warnings

fix strokeWidth warnings

--- src/pc/svg.clj
+++ src/pc/svg.clj
@@ -16,7 +16,7 @@
      :fill          "none"
      :key           (:layer/id layer)
      :stroke        (if invert-colors? "#ccc" "black")
-     :stroke-width   2
+     :strokeWidth   2
      :rx            (:layer/rx layer)
      :ry            (:layer/ry layer)     }))

@@ -24,7 +24,7 @@
   {:x (:layer/start-x layer)
    :y (:layer/start-y layer)
    :fill (if invert-colors? "#ccc" "black")
-   :stroke-width 0
+   :strokeWidth 0
    :font-family (:layer/font-family layer "Helvetica")
    :font-size   (:layer/font-size layer 20)})

@@ -34,10 +34,10 @@
    :x2          (:layer/end-x layer)
    :y2          (:layer/end-y layer)
    :stroke (if invert-colors? "#ccc" "black")
-   :stroke-width 2})
+   :strokeWidth 2})

 (defn layer->svg-path [layer {:keys [invert-colors?]}]
   {:d (:layer/path layer)
    :stroke (if invert-colors? "#ccc" "black")
    :fill "none"
-   :stroke-width 2})
+   :strokeWidth 2})


Have raw-report return true so it's easy to use in (and) statements.

--- test/midje/test_util.clj
+++ test/midje/test_util.clj
@@ -48,7 +48,7 @@
 (defn only-one-result? []
   (= 1 (count (deref reported))))

-(defn raw-report [] (println @reported))
+(defn raw-report [] (println @reported) true)

 (defmacro deprivatize [ns-name & names]
   (let [settings (map (fn [name] `(def ~name ((ns-map (find-ns '~ns-name)) '~name)))


Remove skeleton tests.

Remove skeleton tests.

Tests have not (yet?) been written. Remove failing skeletons, because
they rattle rather, and give the wrong impression.

--- test/mtrx9/test/core.clj
+++ test/mtrx9/test/core.clj
@@ -1,14 +0,0 @@
-(ns mtrx9.test.core
-  (:use clojure.test
-        ring.mock.request
-        mtrx9.core))
-
-(deftest test-app
-  (testing "main route"
-    (let [response (app (request :get "/"))]
-      (is (= (:status response) 200))
-      (is (= (:body response) "MTRX9"))))
-
-  (testing "not-found route"
-    (let [response (app (request :get "/invalid"))]
-      (is (= (:status response) 404)))))


Fix backup tool by updating to latest version of google API.

--- tools/backup/project.clj
+++ tools/backup/project.clj
@@ -4,9 +4,9 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [com.google.apis/google-api-services-storage "v1beta2-rev43-1.18.0-rc"]
-                 [com.google.http-client/google-http-client-jackson2 "1.17.0-rc"]
-                 [com.google.oauth-client/google-oauth-client-jetty "1.17.0-rc"]]
+                 [com.google.apis/google-api-services-storage "v1-rev22-1.19.0"]
+                 [com.google.http-client/google-http-client-jackson2 "1.19.0"]
+                 [com.google.oauth-client/google-oauth-client-jetty "1.19.0"]]

   :main hatnik.tools.backup
   :aot :all)


Removed original irefweb interactions rule file after separating rules into their own files

--- resources/rules/post_identifier_merge/temp/irefweb/irefweb.clj
+++ resources/rules/post_identifier_merge/temp/irefweb/irefweb.clj
@@ -1,326 +0,0 @@
-
-`{:name "irefweb-binary-interactions"
-  :description "IRefWeb distinguishes among three different categories of protein interactions:
-  those that involve a single protein interacting with itself (intra-molecular),
-  those that involve two proteins (binary), and those that involve >2 proteins (n-ary).
-  Documentation for IRefWeb is available [here](http://irefindex.org/wiki/index.php?title=README_MITAB2.6_for_iRefIndex).
-  This rule generates bio-representations for all binary protein interactions cataloged by
-  IRefWeb. Binary interactions are indicated by an 'X' in the 'edge type' column of IRefWeb
-  records. For each binary interaction, this rule creates a subclass of the 'interaction type'
-  (MI Ontology concept), and that subclass is restricted using ro:has_participant to the two
-  interacting proteins. The rule also places a cardinality restriction of 2 on the interaction
-  subclass for the ro:has_participant property."
-  :head ((?/interaction rdfs/subClassOf ?/int_type_id) ;interaction
-         (?/interaction rdfs/label ?/int_type_label) ; transfer label to the subclass
-
-         ;; create subclasses of the proteins
-         (?/protein1_sc rdfs/subClassOf ?/protein1)
-         ;; TODO: UNCOMMENT below once kabob proteins have labels
-         ;;(?/protein1_sc rdfs/label ?/protein1_label) ; transfer label to the subclass
-         (?/protein2_sc rdfs/subClassOf ?/protein2)
-         ;; TODO: UNCOMMENT below once kabob proteins have labels
-         ;;(?/protein2_sc rdfs/label ?/protein2_label) ; transfer label to the subclass
-
-         (?/r1 rdf/type owl/Restriction)
-         (?/r1 owl/onProperty obo/RO_0000057) ; has_participant
-         (?/r1 owl/someValuesFrom ?/protein1_sc)
-
-         (?/r2 rdf/type owl/Restriction)
-         (?/r2 owl/onProperty obo/RO_0000057) ; has_participant
-         (?/r2 owl/someValuesFrom ?/protein2_sc)
-
-         ;; create a cardinality restriction of 2 on the has_participant property
-         (?/rcard rdf/type owl/Restriction)
-         (?/rcard owl/onProperty obo/RO_0000057) ; has_participant
-         (?/rcard owl/cardinality 2) ;; binary interactions must have 2 participants.
-
-         (?/interaction rdfs/subClassOf ?/r1)
-         (?/interaction rdfs/subClassOf ?/r2)
-         (?/interaction rdfs/subClassOf ?/rcard))
-
-  :body
-  ;; get binary interaction records
-  ((_/edge_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_edgeTypeDataField1)
-   (_/edge_field obo/IAO_0000219 ["X" "en"])   ;; "X" signifies binary interaction
-   (_/interaction_record obo/BFO_0000051 _/edge_field)  ;; bfo/has_part
-
-   ;; there is a "super" record in IRefWeb that contains references
-   ;; to the interaction record and interactor record(s)
-   (_/super_record obo/BFO_0000051 _/interaction_record) ;; bfo/has_part
-
-   ;; get the two distinct interactors for this binary interaction
-   (_/super_record obo/BFO_0000051 ?/interactor_record1) ;; bfo/has_part
-   (?/interactor_record1 kiao/hasTemplate iaoirefweb/IRefWebInteractorSchema1)
-   (_/super_record obo/BFO_0000051 ?/interactor_record2) ;; bfo/has_part
-   (?/interactor_record2 kiao/hasTemplate iaoirefweb/IRefWebInteractorSchema1)
-   (!= ?/interactor_record1 ?/interactor_record2)
-
-   ;; get the bioentity (protein) corresponding to interactor 1
-   (?/interactor_record1 obo/BFO_0000051 _/id_field1) ;; bfo/has_part
-   (_/id_field1 kiao/hasTemplate iaoirefweb/IRefWebInteractor_uniqueIdDataField1)
-   (_/id_field1 obo/IAO_0000219 _/id1) ;; iao/denotes
-   (_/id1 obo/IAO_0000219 ?/protein1) ;; iao/denotes
-
-   ;; TODO: UNCOMMENT below once kabob proteins have labels
-   ;;(?/protein1 rdfs:label ?/protein1_label) ;; get the protein label so that it can be
-   ;; transfered to the generated protein subclass
-
-   ;; get the bioentity (protein) corresponding to interactor 2
-   (?/interactor_record2 obo/BFO_0000051 _/id_field2) ;; bfo/has_part
-   (_/id_field2 kiao/hasTemplate iaoirefweb/IRefWebInteractor_uniqueIdDataField1)
-   (_/id_field2 obo/IAO_0000219 _/id2) ;; iao/denotes
-   (_/id2 obo/IAO_0000219 ?/protein2) ;; iao/denotes
-
-   ;; TODO: UNCOMMENT below once kabob proteins have labels
-   ;;(?/protein2 rdfs:label ?/protein2_label) ;; get the protein label so that it can be
-   ;; transfered to the generated protein subclass
-
-
-   ;; get the unique interaction identifier
-   (_/interaction_record obo/BFO_0000051 _/interaction_checksum_field) ;; bfo/has_part
-   (_/interaction_checksum_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_checksumInteractionDataField1)
-   (_/interaction_checksum_field obo/IAO_0000219 ?/unique_interaction_id) ;; iao/denotes
-
-   ;; get the interaction type name and ID
-   (_/interaction_record obo/BFO_0000051 _/interaction_type_record) ;; bfo/has_part
-   (_/interaction_type_record kiao/hasTemplate iaoirefweb/IRefWebInteractionTypeSchema1)
-   (_/interaction_type_record obo/BFO_0000051 _/int_type_id_field) ;; bfo/has_part
-   (_/int_type_id_field kiao/hasTemplate iaoirefweb/IRefWebInteractionType_interactionTypeIdDataField1)
-   (_/int_type_id_field obo/IAO_0000219 _/int_type_id_ice) ;; iao/denotes
-   (_/int_type_id_ice obo/IAO_0000219 ?/int_type_id) ;; iao/denotes
-   (?/int_type_id rdfs/label ?/int_type_label) ;; grab the interaction_type label so that it can be
-   ;;                                             applied to the generated interaction_type subclass
-   ;; get the detection method
-   (_/interaction_record obo/BFO_0000051 _/interaction_detection_method_record) ;; bfo/has_part
-   (_/interaction_detection_method_record kiao/hasTemplate iaoirefweb/IRefWebInteractionDetectionMethodSchema1)
-   (_/interaction_detection_method_record obo/BFO_0000051 _/detection_method_id_field) ;; bfo/has_part
-   (_/detection_method_id_field kiao/hasTemplate iaoirefweb/IRefWebInteractionDetectionMethod_detectionMethodIdDataField1)
-   (_/detection_method_id_field obo/IAO_0000219 ?/detection_method_id)) ;; iao/denotes
-
-  ;; we take advantage of the fact that IRefWeb has
-  ;; created a unique id for the interaction. This will allow us to reproducibly create
-  ;; a hash for the interaction that can be matched across records.
-  :reify ([?/interaction {:ln (:sha-1 ?/unique_interaction_id)
-                          :ns "kbio" :prefix "I_"}]
-          [?/r1 {:ln (:restriction)
-                 :ns "kbio" :prefix "R_"}]
-          [?/r2 {:ln (:restriction)
-                 :ns "kbio" :prefix "R_"}]
-          [?/rcard {:ln (:restriction)
-                    :ns "kbio" :prefix "R_"}]
-          [?/protein1_sc {:ln (:sha-1 ?/interaction ?/protein1)
-                          :ns "kbio" :prefix "P_"}]
-          [?/protein2_sc {:ln (:sha-1 ?/interaction ?/protein2)
-                          :ns "kbio" :prefix "P_"}])
-
-  :options {:magic-prefixes [["franzOption_clauseReorderer" "franz:identity"]
-                             ["franzOption_chunkProcessingAllowed" "franz:yes"]]}
-  }
-
-
-
-
-`{:name "irefweb-unary-interactions"
-  :description "IRefWeb distinguishes among three different categories of protein interactions:
-  those that involve a single protein interacting with itself (intra-molecular),
-  those that involve two proteins (binary), and those that involve >2 proteins (n-ary).
-  Documentation for IRefWeb is available [here](http://irefindex.org/wiki/index.php?title=README_MITAB2.6_for_iRefIndex).
-  This rule generates bio-representations for all unary (intra-molecular) protein interactions
-  cataloged by IRefWeb. Unary interactions are indicated by an 'Y' in the 'edge type' column of
-  IRefWeb records. For each unary interaction, this rule creates a subclass of the
-  'interaction type' (MI Ontology concept), and that subclass is restricted using ro:has_participant
-  to the single 'interacting' protein. It is important to note that this these are intra-molecular
-  interactions (one protein molecule interacting with itself), and not for example interactions
-  that form a dimer using two identical molecules of the same protein. The rule also places a
-  cardinality restriction of 1 on the interaction subclass for the ro:has_participant property."
-  :head ((?/interaction rdfs/subClassOf ?/int_type_id) ;interaction
-         (?/interaction rdfs/label ?/int_type_label) ; transfer label to the subclass
-
-         ;; create subclasses of the single protein involved
-         (?/protein1_sc rdfs/subClassOf ?/protein1)
-         ;; TODO: UNCOMMENT below once kabob proteins have labels
-         ;;(?/protein1_sc rdfs/label ?/protein1_label) ; transfer label to the subclass
-
-         (?/r1 rdf/type owl/Restriction)
-         (?/r1 owl/onProperty obo/RO_0000057) ; has_participant
-         (?/r1 owl/someValuesFrom ?/protein1_sc)
-
-         ;; create a cardinality restriction of 2 on the has_participant property
-         (?/rcard rdf/type owl/Restriction)
-         (?/rcard owl/onProperty obo/RO_0000057) ; has_participant
-         (?/rcard owl/cardinality 1) ;; unary interactions must have 1 participant.
-
-         (?/interaction rdfs/subClassOf ?/r1)
-         (?/interaction rdfs/subClassOf ?/rcard))
-
-  :body
-  ;; get binary interaction records
-  ((?/edge_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_edgeTypeDataField1)
-   (?/edge_field obo/IAO_0000219 ["Y" "en"])   ;; "Y" signifies intra-molecular interaction
-   (?/interaction_record obo/BFO_0000051 ?/edge_field)  ;; bfo/has_part
-
-   ;; get the unique interaction identifier
-   (?/interaction_record obo/BFO_0000051 ?/interaction_checksum_field) ;; bfo/has_part
-   (?/interaction_checksum_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_checksumInteractionDataField1)
-   (?/interaction_checksum_field obo/IAO_0000219 ?/unique_interaction_id) ;; iao/denotes
-
-   ;; get the interaction type name and ID
-   (?/interaction_record obo/BFO_0000051 ?/interaction_type_record) ;; bfo/has_part
-   (?/interaction_type_record kiao/hasTemplate iaoirefweb/IRefWebInteractionTypeSchema1)
-   (?/interaction_type_record obo/BFO_0000051 ?/int_type_name_field) ;; bfo/has_part
-   (?/int_type_name_field kiao/hasTemplate iaoirefweb/IRefWebInteractionType_interactionTypeNameDataField1)
-   (?/int_type_name_field obo/IAO_0000219 ?/int_type_name) ;; iao/denotes
-   (?/interaction_type_record obo/BFO_0000051 ?/int_type_id_field) ;; bfo/has_part
-   (?/int_type_id_field kiao/hasTemplate iaoirefweb/IRefWebInteractionType_interactionTypeIdDataField1)
-   (?/int_type_id_field obo/IAO_0000219 ?/int_type_id_ice) ;; iao/denotes
-   (?/int_type_id_ice obo/IAO_0000219 ?/int_type_id) ;; iao/denotes
-   (?/int_type_id rdfs/label ?/int_type_label) ;; grab the interaction_type label so that it can be
-   ;;                                             applied to the generated interaction_type subclass
-
-   ;; get the detection method
-   (?/interaction_record obo/BFO_0000051 ?/interaction_detection_method_record) ;; bfo/has_part
-   (?/interaction_detection_method_record kiao/hasTemplate iaoirefweb/IRefWebInteractionDetectionMethodSchema1)
-   (?/interaction_detection_method_record obo/BFO_0000051 ?/detection_method_id_field) ;; bfo/has_part
-   (?/detection_method_id_field kiao/hasTemplate iaoirefweb/IRefWebInteractionDetectionMethod_detectionMethodIdDataField1)
-   (?/detection_method_id_field obo/IAO_0000219 ?/detection_method_id) ;; iao/denotes
-
-   ;; there is a "super" record in IRefWeb that contains references
-   ;; to the interaction record and interactor record(s)
-   (?/super_record obo/BFO_0000051 ?/interaction_record) ;; bfo/has_part
-
-   ;; there is only one interactor for the unary interaction
-   (?/super_record obo/BFO_0000051 ?/interactor_record1) ;; bfo/has_part
-   (?/interactor_record1 kiao/hasTemplate iaoirefweb/IRefWebInteractorSchema1)
-
-   ;; get the bioentity (protein) corresponding to interactor 1
-   (?/interactor_record1 obo/BFO_0000051 ?/id_field1) ;; bfo/has_part
-   (?/id_field1 kiao/hasTemplate iaoirefweb/IRefWebInteractor_uniqueIdDataField1)
-   (?/id_field1 obo/IAO_0000219 ?/id1) ;; iao/denotes
-   (?/id1 obo/IAO_0000219 ?/protein1) ;; iao/denotes
-   ;; TODO: UNCOMMENT below once kabob proteins have labels
-   ;;(?/protein1 rdfs:label ?/protein1_label) ;; get the protein label so that it can be
-   ;; transfered to the generated protein subclass
-   )
-
-  ;; we take advantage of the fact that IRefWeb has
-  ;; created a unique id for the interaction. This will allow us to reproducibly create
-  ;; a hash for the interaction that can be matched across records.
-  :reify ([?/interaction {:ln (:sha-1 ?/unique_interaction_id)
-                          :ns "kbio" :prefix "I_"}]
-          [?/r1 {:ln (:restriction)
-                 :ns "kbio" :prefix "R_"}]
-          [?/rcard {:ln (:restriction)
-                    :ns "kbio" :prefix "R_"}]
-          [?/protein1_sc {:ln (:sha-1 ?/interaction ?/protein1)
-                          :ns "kbio" :prefix "P_"}])
-
-  :options {:magic-prefixes [["franzOption_clauseReorderer" "franz:identity"]]}
-  }
-
-
-
-`{:name "irefweb-n-ary-interactions"
-  :description "IRefWeb distinguishes among three different categories of protein interactions:
-  those that involve a single protein interacting with itself (intra-molecular),
-  those that involve two proteins (binary), and those that involve >2 proteins (n-ary).
-  Documentation for IRefWeb is available [here](http://irefindex.org/wiki/index.php?title=README_MITAB2.6_for_iRefIndex).
-  This rule generates bio-representations for all n-ary protein interactions cataloged by
-  IRefWeb, where n>2. N-ary interactions are indicated by an 'C' in the 'edge type' column of
-  IRefWeb records. The 'C' is referred to as 'complex' in the IRefWeb documentation, however this
-  is misleading as many of the n-ary interactions are only associations determined from an assay,
-  and are not necessarily protein complexes (as defined by the GO:protein_complex concept [GO:0043234]:
-  'A stable macromolecular complex composed (only) of two or more polypeptide subunits...').
-  For each n-ary interaction, this rule creates a subclass of the 'interaction type' (MI Ontology concept),
-  and that subclass is restricted using ro:has_participant to one of the n interacting proteins. N-ary
-  interactions are composed from multiple IRefWeb records as each record catalogs only a single
-  participant in the n-ary interaction. IRefWeb records involved in an n-ary interaction share a unique
-  interaction identifier which is used by the rule to connect all n participants for a given n-ary interaction.
-  The rule also places a minimum-cardinality restriction of 3 on the interaction subclass for the
-  ro:has_participant property."
-  :head ((?/interaction rdfs/subClassOf ?/int_type_id) ;interaction
-         (?/interaction rdfs/label ?/int_type_label) ; transfer label to the subclass
-
-         ;; create subclasses of the proteins
-         (?/protein1_sc rdfs/subClassOf ?/protein1)
-         ;; TODO: UNCOMMENT below once kabob proteins have labels
-         ;;(?/protein1_sc rdfs/label ?/protein1_label) ; transfer label to the subclass
-
-         (?/r1 rdf/type owl/Restriction)
-         (?/r1 owl/onProperty obo/RO_0000057) ; has_participant
-         (?/r1 owl/someValuesFrom ?/protein1_sc)
-
-         ;; create a cardinality restriction of >2 on the has_participant property
-         (?/rcard rdf/type owl/Restriction)
-         (?/rcard owl/onProperty obo/RO_0000057) ; has_participant
-         (?/rcard owl/minCardinality 3) ;; n-ary interactions must have >2 participant.
-
-         (?/interaction rdfs/subClassOf ?/r1)
-         (?/interaction rdfs/subClassOf ?/rcard))
-
-  :body
-  ;; get n-ary interaction records
-  ((?/edge_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_edgeTypeDataField1)
-   (?/edge_field obo/IAO_0000219 ["C" "en"])   ;; "C" signifies "complex" in IRefWeb, but really mean n-ary interaction where n>2
-   (?/interaction_record obo/BFO_0000051 ?/edge_field)  ;; bfo/has_part
-
-   ;; get the unique interaction identifier
-   (?/interaction_record obo/BFO_0000051 ?/interaction_checksum_field) ;; bfo/has_part
-   (?/interaction_checksum_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_checksumInteractionDataField1)
-   (?/interaction_checksum_field obo/IAO_0000219 ?/unique_interaction_id) ;; iao/denotes
-
-   ;; get the interaction type name and ID
-   (?/interaction_record obo/BFO_0000051 ?/interaction_type_record) ;; bfo/has_part
-   (?/interaction_type_record kiao/hasTemplate iaoirefweb/IRefWebInteractionTypeSchema1)
-   (?/interaction_type_record obo/BFO_0000051 ?/int_type_name_field) ;; bfo/has_part
-   (?/int_type_name_field kiao/hasTemplate iaoirefweb/IRefWebInteractionType_interactionTypeNameDataField1)
-   (?/int_type_name_field obo/IAO_0000219 ?/int_type_name) ;; iao/denotes
-   (?/interaction_type_record obo/BFO_0000051 ?/int_type_id_field) ;; bfo/has_part
-   (?/int_type_id_field kiao/hasTemplate iaoirefweb/IRefWebInteractionType_interactionTypeIdDataField1)
-   (?/int_type_id_field obo/IAO_0000219 ?/int_type_id_ice) ;; iao/denotes
-   (?/int_type_id_ice obo/IAO_0000219 ?/int_type_id) ;; iao/denotes
-   (?/int_type_id rdfs/label ?/int_type_label) ;; grab the interaction_type label so that it can be
-   ;;                                             applied to the generated interaction_type subclass
-
-   ;; get the detection method
-   (?/interaction_record obo/BFO_0000051 ?/interaction_detection_method_record) ;; bfo/has_part
-   (?/interaction_detection_method_record kiao/hasTemplate iaoirefweb/IRefWebInteractionDetectionMethodSchema1)
-   (?/interaction_detection_method_record obo/BFO_0000051 ?/detection_method_id_field) ;; bfo/has_part
-   (?/detection_method_id_field kiao/hasTemplate iaoirefweb/IRefWebInteractionDetectionMethod_detectionMethodIdDataField1)
-   (?/detection_method_id_field obo/IAO_0000219 ?/detection_method_id) ;; iao/denotes
-
-   ;; there is a "super" record in IRefWeb that contains references
-   ;; to the interaction record and interactor record(s)
-   (?/super_record obo/BFO_0000051 ?/interaction_record) ;; bfo/has_part
-
-   ;; there are two interactors, but one is a place holder that is used to bind
-   ;; multiple records together to form n-ary interactions. The placeholder is
-   ;; identical to the unique interaction ID, so we select the other interactor
-   ;; (which will be linked to a bioentity (protein))
-   (?/super_record obo/BFO_0000051 ?/interactor_record1) ;; bfo/has_part
-   (?/interactor_record1 kiao/hasTemplate iaoirefweb/IRefWebInteractorSchema1)
-
-   ;; get the bioentity (protein) corresponding to interactor 1
-   (?/interactor_record1 obo/BFO_0000051 ?/id_field1) ;; bfo/has_part
-   (?/id_field1 kiao/hasTemplate iaoirefweb/IRefWebInteractor_uniqueIdDataField1)
-   (?/id_field1 obo/IAO_0000219 ?/id1) ;; iao/denotes
-   (!= ?/id1 ?/unique_interaction_id)
-   (?/id1 obo/IAO_0000219 ?/protein1) ;; iao/denotes
-   ;; TODO: UNCOMMENT below once kabob proteins have labels
-   ;;(?/protein1 rdfs:label ?/protein1_label) ;; get the protein label so that it can be
-   ;; transfered to the generated protein subclass
-   )
-
-  ;; we take advantage of the fact that IRefWeb has
-  ;; created a unique id for the interaction. This will allow us to reproducibly create
-  ;; a hash for the interaction that can be matched across records.
-  :reify ([?/interaction {:ln (:sha-1 ?/unique_interaction_id)
-                          :ns "kbio" :prefix "I_"}]
-          [?/r1 {:ln (:restriction)
-                 :ns "kbio" :prefix "R_"}]
-          [?/rcard {:ln (:restriction)
-                    :ns "kbio" :prefix "R_"}]
-          [?/protein1_sc {:ln (:sha-1 ?/interaction ?/protein1)
-                          :ns "kbio" :prefix "P_"}])
-
-  :options {:magic-prefixes [["franzOption_clauseReorderer" "franz:identity"]]}
-  }


Note bug in require not being thread safe. (#1908)

Co-authored-by: Scott Crosby <23e8f75489aff47cf2cd5a529e9a769a24e9501c@twosigma.com>

--- scheduler/src/cook/util.clj
+++ scheduler/src/cook/util.clj
@@ -156,6 +156,8 @@
   (let [ns (namespace var-sym)]
     (when-not ns
       (throw (ex-info "Can only load vars that are ns-qualified!" {})))
+    ; BUG: Require is not thread safe. Suspect this leads to some problems when laxy-load-var is used
+    ; from multiple threads. See https://ask.clojure.org/index.php/9893/require-is-not-thread-safe
     (require (symbol ns))
     (let [resolved (resolve var-sym)]
       (if resolved


Fixes bug

Fixes bug

--- test/expound/alpha_test.cljc
+++ test/expound/alpha_test.cljc
@@ -2391,7 +2391,7 @@

 (s/fdef results-str-fn1
         :args (s/cat :x nat-int? :y nat-int?)
-        :ret pos-int?)
+        :ret pos?)
 (defn results-str-fn1 [x y]
   (+' x y))

@@ -2460,7 +2460,7 @@

 should satisfy

-  pos-int?
+  pos?

 -------------------------
 Detected 1 error


Use native string methods.

Use native string methods.

Saves about 100ms over the whole namespace.

--- test/postal/test/message.clj
+++ test/postal/test/message.clj
@@ -8,36 +8,38 @@
             AddressException]))

 (deftest test-simple
-  (let [m {:from "fee@bar.dom"
-           :to "Foo Bar <foo@bar.dom>"
-           :cc ["baz@bar.dom" "Quux <quux@bar.dom>"]
-           :date (java.util.Date.)
-           :subject "Test"
-           :body "Test!"}]
-    (is (= "Subject: Test" (re-find #"Subject: Test" (message->str m))))
-    (is (re-find #"Cc: baz@bar.dom, Quux <quux@bar.dom>" (message->str m)))))
+  (let [m (message->str
+           {:from "fee@bar.dom"
+            :to "Foo Bar <foo@bar.dom>"
+            :cc ["baz@bar.dom" "Quux <quux@bar.dom>"]
+            :date (java.util.Date.)
+            :subject "Test"
+            :body "Test!"})]
+    (is (.contains m "Subject: Test"))
+    (is (.contains m "Cc: baz@bar.dom, Quux <quux@bar.dom>"))))

 (deftest test-multipart
-  (let [m {:from "foo@bar.dom"
-           :to "baz@bar.dom"
-           :subject "Test"
-           :body [{:type "text/html"
-                   :content "some html"}]}]
-    (is (= "multipart/mixed" (re-find #"multipart/mixed" (message->str m))))
-    (is (= "Content-Type: text/html"
-           (re-find #"Content-Type: text/html" (message->str m))))
-    (is (= "some html" (re-find #"some html" (message->str m))))))
+  (let [m (message->str
+           {:from "foo@bar.dom"
+            :to "baz@bar.dom"
+            :subject "Test"
+            :body [{:type "text/html"
+                    :content "some html"}]})]
+    (is (.contains m "multipart/mixed"))
+    (is (.contains m "Content-Type: text/html"))
+    (is (.contains m "some html"))))

 (deftest test-inline
   (let [f (doto (java.io.File/createTempFile "_postal-" ".txt"))
         _ (doto (java.io.PrintWriter. f)
             (.println "tempfile contents") (.close))
-        m {:from "foo@bar.dom"
-           :to "baz@bar.dom"
-           :subject "Test"
-           :body [{:type :inline
-                   :content f}]}]
-    (is (= "tempfile" (re-find #"tempfile" (message->str m))))
+        m (message->str
+           {:from "foo@bar.dom"
+            :to "baz@bar.dom"
+            :subject "Test"
+            :body [{:type :inline
+                    :content f}]})]
+    (is (.contains m "tempfile"))
     (.delete f)))

 (deftest test-attachment
@@ -45,47 +47,46 @@
         _ (doto (java.io.PrintWriter. f1)
             (.println "tempfile contents") (.close))
         f2 "/etc/resolv.conf"
-        m {:from "foo@bar.dom"
-           :to "baz@bar.dom"
-           :subject "Test"
-           :body [{:type :attachment
-                   :content f1}
-                  {:type :attachment
-                   :content f2}]}]
-    (is (= "tempfile" (re-find #"tempfile" (message->str m))))
+        m (message->str
+           {:from "foo@bar.dom"
+            :to "baz@bar.dom"
+            :subject "Test"
+            :body [{:type :attachment
+                    :content f1}
+                   {:type :attachment
+                    :content f2}]})]
+    (is (.contains m "tempfile"))
     (.delete f1)))

 (deftest test-nested
   (let [f (doto (java.io.File/createTempFile "_postal-" ".txt"))
         _ (doto (java.io.PrintWriter. f)
             (.println "tempfile contents") (.close))
-        m {:from "foo@bar.dom"
-           :to "baz@bar.dom"
-           :subject "Test"
-           :body [[:alternative
-                   {:type "text/html"
-                    :content "some html"}
-                   {:type "text/plain"
-                    :content "some text"}]
-                  {:type :attachment
-                   :content f}]}]
-    (is (= "multipart/mixed" (re-find #"multipart/mixed" (message->str m))))
-    (is (= "multipart/alternative"
-           (re-find #"multipart/alternative" (message->str m))))
-    (is (= "Content-Type: text/html"
-           (re-find #"Content-Type: text/html" (message->str m))))
-    (is (= "some html" (re-find #"some html" (message->str m))))
-    (is (= "Content-Type: text/plain"
-           (re-find #"Content-Type: text/plain" (message->str m))))
-    (is (= "some text" (re-find #"some text" (message->str m))))
-    (is (= "tempfile" (re-find #"tempfile" (message->str m))))
+        m (message->str
+           {:from "foo@bar.dom"
+            :to "baz@bar.dom"
+            :subject "Test"
+            :body [[:alternative
+                    {:type "text/html"
+                     :content "some html"}
+                    {:type "text/plain"
+                     :content "some text"}]
+                   {:type :attachment
+                    :content f}]})]
+    (is (.contains m "multipart/mixed"))
+    (is (.contains m "multipart/alternative"))
+    (is (.contains m "Content-Type: text/html"))
+    (is (.contains m "some html"))
+    (is (.contains m "Content-Type: text/plain"))
+    (is (.contains m "some text"))
+    (is (.contains m "tempfile"))
     (.delete f)))

 (deftest test-fixture
   (let [from "foo@bar.dom"
         to "baz@bar.dom"
         tag "[TEST]"]
-    (is (re-find #"^\[TEST" (:subject (make-fixture from to :tag tag))))))
+    (is (zero? (.indexOf (:subject (make-fixture from to :tag tag)) "[TEST")))))

 (deftest test-extra-headers
   (let [m {:from "foo@bar.dom"
@@ -93,20 +94,22 @@
            :subject "Test"
            :User-Agent "Lorem Ipsum"
            :body "Foo!"}]
-    (is (re-find #"User-Agent: Lorem Ipsum" (message->str m)))))
+    (is (.contains (message->str m) "User-Agent: Lorem Ipsum"))))

 (deftest test-bad-addrs
-  (let [m {:from "foo @bar.dom"
-           :to "badddz@@@bar.dom"
-           :subject "Test"
-           :body "Bad recipient!"}]
-    (is (not (re-find #"badddz" (message->str m))))
-    (is (not (re-find #"foo @bar" (message->str m))))))
+  (let [m (message->str
+           {:from "foo @bar.dom"
+            :to "badddz@@@bar.dom"
+            :subject "Test"
+            :body "Bad recipient!"})]
+    (is (not (.contains m "badddz")))
+    (is (not (.contains m "foo @bar")))))

 (deftest test-reply-to
-  (let [m {:from "foo@bar.dom"
-           :to "baz@bar.dom"
-           :subject "Test"
-           :body "Reply me!"
-           :reply-to "yermom@bar.dom"}]
-    (is (re-find #"Reply-To: yermom" (message->str m)))))
+  (let [m (message->str
+           {:from "foo@bar.dom"
+            :to "baz@bar.dom"
+            :subject "Test"
+            :body "Reply me!"
+            :reply-to "yermom@bar.dom"})]
+    (is (.contains m "Reply-To: yermom"))))


Slight formatting improvements

Slight formatting improvements

--- test/yada/multipart_test.clj
+++ test/yada/multipart_test.clj
@@ -239,37 +239,7 @@
                :parts
                )]

-      (is (= [:part] (mapv :type parts)))
-      ;(let [p (first parts)]
-      ;  (is (= (count "Malcolm") (- (count (:bytes p)) (:body-offset p)))))
-      ;(let [p (last parts)]
-      ;  (is (= [65130 49154 49152 49152 49152 49152 28929] (mapv :bytes (:pieces p))))
-      ;  (is (= (+ header-size image-size) (count (:bytes p))))
-      ;  (is (= 48 (:body-offset p))))
-      )))
-
-
-
-(deftest big-file-test
-  (let [[chunk-size window-size] [16384 (* 4 16384)]
-        spec {:chunk-size chunk-size :window-size window-size}]
-    (let [parts
-          (->> (s/->source (to-chunks (slurp-byte-array (io/resource "yada/multipart-4")) chunk-size))
-               (parse-multipart "IIKwJwJU_tJT6hjEW8f_JHXCqjFM_zjBrl936VG" (:window-size spec) (:chunk-size spec))
-               (s/transform (comp (xf-add-header-info) (xf-parse-content-disposition)))
-               (s/reduce reduce-piece {:consumer (->DefaultPartConsumer) :state {:parts []}})
-               deref
-               :parts
-               )]
-
-      (is (= [:part] (mapv :type parts)))
-                                        ;(let [p (first parts)]
-                                        ;  (is (= (count "Malcolm") (- (count (:bytes p)) (:body-offset p)))))
-                                        ;(let [p (last parts)]
-                                        ;  (is (= [65130 49154 49152 49152 49152 49152 28929] (mapv :bytes (:pieces p))))
-                                        ;  (is (= (+ header-size image-size) (count (:bytes p))))
-                                        ;  (is (= 48 (:body-offset p))))
-      )))
+      (is (= [:part] (mapv :type parts))))))

 (deftest big-file-test-2
   (let [[chunk-size window-size] [16384 (* 4 16384)]
@@ -280,16 +250,8 @@
                (s/transform (comp (xf-add-header-info) (xf-parse-content-disposition)))
                (s/reduce reduce-piece {:consumer (->DefaultPartConsumer) :state {:parts []}})
                deref
-               :parts
-               )]
-
-      (is (= [:part] (mapv :type parts)))
-                                        ;(let [p (first parts)]
-                                        ;  (is (= (count "Malcolm") (- (count (:bytes p)) (:body-offset p)))))
-                                        ;(let [p (last parts)]
-                                        ;  (is (= [65130 49154 49152 49152 49152 49152 28929] (mapv :bytes (:pieces p))))
-                                        ;  (is (= (+ header-size image-size) (count (:bytes p))))
-                                        ;  (is (= 48 (:body-offset p))))
-      )))
-
-
+               :parts)]
+
+      (is (= [:part] (mapv :type parts))))))
+
+


Implimentation get all documents by index and pagesize REST Service

--- src/rrms/core.clj
+++ src/rrms/core.clj
@@ -29,6 +29,14 @@

 (defroutes app-routes
   (GET "/" [] home)
+
+  (GET "/documents/:index/:pagesize" [index pagesize]
+       (rr/content-type
+        (rr/response (db/get-all-documents-by-index-pagesize
+                      {:index (parse-int index)
+                       :pagesize (parse-int pagesize)
+                       }))
+        content-type))

   (GET "/documents/all" []
        (rr/content-type


Deleting routes

Deleting routes

--- zambuko-back/src/zambuko_back/routes/home.clj
+++ zambuko-back/src/zambuko_back/routes/home.clj
@@ -3,13 +3,4 @@
   (:require [zambuko-back.views.layout :as layout]
             [zambuko-back.util :as util]))

-(defn home-page []
-  (layout/render
-    "home.html" {:content (util/md->html "/md/docs.md")}))
-
-(defn about-page []
-  (layout/render "about.html"))
-
-(defroutes home-routes
-  (GET "/" [] (home-page))
-  (GET "/about" [] (about-page)))
+(defroutes home-routes)


[fix][IDs] This sould be hash or record.'


Accept hiccup-style vector XML element variables

Addresses #9.


Remove VCS from Pusher channel

Remove VCS from Pusher channel

--- src-cljs/frontend/pusher.cljs
+++ src-cljs/frontend/pusher.cljs
@@ -43,8 +43,8 @@
 (defn user-channel [user]
   (str "private-" (:login user)))

-(defn build-channel-from-parts [{:keys [project-name build-num vcs-type]}]
-  (string/replace (str "private-" project-name "@" build-num "@vcs-" vcs-type) "/" "@"))
+(defn build-channel-from-parts [{:keys [project-name build-num]}]
+  (string/replace (str "private-" project-name "@" build-num) "/" "@"))

 (defn build-channel [build]
   (build-channel-from-parts {:project-name (vcs-url/project-name (:vcs_url build))


show elapsed time and track duration

show elapsed time and track duration

--- src-cljs/core.cljs
+++ src-cljs/core.cljs
@@ -54,9 +54,19 @@
 (defn player-pause []
   (om/transact! (player-state) #(update-in % [:playing] not)))

+(defn current-track []
+  (nth (player-queue) (:track-number (player-state)) nil))
+
 (defn player-next []
   ;; how do we make this fail if there are no more tracks?
   (om/transact! (player-state) #(update-in % [:track-number] inc)))
+
+(defn player-playing [e]
+  (let [player (.-target e)
+        offset (.-currentTime player)]
+    (om/transact! (player-state)
+                  #(update-in % [:track-offset]
+                              (fn [time] offset)))))

 (defn player-prev []
   (let [dec0 #(max (dec %) 0)]
@@ -79,7 +89,7 @@

 (defn mmss [seconds]
   (let [m (quot seconds 60)
-        s (- seconds (* 60 m))]
+        s (- (Math/floor seconds) (* 60 m))]
     (str m ":" (.substr (str "000" s) -2))))

@@ -246,7 +256,8 @@
       (let [el (om/get-node owner)]
         ;; last arg "true" is cos audio events don't bubble
         ;; http://stackoverflow.com/questions/11291651/why-dont-audio-and-video-events-bubble
-        (.addEventListener el "ended" player-next true)))
+        (.addEventListener el "ended" player-next true)
+        (.addEventListener el "timeupdate" player-playing true)))
     om/IRender
     (render [this]
       (let [queue (om/observe owner (player-queue))
@@ -258,6 +269,11 @@
                               ">>|")
                   (dom/button #js { :onClick player-prev }
                               "|<<")
+                  (dom/span #js {:className "elapsed-time time"}
+                            (mmss (:track-offset (player-state))))
+                  " / "
+                  (dom/span #js {:className "track-time"}
+                            (mmss (get (current-track) "length" 0)))
                   (dom/audio #js {:ref "player"}))))))

@@ -350,8 +366,10 @@
                        (:track-number desired) (:track-offset desired))]

     ;; find out what track we should be playing
-    (let [bits (best-media-url urls)]
-      (if-not (= (.-src actual) bits)
+    (let [bits (best-media-url urls)
+          actual-path (.getPath (goog.Uri. (.-src actual)))]
+      (when-not (= actual-path bits)
+        (println ["want " bits " got " (.-src actual)])
         (set! (.-src actual) bits)))

     (when (and (.-paused actual) (:playing desired) urls)


leftover from last commit

leftover from last commit

--- src-cljs/main.cljs
+++ src-cljs/main.cljs
@@ -3,8 +3,7 @@
   (:require [goog.dom :as gdom]
             [NoteHub.crossover.lib :as lib]
             [clojure.browser.dom :as dom]
-            [clojure.browser.event :as event])
-  (:require-macros [fetch.macros :as fm]))
+            [clojure.browser.event :as event]))

 ; frequently used selectors
 (def $draft ($ :#draft))


Move state away from atom into ThreadLocal var to get back into single thread uncontended mode.

--- core/src/samsara_core/samza.clj
+++ core/src/samsara_core/samza.clj
@@ -14,7 +14,7 @@
 (def ^:dynamic *pipeline*     nil)
 (def ^:dynamic *raw-pipeline* nil)
 (def ^:dynamic *config*       nil)
-(def ^:dynamic *store*        nil)
+(def           *store*        nil) ;; thread local only

@@ -51,6 +51,32 @@
     (println "\t" k " = " v ))
   (println "\t--------------------------------------------------------------------------"))

+
+;;
+;; Utility classes to handle per thread local state
+;;
+
+
+
+(defn thread-local
+  "Create a thread-local var"
+  [init]
+  (proxy [ThreadLocal] []
+    (initialValue [] init)))
+
+
+
+(defprotocol ILocalVar
+  (var-set [this new-val] "set the new value of a local var")
+  (var-get [this] "return the value of local var"))
+
+
+
+(extend-type ThreadLocal
+
+  ILocalVar
+  (var-set [this new-val] (.set this new-val))
+  (var-get [this] (.get this)))

@@ -127,12 +153,12 @@
   "Takes an event in json format which contain an Tx-Log entry and
    it pushes the change to the running *kv-store*"
   [^String event]
-  (swap! *store*
-         (fn [store]
-           (->> event
-                from-json
-                vector
-                (kv/restore store)))))
+  ;; this ugly stuff works because *store* is thread-local
+  (var-set *store*
+         (->> event
+              from-json
+              vector
+              (kv/restore *store*))))

@@ -187,9 +213,8 @@
     ;; other messages are processed by the normal pipeline, however here
     ;; we need to emit the state messages as well.

-    ;;          |     this not really true when
-    ;;          V     multiple threads running in same vm
-    (let [state @*store*
+    ;; this ugly stuff works because *store* is thread-local
+    (let [state (var-get *store*)
           [new-state rich-events] (pipeline state message)
           txlog     (kv/tx-log new-state)
           txlog-msg (tx-log->messages txlog)
@@ -204,10 +229,7 @@

       ;; flushing tx-log
       (let [new-state' (kv/flush-tx-log new-state txlog)]
-        (when-not (compare-and-set! *store* state new-state')
-          (throw (ex-info "Illegal state modification"
-                          {:new-state new-state ;; with tx-log
-                           :event     message})))))))
+        (var-set *store* new-state')))))

@@ -215,7 +237,7 @@
   (alter-var-root #'*pipeline*     (constantly (core/make-samsara-processor config)))
   (alter-var-root #'*raw-pipeline* (constantly (make-raw-pipeline config)))
   (alter-var-root #'*config*       (constantly config))
-  (alter-var-root #'*store*        (constantly (atom (kv/make-in-memory-kvstore))))
+  (alter-var-root #'*store*        (constantly (thread-local (kv/make-in-memory-kvstore))))
   (display-samza-config (:topics config)))


Extract common ssl config from tests

Extract common ssl config from tests

--- test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
+++ test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
@@ -319,146 +319,131 @@
         :keystore nil))))

 (deftest test-proxy-servlet
-  (testing "basic proxy support"
-    (with-target-and-proxy-servers
-      {:target {:host "0.0.0.0"
-                :port 9000}
-       :proxy  {:host "0.0.0.0"
-                :port 10000}
-       :proxy-config {:host    "localhost"
-                      :port    9000
-                      :path   "/hello"}}
-      (let [response (http-client/get "http://localhost:9000/hello/world")]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))
-      (let [response (http-client/get "http://localhost:10000/hello-proxy/world")]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))))
-
-  (testing "basic proxy support with explicit :orig scheme"
-    (with-target-and-proxy-servers
-      {:target {:host "0.0.0.0"
-                :port 9000}
-       :proxy  {:host "0.0.0.0"
-                :port 10000}
-       :proxy-config {:host   "localhost"
-                      :port   9000
-                      :path   "/hello"
-                      :scheme :orig}}
-      (let [response (http-client/get "http://localhost:9000/hello/world")]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))
-      (let [response (http-client/get "http://localhost:10000/hello-proxy/world")]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))))
-
-  (testing "basic https proxy support (pass-through https config)"
-    (with-target-and-proxy-servers
-      {:target {:ssl-host "0.0.0.0"
-                :ssl-port 9001
-                :ssl-cert "./test-resources/config/jetty/ssl/certs/localhost.pem"
-                :ssl-key  "./test-resources/config/jetty/ssl/private_keys/localhost.pem"
-                :ssl-ca-cert "./test-resources/config/jetty/ssl/certs/ca.pem"}
-       :proxy  {:ssl-host "0.0.0.0"
-                :ssl-port 10001
-                :ssl-cert "./test-resources/config/jetty/ssl/certs/localhost.pem"
-                :ssl-key  "./test-resources/config/jetty/ssl/private_keys/localhost.pem"
-                :ssl-ca-cert "./test-resources/config/jetty/ssl/certs/ca.pem"}
-       :proxy-config {:host    "localhost"
-                      :port    9001
-                      :path   "/hello"}}
-      (let [response (http-client/get "https://localhost:9001/hello/world" default-options-for-https)]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))
-      (let [response (http-client/get "https://localhost:10001/hello-proxy/world" default-options-for-https)]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))))
-
-  (testing "basic https proxy support (pass-through https config) with explicit :orig scheme"
-    (with-target-and-proxy-servers
-      {:target {:ssl-host "0.0.0.0"
-                :ssl-port 9001
-                :ssl-cert "./test-resources/config/jetty/ssl/certs/localhost.pem"
-                :ssl-key  "./test-resources/config/jetty/ssl/private_keys/localhost.pem"
-                :ssl-ca-cert "./test-resources/config/jetty/ssl/certs/ca.pem"}
-       :proxy  {:ssl-host "0.0.0.0"
-                :ssl-port 10001
-                :ssl-cert "./test-resources/config/jetty/ssl/certs/localhost.pem"
-                :ssl-key  "./test-resources/config/jetty/ssl/private_keys/localhost.pem"
-                :ssl-ca-cert "./test-resources/config/jetty/ssl/certs/ca.pem"}
-       :proxy-config {:host    "localhost"
-                      :port    9001
-                      :path   "/hello"
-                      :scheme :orig}}
-      (let [response (http-client/get "https://localhost:9001/hello/world" default-options-for-https)]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))
-      (let [response (http-client/get "https://localhost:10001/hello-proxy/world" default-options-for-https)]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))))
-
-  (testing "basic https proxy support (pass-through https config via explicit :use-server-config)"
-    (with-target-and-proxy-servers
-      {:target {:ssl-host "0.0.0.0"
-                :ssl-port 9001
-                :ssl-cert "./test-resources/config/jetty/ssl/certs/localhost.pem"
-                :ssl-key  "./test-resources/config/jetty/ssl/private_keys/localhost.pem"
-                :ssl-ca-cert "./test-resources/config/jetty/ssl/certs/ca.pem"}
-       :proxy  {:ssl-host "0.0.0.0"
-                :ssl-port 10001
-                :ssl-cert "./test-resources/config/jetty/ssl/certs/localhost.pem"
-                :ssl-key  "./test-resources/config/jetty/ssl/private_keys/localhost.pem"
-                :ssl-ca-cert "./test-resources/config/jetty/ssl/certs/ca.pem"}
-       :proxy-config {:host "localhost"
-                      :port 9001
-                      :path "/hello"
-                      :ssl-config :use-server-config}}
-      (let [response (http-client/get "https://localhost:9001/hello/world" default-options-for-https)]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))
-      (let [response (http-client/get "https://localhost:10001/hello-proxy/world" default-options-for-https)]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))))
-
-  (testing "http->https proxy support with explicit ssl config for proxy"
-    (with-target-and-proxy-servers
-      {:target {:ssl-host "0.0.0.0"
-                :ssl-port 9000
-                :ssl-cert "./test-resources/config/jetty/ssl/certs/localhost.pem"
-                :ssl-key  "./test-resources/config/jetty/ssl/private_keys/localhost.pem"
-                :ssl-ca-cert "./test-resources/config/jetty/ssl/certs/ca.pem"}
-       :proxy  {:host "0.0.0.0"
-                :port 10000}
-       :proxy-config {:host    "localhost"
-                      :port    9000
-                      :path   "/hello"
-                      :scheme :https
-                      :ssl-config {:ssl-cert "./test-resources/config/jetty/ssl/certs/localhost.pem"
-                                   :ssl-key  "./test-resources/config/jetty/ssl/private_keys/localhost.pem"
-                                   :ssl-ca-cert "./test-resources/config/jetty/ssl/certs/ca.pem"}}}
-      (let [response (http-client/get "https://localhost:9000/hello/world" default-options-for-https)]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))
-      (let [response (http-client/get "http://localhost:10000/hello-proxy/world")]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))))
-
-  (testing "https->http proxy support"
-    (with-target-and-proxy-servers
-      {:target {:host "0.0.0.0"
-                :port 9001}
-       :proxy  {:ssl-host "0.0.0.0"
-                :ssl-port 10001
-                :ssl-cert "./test-resources/config/jetty/ssl/certs/localhost.pem"
-                :ssl-key  "./test-resources/config/jetty/ssl/private_keys/localhost.pem"
-                :ssl-ca-cert "./test-resources/config/jetty/ssl/certs/ca.pem"}
-       :proxy-config {:host    "localhost"
-                      :port    9001
-                      :path   "/hello"
-                      :scheme :http}}
-      (let [response (http-client/get "http://localhost:9001/hello/world")]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))
-      (let [response (http-client/get "https://localhost:10001/hello-proxy/world" default-options-for-https)]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!"))))))+  (let [common-ssl-config {:ssl-cert    "./test-resources/config/jetty/ssl/certs/localhost.pem"
+                           :ssl-key     "./test-resources/config/jetty/ssl/private_keys/localhost.pem"
+                           :ssl-ca-cert "./test-resources/config/jetty/ssl/certs/ca.pem"}]
+    (testing "basic proxy support"
+      (with-target-and-proxy-servers
+        {:target       {:host "0.0.0.0"
+                        :port 9000}
+         :proxy        {:host "0.0.0.0"
+                        :port 10000}
+         :proxy-config {:host "localhost"
+                        :port 9000
+                        :path "/hello"}}
+        (let [response (http-client/get "http://localhost:9000/hello/world")]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Hello, World!")))
+        (let [response (http-client/get "http://localhost:10000/hello-proxy/world")]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Hello, World!")))))
+
+    (testing "basic proxy support with explicit :orig scheme"
+      (with-target-and-proxy-servers
+        {:target       {:host "0.0.0.0"
+                        :port 9000}
+         :proxy        {:host "0.0.0.0"
+                        :port 10000}
+         :proxy-config {:host   "localhost"
+                        :port   9000
+                        :path   "/hello"
+                        :scheme :orig}}
+        (let [response (http-client/get "http://localhost:9000/hello/world")]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Hello, World!")))
+        (let [response (http-client/get "http://localhost:10000/hello-proxy/world")]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Hello, World!")))))
+
+    (testing "basic https proxy support (pass-through https config)"
+      (with-target-and-proxy-servers
+        {:target       (merge common-ssl-config
+                              {:ssl-host "0.0.0.0"
+                               :ssl-port 9001})
+         :proxy        (merge common-ssl-config
+                              {:ssl-host "0.0.0.0"
+                               :ssl-port 10001})
+         :proxy-config {:host "localhost"
+                        :port 9001
+                        :path "/hello"}}
+        (let [response (http-client/get "https://localhost:9001/hello/world" default-options-for-https)]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Hello, World!")))
+        (let [response (http-client/get "https://localhost:10001/hello-proxy/world" default-options-for-https)]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Hello, World!")))))
+
+    (testing "basic https proxy support (pass-through https config) with explicit :orig scheme"
+      (with-target-and-proxy-servers
+        {:target       (merge common-ssl-config
+                              {:ssl-host    "0.0.0.0"
+                               :ssl-port    9001})
+         :proxy        (merge common-ssl-config
+                              {:ssl-host    "0.0.0.0"
+                               :ssl-port    10001})
+         :proxy-config {:host   "localhost"
+                        :port   9001
+                        :path   "/hello"
+                        :scheme :orig}}
+        (let [response (http-client/get "https://localhost:9001/hello/world" default-options-for-https)]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Hello, World!")))
+        (let [response (http-client/get "https://localhost:10001/hello-proxy/world" default-options-for-https)]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Hello, World!")))))
+
+    (testing "basic https proxy support (pass-through https config via explicit :use-server-config)"
+      (with-target-and-proxy-servers
+        {:target       (merge common-ssl-config
+                              {:ssl-host    "0.0.0.0"
+                               :ssl-port    9001})
+         :proxy        (merge common-ssl-config
+                              {:ssl-host    "0.0.0.0"
+                               :ssl-port    10001})
+         :proxy-config {:host       "localhost"
+                        :port       9001
+                        :path       "/hello"
+                        :ssl-config :use-server-config}}
+        (let [response (http-client/get "https://localhost:9001/hello/world" default-options-for-https)]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Hello, World!")))
+        (let [response (http-client/get "https://localhost:10001/hello-proxy/world" default-options-for-https)]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Hello, World!")))))
+
+    (testing "http->https proxy support with explicit ssl config for proxy"
+      (with-target-and-proxy-servers
+        {:target       (merge common-ssl-config
+                              {:ssl-host    "0.0.0.0"
+                               :ssl-port    9000})
+         :proxy        {:host "0.0.0.0"
+                        :port 10000}
+         :proxy-config {:host       "localhost"
+                        :port       9000
+                        :path       "/hello"
+                        :scheme     :https
+                        :ssl-config common-ssl-config}}
+        (let [response (http-client/get "https://localhost:9000/hello/world" default-options-for-https)]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Hello, World!")))
+        (let [response (http-client/get "http://localhost:10000/hello-proxy/world")]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Hello, World!")))))
+
+    (testing "https->http proxy support"
+      (with-target-and-proxy-servers
+        {:target       {:host "0.0.0.0"
+                        :port 9001}
+         :proxy        (merge common-ssl-config
+                              {:ssl-host    "0.0.0.0"
+                               :ssl-port    10001})
+         :proxy-config {:host   "localhost"
+                        :port   9001
+                        :path   "/hello"
+                        :scheme :http}}
+        (let [response (http-client/get "http://localhost:9001/hello/world")]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Hello, World!")))
+        (let [response (http-client/get "https://localhost:10001/hello-proxy/world" default-options-for-https)]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Hello, World!")))))))


add reagent.dom to ns form on intro page example

--- demo/reagentdemo/intro.cljs
+++ demo/reagentdemo/intro.cljs
@@ -110,6 +110,9 @@
 (def ns-src (s/syntaxed "(ns example
   (:require [reagent.core :as r]))"))

+
+(def ns-src-with-rdom (s/syntaxed "(ns example
+  (:require [reagent.dom :as rdom]))"))

 (defn intro []
   (let [github {:href "https://github.com/reagent-project/reagent"}
@@ -234,7 +237,7 @@
    look like this:"]

    [demo-component {:src [:pre
-                          ns-src
+                          ns-src-with-rdom
                           (s/src-of [:simple-component :render-simple])]}]])

 (defn performance []


remove the description from the chunk card again since even a summary is too much to read

--- src-cljs/bitfondue/core.cljs
+++ src-cljs/bitfondue/core.cljs
@@ -22,8 +22,7 @@
                       (if (> character-max-length (count (:title chunk)))
                         (:title chunk)
                         (apply str (concat (take character-max-length (:title chunk))
-                                           '("...")))))]
-    [:p.card-text (:description_summary chunk)]]])
+                                           '("...")))))]]])

 (defn chunks
   []


Cleaning up errant file.

Cleaning up errant file.

--- gpu-compute/src/think/compute/cuda_batching_system_tests.clj
+++ gpu-compute/src/think/compute/cuda_batching_system_tests.clj
@@ -1,12 +0,0 @@
-(ns think.compute.cuda-batching-system-test
-    (:require [clojure.test :refer :all]
-              [think.compute.cuda-driver :as cuda-drv]
-              [think.compute.verify.batching-system :as verify-bs]
-              [think.compute.verify.utils :as verify-utils]))
-
-
-(use-fixtures :each verify-utils/test-wrapper)
-
-
-(deftest full-batching-system-test
-  (verify-bs/full-batching-system-test (cuda-drv/create-cuda-driver) verify-utils/*datatype*))


Enhance dtb functions

Enhance dtb functions

to query for number of channels and sampling-rate

--- src/mdr2/dtb.clj
+++ src/mdr2/dtb.clj
@@ -103,6 +103,41 @@
   (let [audio-files (filter wav-file? (file-seq (file dtb)))]
     (reduce + (map file-audio-length audio-files))))

+(defn- file-audio-channels
+  "Return the number of audio channels for a given audio `file`"
+  [file]
+  (let [stream (AudioSystem/getAudioInputStream file)
+        format (.getFormat stream)]
+    (.getChannels format)))
+
+(defn audio-channels
+  "Return the number of audio channels for a given DAISY Talking Book"
+  [dtb]
+  (let [audio-files (filter wav-file? (file-seq (file dtb)))
+        channels (map file-audio-channels audio-files)]
+    ;; if not all files are mono we assume the whole book is stereo
+    (if (every? #(= 1 %) channels) 1 2)))
+
+(defn mono?
+  "Return true if a DAISY Talking Book is mono"
+  [dtb]
+  (= (audio-channels dtb) 1))
+
+(defn file-sampling-rate
+  "Return the sample rate for a given audio `file`"
+  [file]
+  (let [stream (AudioSystem/getAudioInputStream file)
+        format (.getFormat stream)]
+    (.getSampleRate format)))
+
+(defn sampling-rate
+  "Return the sample rate for a given DAISY Talking Book. If there is
+  a mix of sampling rates used the most frequently used is returned"
+  [dtb]
+  (let [audio-files (filter wav-file? (file-seq (file dtb)))
+        sampling-rates (map file-sampling-rate audio-files)]
+    (ffirst (sort-by val (frequencies sampling-rates)))))
+
 (defn meta-data
   "Return a map containing all queried meta data for a given DAISY Talking Book"
   [dtb]


throw clojure.spec exceptions

throw clojure.spec exceptions

--- src/adzerk/boot_cljs/impl.clj
+++ src/adzerk/boot_cljs/impl.clj
@@ -158,7 +158,14 @@
       {:warnings  @warnings
        :dep-order (dep-order @stored-env opts)}
       (catch Exception e
-        {:exception (util/serialize-object (handle-ex e source-paths dirs))}))))
+       (let [ex (handle-ex e source-paths dirs)]
+         ;; attempt to return serialized exception
+         (try {:exception (util/serialize-object ex)}
+           ;; doesnt work for clojure.spec exceptions
+           (catch Exception e
+             ;; throw now instead
+             (throw ex))))))))
+

 (def tracker (atom nil))


Fixed blunder on add-task merging in elements

based on if there was a key for them in the
job instead of the return from the task bundle.
Also renamed vector-map-merge to vschema-merge.

--- src/onyx/job.clj
+++ src/onyx/job.clj
@@ -9,7 +9,7 @@
    :windows [os/Window]
    :flow-conditions [os/FlowCondition]})

-(defn vector-map-merge [schema base-schema]
+(defn vschema-merge [schema base-schema]
   [(os/combine-restricted-ns (merge (first schema) (or (:schema (first base-schema))
                                                        (first base-schema))))])

@@ -19,23 +19,24 @@
                 flow-conditions]} schema]
     (-> schema
         (update :task-map os/UniqueTaskMap)
-        (update :lifecycles vector-map-merge      (:lifecycles base-schema))
-        (update :triggers vector-map-merge        (:triggers base-schema))
-        (update :windows vector-map-merge         (:windows base-schema))
-        (update :flow-conditions vector-map-merge (:flow-conditions base-schema))
+        (update :lifecycles vschema-merge (:lifecycles base-schema))
+        (update :triggers vschema-merge (:triggers base-schema))
+        (update :windows vschema-merge (:windows base-schema))
+        (update :flow-conditions vschema-merge (:flow-conditions base-schema))
         (select-keys (keys task)))))

 (s/defn ^:always-validate add-task :- os/Job
   "Adds a task's task-definition to a job"
   ([job task-definition & behaviors]
    (add-task job (reduce (fn [acc f] (f acc)) task-definition behaviors)))
-  ([{:keys [catalog lifecycles triggers windows flow-conditions] :as job}
-    {:keys [task schema] :as task-definition}]
-   (let [composed-schema (compose-schemas task-definition base-schemas)]
+  ([job task-bundle]
+   (let [{:keys [task schema]} task-bundle
+         {:keys [task-map lifecycles triggers windows flow-conditions]} task
+         composed-schema (compose-schemas task-bundle base-schemas)]
      (s/validate composed-schema task)
      (cond-> job
-       catalog (update :catalog conj (:task-map task))
-       lifecycles (update :lifecycles into (:lifecycles task))
-       triggers (update :triggers into (:triggers task))
-       windows (update :windows into (:windows task))
-       flow-conditions (update :flow-conditions into (:flow-conditions task))))))
+       task-map (update :catalog conj task-map)
+       lifecycles (update :lifecycles into lifecycles)
+       triggers (update :triggers into triggers)
+       windows (update :windows into windows)
+       flow-conditions (update :flow-conditions into flow-conditions)))))


Update constants.clj

Update constants.clj

--- src/atom_finder/constants.clj
+++ src/atom_finder/constants.clj
@@ -6,7 +6,7 @@
 (def conf-data (json/read-str (slurp (resource-path "conf.json")):key-fn keyword))

 (def gcc-path (expand-home (get conf-data :gcc-path)))
-(def gcc-repo (gitp/load-repo "Z:\\Github\\gcc"))
+(def gcc-repo (gitp/load-repo gcc-path))

 (def ag-path (expand-home (get conf-data :ag-path)))
 (def ag-repo (gitp/load-repo ag-path))