Update cancel button markup

Update cancel button markup

--- src-cljs/frontend/components/pages/build.cljs
+++ src-cljs/frontend/components/pages/build.cljs
@@ -107,18 +107,24 @@
             can-write-settings? (project-model/can-write-settings? project)]
         (html
           [:div.build-actions-v2
-           [:div
-            (when show-modal?
-              (om/build jira-modal/jira-modal {:project project
-                                               :jira-data jira-data
-                                               :close-fn #(om/set-state! owner :show-modal? false)}))]
+           (when show-modal?
+             (om/build jira-modal/jira-modal {:project project
+                                              :jira-data jira-data
+                                              :close-fn #(om/set-state! owner :show-modal? false)}))
            (when (and (build-model/can-cancel? build) can-trigger-builds?)
-             (forms/managed-button
-               [:a.cancel-build
-                {:data-loading-text "canceling"
-                 :title             "cancel this build"
-                 :on-click #(raise! owner [:cancel-build-clicked (build-model/build-args build)])}
-                "cancel build"]))
+             (list
+              (forms/managed-button
+                [:a.cancel-build.hidden-sm-down
+                 {:data-loading-text "canceling"
+                  :title             "cancel this build"
+                  :on-click #(raise! owner [:cancel-build-clicked (build-model/build-args build)])}
+                 "cancel build"])
+              (forms/managed-button
+                [:a.exception.btn-icon.cancel-build.hidden-md-up
+                 {:data-loading-text "..."
+                  :title             "cancel this build"
+                  :on-click #(raise! owner [:cancel-build-clicked (build-model/build-args build)])}
+                 [:i.material-icons "cancel"]])))
            (when can-trigger-builds?
              (om/build rebuild-actions {:build build :project project}))
            (when (and (feature/enabled? :merge-pull-request)
@@ -138,7 +144,7 @@
                                                                    :properties {:project (:vcs_url project)
                                                                                :user (:login user)}})
                     :title "Project settings"}
-                   [:i.material-icons "settings"]])
+                  [:i.material-icons "settings"]])
                [:div.build-settings
                 [:a.build-action
                  {:href (routes/v1-project-settings-path (:navigation-data data))


remove hello world

remove hello world

--- src-cljs/cljs_workcalendar/hello.cljs
+++ src-cljs/cljs_workcalendar/hello.cljs
@@ -1,5 +0,0 @@
-(ns src-cljs.cljs-workcalendar.hello)
-
-(enable-console-print!)
-
-(println "Hello world!")


Use correct `keyword-identical?` in generated diff fns

--- src/main/cljc/mikron/compiler/processor/diff.cljc
+++ src/main/cljc/mikron/compiler/processor/diff.cljc
@@ -114,7 +114,7 @@
                                    ~(diff* schema' paths' value-1' value-2' global-options)))]
                  (recur (conj! ~value ~value')
                         (unchecked-inc ~index)
-                        (and ~all-dnil? (identical? :mikron/nil ~value')))))))))))
+                        (and ~all-dnil? (runtime.processor.common/keyword-identical? :mikron/nil ~value')))))))))))

 (defmethod diff :map [[_ {:keys [sorted-by]} _ val-schema] paths value-1 value-2 global-options]
   (compiler.util/macro-context {:gen-syms [value-1' value-2' entry-1 key-2 keys-2 value value'
@@ -140,7 +140,7 @@
                                  ~(diff [:default] nil nil value-2' global-options))]
                  (recur (~(if sorted-by `assoc `assoc!) ~value ~key-2 ~value')
                         ~keys-2
-                        (and ~all-dnil? ~entry-1 (identical? :mikron/nil ~value')))))))))))
+                        (and ~all-dnil? ~entry-1 (runtime.processor.common/keyword-identical? :mikron/nil ~value')))))))))))

 (defmethod diff :tuple [[_ _ schemas] paths value-1 value-2 global-options]
   (compiler.util/macro-context {:gen-syms [value-1' value-2']}
@@ -155,7 +155,7 @@
                                          (diff [:default] nil value-1' value-2' global-options)))])
                          fields)]
            (if (and ~@(map (fn [[_ value']]
-                             `(identical? :mikron/nil ~value'))
+                             `(runtime.processor.common/keyword-identical? :mikron/nil ~value'))
                            fields))
              :mikron/nil
              ~(common/fields->tuple fields)))))))
@@ -173,7 +173,7 @@
                                          (diff [:default] nil value-1' value-2' global-options)))])
                          fields)]
            (if (and ~@(map (fn [[_ value']]
-                             `(identical? :mikron/nil ~value'))
+                             `(runtime.processor.common/keyword-identical? :mikron/nil ~value'))
                            fields))
              :mikron/nil
              ~(common/fields->record fields type)))))))


Docstring and explain code better.

Docstring and explain code better.

--- src/african_polyphony_and_polyrhythm/talk.clj
+++ src/african_polyphony_and_polyrhythm/talk.clj
@@ -242,14 +242,18 @@
         d (comp (accent 10/4) (split 9/4 1/4) b)] ; 19
     (part :horn model a b c d)))

-(defn big [notes]
+(defn big
+  "Take all the variations down a (pentatonic) octave."
+  [notes]
   (->> notes (map #(where :pitch (from 5) %))))

-(defn pan [{:keys [pitch] :as note}]
-  (let [p (cond (not pitch) 0
-                (odd? pitch) (-> pitch (/ 18) dec -)
-                (even? pitch) (-> pitch (/ 18) dec))]
-    (assoc note :pan p)))
+(defn pan
+  "Pan out an 18 piece orchestra to make individual parts more distinct."
+  [{:keys [pitch] :as note}]
+  (let [position (if (even? pitch)
+                   (-> pitch (/ 18) dec)
+                   (-> pitch (/ 18) dec -))]
+    (assoc note :pan position)))

 (def ndereje-balendoro ; p 343
   (->> [tete ta ha tulule bongo


Put code in order of presentation.

Put code in order of presentation.

--- src/african_polyphony_and_polyrhythm/talk.clj
+++ src/african_polyphony_and_polyrhythm/talk.clj
@@ -7,44 +7,6 @@
             [leipzig.live :as live]
             [leipzig.live :refer [stop]]))

-; Natural numbers
-(comment
-  (range 0 8))
-
-; Raw frequencies
-(comment
-  (->> (phrase (repeat 1/4) [440 494 554 622 659 740 831 880])
-       live/play))
-
-; Midi
-(comment
-  (->> (phrase (repeat 1/4) [69 71 73 74 76 78 80 81])
-       (where :pitch temperament/equal)
-       live/play))
-
-; Scales
-(def major (scale [2 2 1 2 2 2 1]))
-(def minor (scale [2 1 2 2 1 2 2]))
-(def pentatonic (scale [2 3 2 2 3]))
-(def car (comp high pentatonic -))
-
-(comment
-  (->> (phrase (repeat 1/4) (range 0 8))
-       (where :pitch (comp temperament/equal A major))
-       live/play))
-
-(defn forever [riff]
-  (concat riff (lazy-seq (->> riff forever (after (duration riff))))))
-
-(defn clapping-music []
-  (let [african-bell-pattern (rhythm [1/8 1/8 1/4 1/8 1/4 1/4 1/8 1/4])]
-    (->> african-bell-pattern forever (all :part :clap1)
-         (canon #(->> % (take 32) (then (rhythm [1/8])) forever (all :part :clap2))))))
-
-(comment
-  (->> (clapping-music)
-       live/play))
-
 (defn vary [t f]
   (fn [notes]
     (let [before? #(-> % :time (< t))
@@ -54,10 +16,8 @@

 (defn split [t fraction]
   (letfn [(f [note]
-            [(-> note
-                 (assoc :duration fraction))
-             (-> note
-                 (update-in [:duration] - fraction)
+            [(-> note (assoc :duration fraction))
+             (-> note (update-in [:duration] - fraction)
                  (update-in [:time] + fraction))])]
     (vary t f)))

@@ -78,6 +38,86 @@

 (defn part [model & variations]
   ((apply juxt identity variations) model))
+
+(def first-drum
+  (let [model (->> (rhythm [2/5 3/5 1/5 1/5 3/5]) (all :part :clap1))
+        a (split 6/5 1/10)
+        b (split 5/5 1/10)
+        c (comp (split 17/15 2/15) (split 5/5 2/15) (omit 6/5))
+        d (comp (omit 7/5) (omit 6/5))]
+    (part model a b c d)))
+
+(def second-drum
+  (let [model (->> (rhythm [2/5 2/5 4/5 1/5 1/5]) (all :part :clap2))
+        a (omit 9/5)
+        b (omit 0)
+        c (comp a b)
+        d #(then % (->> (rhythm (repeat 5 2/5)) (all :part :clap2)))]
+    (part model a b c d)))
+
+(def third-drum
+  (let [model (->> (rhythm [2/5 1/5 2/5]) (all :part :clap3))
+        a (omit 2/5)
+        b (omit 3/5)
+        c (comp (split 0 1/5) a)
+        d (split 3/5 1/5)
+        e (comp (split 3/5 1/10) d)
+        f (split 0 1/5)
+        g (comp (split 0 1/10) f)]
+    (part model a b c d e f g)))
+
+(def aga-terumo ; p299
+  (let [drums [first-drum second-drum third-drum]]
+    (->> drums
+         ;(map (comp list first))
+         (map rand-variations)
+         (map after (range 0 (* 4 3) 4))
+         (reduce with))))
+
+(comment
+  (->>
+    aga-terumo
+    (tempo (bpm 90))
+    (live/play)))
+
+; Clapping music
+(defn forever [riff]
+  (concat riff (lazy-seq (->> riff forever (after (duration riff))))))
+
+(defn clapping-music []
+  (let [african-bell-pattern (rhythm [1/8 1/8 1/4 1/8 1/4 1/4 1/8 1/4])]
+    (->> african-bell-pattern forever (all :part :clap1)
+         (canon #(->> % (take 32) (then (rhythm [1/8])) forever (all :part :clap2))))))
+
+(comment
+  (->> (clapping-music)
+       live/play))
+
+; Natural numbers
+(comment
+  (range 0 8))
+
+; Raw frequencies
+(comment
+  (->> (phrase (repeat 1/4) [440 494 554 622 659 740 831 880])
+       live/play))
+
+; Midi
+(comment
+  (->> (phrase (repeat 1/4) [69 71 73 74 76 78 80 81])
+       (where :pitch temperament/equal)
+       live/play))
+
+; Scales
+(def major (scale [2 2 1 2 2 2 1]))
+(def minor (scale [2 1 2 2 1 2 2]))
+(def pentatonic (scale [2 3 2 2 3]))
+(def car (comp high pentatonic -))
+
+(comment
+  (->> (phrase (repeat 1/4) (range 0 8))
+       (where :pitch (comp temperament/equal A major))
+       live/play))

 (def tete
   (let [model (phrase [8/4 3/4 5/4] (repeat 0))
@@ -147,47 +187,6 @@
     ndereje-balendoro
     (where :pitch (comp temperament/equal A car))
     (tempo (bpm 120))
-    (live/play)))
-
-(def first-drum
-  (let [model (->> (rhythm [2/5 3/5 1/5 1/5 3/5]) (all :part :clap1))
-        a (split 6/5 1/10)
-        b (split 5/5 1/10)
-        c (comp (split 17/15 2/15) (split 5/5 2/15) (omit 6/5))
-        d (comp (omit 7/5) (omit 6/5))]
-    (part model a b c d)))
-
-(def second-drum
-  (let [model (->> (rhythm [2/5 2/5 4/5 1/5 1/5]) (all :part :clap2))
-        a (omit 9/5)
-        b (omit 0)
-        c (comp a b)
-        d #(then % (->> (rhythm (repeat 5 2/5)) (all :part :clap2)))]
-    (part model a b c d)))
-
-(def third-drum
-  (let [model (->> (rhythm [2/5 1/5 2/5]) (all :part :clap3))
-        a (omit 2/5)
-        b (omit 3/5)
-        c (comp (split 0 1/5) a)
-        d (split 3/5 1/5)
-        e (comp (split 3/5 1/10) d)
-        f (split 0 1/5)
-        g (comp (split 0 1/10) f)]
-    (part model a b c d e f g)))
-
-(def aga-terumo ; p299
-  (let [drums [first-drum second-drum third-drum]]
-    (->> drums
-         ;(map (comp list first))
-         (map rand-variations)
-         (map after (range 0 (* 4 3) 4))
-         (reduce with))))
-
-(comment
-  (->>
-    aga-terumo
-    (tempo (bpm 90))
     (live/play)))

 ; Instruments


Add soft size-trimming. Fixes #8.

Add soft size-trimming. Fixes #8.

--- src/algebolic/expression/genetics.clj
+++ src/algebolic/expression/genetics.clj
@@ -138,4 +138,15 @@
   [expr]
   (walk/postwalk
     #(if (number? %) (twiddle-constant %) %)
-    expr))+    expr))
+
+(defn trim
+  "Takes an expresion and a max-size, and trims the expression if it is too big. The trimming is done
+  by returning a randomly selected sub-expression. There is no guarantee that this sub-expression is
+  smaller than the size limit, or indeed smaller than the original expression. But if applied each
+  generation it will tend to keep the population size under control."
+  [max-size expr]
+  (let [size (tree/count-nodes expr)]
+    (if (> max-size size)
+      (tree/sub-tree expr (rand-int size))
+      expr)))


remove mode from service dashboard

remove mode from service dashboard

--- src/cljs/swarmpit/component/service/list.cljs
+++ src/cljs/swarmpit/component/service/list.cljs
@@ -1,5 +1,6 @@
 (ns swarmpit.component.service.list
-  (:require [material.component :as comp]
+  (:require [material.icon :as icon]
+            [material.component :as comp]
             [swarmpit.component.state :as state]
             [swarmpit.component.mixin :as mixin]
             [swarmpit.component.handler :as handler]
@@ -13,7 +14,7 @@
 (def cursor [:page :service :list])

 (def headers [{:name  "Name"
-               :width "15%"}
+               :width "20%"}
               {:name  "Image"
                :width "30%"}
               {:name  "Replicas"
@@ -21,7 +22,7 @@
               {:name  "Ports"
                :width "15%"}
               {:name  "Status"
-               :width "25%"}])
+               :width "20%"}])

 (def render-item-keys
   [[:serviceName] [:repository :image] [:status :info] [:ports] [:state]])
@@ -40,16 +41,9 @@
 (defn- render-item-ports [value]
   (html
     (for [port value]
-      [:div (str (:hostPort port) " ➟ " (:containerPort port) "/" (:protocol port))])))
-
-(defn- render-item-info [value mode]
-  (html
-    (if (= "global" mode)
-      [:span
-       [:span (comp/label-info value)]
-       [:span " "]
-       [:span.label.label-info [:b "G"]]]
-      [:span (comp/label-info value)])))
+      [:div
+       [:span (:hostPort port)
+        [:span.service-list-port (str " [" (:protocol port) "]")]]])))

 (defn- render-status [value update-status]
   (if (or (= "updating" update-status)
@@ -60,12 +54,11 @@
 (defn- render-item
   [item service]
   (let [update (get-in service [:status :update])
-        mode (:mode service)
         value (val item)]
     (case (key item)
       :ports (render-item-ports value)
       :state (render-status value update)
-      :info (render-item-info value mode)
+      :info (comp/label-info value)
       value)))

 (defn- onclick-handler


Simplified the way the user service handles UserService objects.

--- src/appengine_magic/services/user.clj
+++ src/appengine_magic/services/user.clj
@@ -5,26 +5,26 @@
 (defonce *default-user-service* (atom nil))

-(defn- ensure-user-service [user-service]
-  (when (nil? @user-service)
-    (reset! user-service (UserServiceFactory/getUserService))))
+(defn- get-user-service [& {:keys [service]}]
+  (if (nil? service)
+      (do (when (nil? @*default-user-service*)
+            (reset! *default-user-service* (UserServiceFactory/getUserService)))
+          @*default-user-service*)
+      service))

-(defn current-user [& {:keys [user-service]
-                       :or {user-service *default-user-service*}}]
-  (ensure-user-service user-service)
-  (.getCurrentUser @user-service))
+(defn current-user [& {:keys [service]}]
+  (let [service (get-user-service :service service)]
+    (.getCurrentUser service)))

-(defn login-url [& {:keys [user-service destination]
-                    :or {user-service *default-user-service*
-                         destination "/"}}]
-  (ensure-user-service user-service)
-  (.createLoginURL @user-service destination))
+(defn login-url [& {:keys [service destination]
+                    :or {destination "/"}}]
+  (let [service (get-user-service :service service)]
+    (.createLoginURL service destination)))

-(defn logout-url [& {:keys [user-service destination]
-                     :or {user-service *default-user-service*
-                          destination "/"}}]
-  (ensure-user-service user-service)
-  (.createLogoutURL @user-service destination))
+(defn logout-url [& {:keys [service destination]
+                     :or {destination "/"}}]
+  (let [service (get-user-service :service service)]
+    (.createLogoutURL service destination)))


Remove bytes

Remove bytes

--- src/clojure/clojurewerkz/cassaforte/bytes.clj
+++ src/clojure/clojurewerkz/cassaforte/bytes.clj
@@ -1,29 +0,0 @@
-;; Copyright (c) 2012-2014 Michael S. Klishin, Alex Petrov, and the ClojureWerkz Team
-;;
-;; Licensed under the Apache License, Version 2.0 (the "License");
-;; you may not use this file except in compliance with the License.
-;; You may obtain a copy of the License at
-;;
-;;     http://www.apache.org/licenses/LICENSE-2.0
-;;
-;; Unless required by applicable law or agreed to in writing, software
-;; distributed under the License is distributed on an "AS IS" BASIS,
-;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;; See the License for the specific language governing permissions and
-;; limitations under the License.
-
-(ns clojurewerkz.cassaforte.bytes
-  "Facility functions to use with serialization, handle deserialization of all the data types
-   supported by Cassandra."
-  (:import java.nio.ByteBuffer java.util.Date
-           [com.datastax.driver.core DataType DataType$Name]))
-
-(defn #^bytes to-bytes
-  [^ByteBuffer byte-buffer]
-  (let [bytes (byte-array (.remaining byte-buffer))]
-    (.get byte-buffer bytes 0 (count bytes))
-    bytes))
-
-(defn deserialize
-  [^DataType dt bytes ^Integer protocol-version]
-  (.deserialize dt bytes protocol-version))


Use p/placeholder-key? in run-graph

Use p/placeholder-key? in run-graph

--- src/com/wsscode/pathom/connect/run_graph.cljc
+++ src/com/wsscode/pathom/connect/run_graph.cljc
@@ -2,6 +2,7 @@
   (:require [clojure.set :as set]
             [clojure.spec.alpha :as s]
             [com.wsscode.pathom.connect.indexes :as pci]
+            [com.wsscode.pathom.core :as p]
             [com.wsscode.pathom.misc :as p.misc]
             [edn-query-language.core :as eql]))

@@ -431,17 +432,12 @@
         ; attr unreachable
         (add-unreachable-attr out attr)))))

-(defn placeholder?
-  "Check if attr is a placeholder node."
-  [{:com.wsscode.pathom.core/keys [placeholder-prefixes]} attr]
-  (contains? placeholder-prefixes (namespace attr)))
-
 (defn compute-run-graph
   ([out
     env]
    (reduce
      (fn [out {:keys [children key] :as node}]
-       (if (placeholder? env key)
+       (if (p/placeholder-key? env key)
          (if (seq children)
            (reduce #(compute-attribute-graph % env %2) out children)
            out)


Fix pct task scheduler misallocation. Use largest remainders method to allocate remaining peers. Ensure peers on oversaturated tasks are reallocated to unsaturated tasks.

--- src/onyx/scheduling/percentage_task_scheduler.clj
+++ src/onyx/scheduling/percentage_task_scheduler.clj
@@ -2,59 +2,82 @@
   (:require [onyx.scheduling.common-task-scheduler :as cts]
             [onyx.log.commands.common :as common]))

-(defn sort-tasks-by-pct [replica job tasks]
-  (let [indexed
-        (map-indexed
-         (fn [k t]
-           {:position k :task t :pct (get-in replica [:task-percentages job t])})
-         (reverse tasks))]
-    (reverse (sort-by (juxt :pct :position) indexed))))
+(defn tasks-by-pct [replica job tasks]
+  (map
+    (fn [t]
+      {:task t :pct (get-in replica [:task-percentages job t])})
+    tasks))

-(defn min-task-allocations [replica job tasks n-peers]
-  (mapv
-   (fn [task]
-     (let [n (int (Math/floor (* (* 0.01 (:pct task)) n-peers)))]
-       (assoc task :allocation n)))
-   tasks))
+(defn rescale-task-percentages
+  "Rescale task percentages after saturated tasks were removed"
+  [tasks]
+  (let [total (/ (apply + (map :pct tasks)) 100)]
+    (map (fn [task]
+           (update-in task [:pct] / total))
+         tasks)))

-(defn percentage-balanced-taskload [replica job candidate-tasks n-peers]
-  (let [sorted-tasks (sort-tasks-by-pct replica job candidate-tasks)
-        init-allocations (min-task-allocations replica job sorted-tasks n-peers)
-        init-usage (apply + (map :allocation init-allocations))
-        left-over-peers (- n-peers init-usage)
-        with-leftovers (update-in init-allocations [0 :allocation] + left-over-peers)]
-    (into {} (map (fn [t] {(:task t) t}) with-leftovers))))
+(defn largest-remainder-allocations
+  "Allocates remaining peers to the tasks with the largest remainder.
+  e.g. 3 tasks pct allocated 3.5, 1.75, 1.75 -> 3, 2, 2"
+  [tasks n-peers]
+  (let [tasks* (rescale-task-percentages tasks)
+        unrounded (map (fn [task]
+                         (* 0.01 (:pct task) n-peers))
+                       tasks*)
+        full (map int unrounded)
+        taken (apply + full)
+        remaining (- n-peers taken)
+        full-allocated (zipmap tasks* full)
+        remainders (->> (map (fn [task v]
+                               (vector task (- v (int v))))
+                             tasks*
+                             unrounded)
+                        (sort-by second)
+                        (reverse)
+                        (take remaining)
+                        (map (juxt first (constantly 1)))
+                        (into {}))
+        final-allocations (merge-with + full-allocated remainders)]
+    (mapv (fn [[task allocation]]
+            (assoc task :allocation (int allocation)))
+          final-allocations)))
+
+(defn percentage-balanced-taskload
+  "Percentage balance taskload by allocating via largest remainders.
+  If a task becomes oversaturated, take it out of the pool, fully allocated,
+  and restart the process with the remaining peers and tasks"
+  [replica job candidate-tasks n-peers]
+  {:post [(>= n-peers 0)
+          (= n-peers (reduce + (map :allocation (vals %))))]}
+  (let [sorted-tasks (tasks-by-pct replica job candidate-tasks)
+        allocations (largest-remainder-allocations sorted-tasks n-peers)
+        oversaturated (filter (fn [{:keys [task allocation]}]
+                                (> allocation (get-in replica [:task-saturation job task])))
+                              allocations)
+        cutoff-oversaturated (->> oversaturated
+                                  (map (fn [{:keys [task] :as t}]
+                                         [task (assoc t :allocation (get-in replica [:task-saturation job task]))]))
+                                  (into {}))]
+    (if (empty? cutoff-oversaturated)
+      (into {} (map (fn [t] {(:task t) t}) allocations))
+      (let [n-peers-fully-saturated (apply + (map :allocation (vals cutoff-oversaturated)))
+            n-remaining-peers (- n-peers n-peers-fully-saturated)
+            unallocated-tasks (remove cutoff-oversaturated candidate-tasks)]
+        (merge (percentage-balanced-taskload replica job unallocated-tasks n-remaining-peers)
+               cutoff-oversaturated)))))

 (defmethod cts/drop-peers :onyx.task-scheduler/percentage
   [replica job n]
   (let [tasks (keys (get-in replica [:allocations job]))
         balanced (percentage-balanced-taskload replica job tasks n)]
     (mapcat
-     (fn [[task {:keys [allocation]}]]
-       (drop-last allocation (get-in replica [:allocations job task])))
-     balanced)))
-
-(defn reuse-spare-peers [replica job tasks spare-peers]
-  (loop [[head & tail :as task-seq] (get-in replica [:tasks job])
-         results tasks
-         capacity spare-peers]
-    (let [tail (vec tail)]
-      (cond (or (<= capacity 0) (not (seq task-seq)))
-            results
-            (< (get results head) (or (get-in replica [:task-saturation job head] Double/POSITIVE_INFINITY)))
-            (recur (conj tail head) (update-in results [head] inc) (dec capacity))
-            :else
-            (recur tail results capacity)))))
+      (fn [[task {:keys [allocation]}]]
+        (drop-last allocation (get-in replica [:allocations job task])))
+      balanced)))

 (defmethod cts/task-distribute-peer-count :onyx.task-scheduler/percentage
   [replica job n]
-  (let [tasks (get-in replica [:tasks job])
-        init
-        (reduce
-         (fn [all [task k]]
-           (assoc all task (min (get-in replica [:task-saturation job task] Double/POSITIVE_INFINITY)
-                                (int (* n (get-in replica [:task-percentages job task]) 0.01)))))
-         {}
-         (map vector tasks (range)))
-        spare-peers (- n (apply + (vals init)))]
-    (reuse-spare-peers replica job init spare-peers)))
+  (->> (percentage-balanced-taskload replica job (get-in replica [:tasks job]) n)
+       vals
+       (map (juxt :task :allocation))
+       (into {})))


call the static method idiot

call the static method idiot

--- src/syncserver/core.clj
+++ src/syncserver/core.clj
@@ -10,7 +10,7 @@

 (declare ddiff)

-(def cache! (.. CacheBuilder (newBuilder) (expireAfterWrite 5 TimeUnit/SECONDS) (build)))
+(def cache! (.. (CacheBuilder/newBuilder) (expireAfterWrite 5 TimeUnit/SECONDS) (build)))

 (def current-state
   (atom {:state nil


remove source map reset hack

remove source map reset hack

fixed properly in closure compiler
https://github.com/google/closure-compiler/commit/89eafdd8484e59e20b45744ccd1b7e1670bb466c#diff-f9e99cb06c51cd5f3b4bcdfe498596125eae9dcfbe56cf1636f9d0011d883233

--- src/main/shadow/build/closure.clj
+++ src/main/shadow/build/closure.clj
@@ -1383,22 +1383,6 @@
     (.setAccessible fld true)
     (.set fld o val)))

-;; hack to get around source-map reset resetting too much
-;; hope this doesn't end badly
-
-;; when trying to get multiple separated source maps it will fail without reset
-;; but reset will remove all source code from files we need to generated proper maps
-;; so this just copies and restores via reflection since all of it is private
-;; FIXME: should open a proper closure-compiler issue about this
-(defn reset-but-keep-files [source-map]
-  (let [gen (get-field-value source-map "generator")
-        sfcm (get-field-value gen "sourceFileContentMap")
-        sfcm-copy (LinkedHashMap. sfcm)]
-
-    (.reset source-map)
-
-    (set-field-value gen "sourceFileContentMap" sfcm-copy)))
-
 (defn convert-sources*
   "takes a list of :js sources and rewrites them to using closure
    partial compiles must supply the cached sources so closure doesn't complain about things
@@ -1556,8 +1540,7 @@
         (update ::classpath-js-injected-libs set/union injected-libs)
         (util/reduce->
           (fn [state source-node]
-            (reset-but-keep-files source-map)
-
+            (.reset source-map)

             (let [name (.getSourceFileName source-node)]

@@ -1981,7 +1964,7 @@
         (update ::shadow-js-injected-libs set/union injected-libs)
         (util/reduce->
           (fn [state source-node]
-            (reset-but-keep-files source-map)
+            (.reset source-map)

             (let [name (.getSourceFileName source-node)]
               (cond
@@ -2277,7 +2260,7 @@
         (update ::goog-injected-libs set/union injected-libs)
         (util/reduce->
           (fn [state source-node]
-            (reset-but-keep-files source-map)
+            (.reset source-map)

             (let [name (.getSourceFileName source-node)]
               (cond


Extract run-media-driver!

Extract run-media-driver!

--- src/desdemona/launcher/aeron_media_driver.clj
+++ src/desdemona/launcher/aeron_media_driver.clj
@@ -12,18 +12,28 @@
    ["-h" "--help"
     "Display a help message"]])

+(def ^:private aeron-launch-error-message
+  (str
+   "Error starting media driver. This may be due to a media driver data "
+   "incompatibility between versions. Check that no other media driver "
+   "has been started and then use -d to delete the directory on startup"))
+
+(defn ^:private run-media-driver!
+  [opts]
+  (let [ctx (doto (MediaDriver$Context.)
+              (.dirsDeleteOnStart (-> opts :options :delete-dirs)))]
+    (try (MediaDriver/launch ctx)
+         (catch IllegalStateException ise
+           (throw (Exception. aeron-launch-error-message ise))))))
+
 (defn -main [& args]
   (let [opts (parse-opts args cli-options)
-        {:keys [help delete-dirs]} (:options opts)
-        ctx (cond-> (MediaDriver$Context.)
-              delete-dirs (.dirsDeleteOnStart delete-dirs))
-        media-driver (try (MediaDriver/launch ctx)
-                          (catch IllegalStateException ise
-                            (throw (Exception. "Error starting media driver. This may be due to a media driver data incompatibility between versions. Check that no other media driver has been started and then use -d to delete the directory on startup" ise))))]
+        {:keys [help delete-dirs]} (:options opts)]
     (when help
       (run! (fn [opt]
               (println (clojure.string/join " " (take 3 opt))))
             cli-options)
       (System/exit 0))
+    (run-media-driver!)
     (println "Launched the Media Driver. Blocking forever...")
     (<!! (chan))))


BIG commit to reflect working code for local project in scatter.clj

--- src/clj/forma/hadoop/jobs/scatter.clj
+++ src/clj/forma/hadoop/jobs/scatter.clj
@@ -1,13 +1,11 @@
 (ns forma.hadoop.jobs.scatter
   "Namespace for arbitrary queries."
   (:use cascalog.api
-        cascalog.lzo
-        [forma.hadoop.pail :only (to-pail)]
         [forma.source.tilesets :only (tile-set country-tiles)]
-        [forma.hadoop.pail :only (?pail- split-chunk-tap)]
-        [cascalog.checkpoint :only (workflow)])
+        [forma.hadoop.pail :only (to-pail ?pail- split-chunk-tap)]
+        [cascalog.checkpoint :only (workflow)]
+        [clojure.math.numeric-tower :only (round)])
   (:require [cascalog.ops :as c]
-            [forma.utils :only (throw-illegal)]
             [forma.reproject :as r]
             [forma.schema :as schema]
             [forma.trends.stretch :as stretch]
@@ -15,7 +13,8 @@
             [forma.hadoop.jobs.forma :as forma]
             [forma.hadoop.jobs.timeseries :as tseries]
             [forma.date-time :as date]
-            [forma.classify.logistic :as log]))
+            [forma.classify.logistic :as log]
+            [forma.thrift :as thrift]))

 (def convert-line-src
   (hfs-textline "s3n://modisfiles/ascii/admin-map.csv"))
@@ -27,7 +26,9 @@
   [chunk-src]
   (<- [?s-res ?mod-h ?mod-v ?sample ?line ?val]
       (chunk-src _ ?chunk)
-      (p/blossom-chunk ?chunk :> ?s-res ?mod-h ?mod-v ?sample ?line ?val)))
+      (thrift/unpack ?chunk :> _ ?loc ?data _ _)
+      (thrift/get-field-value ?data :> ?val)
+      (thrift/unpack ?loc :> ?s-res ?mod-h ?mod-v ?sample ?line)))

 (defn country-tap
   [gadm-src convert-src]
@@ -58,6 +59,8 @@
          (>= ?vcf 25))))

 (defn static-src [{:keys [vcf-limit]} pail-path]
+  ;; screen out border pixels later - doing it here will remove non-
+  ;; but nearly water pixels before they can be included as neighbors
   (let [[vcf hansen ecoid gadm border]
         (map (comp static-tap (partial split-chunk-tap pail-path))
              [["vcf"] ["hansen"] ["ecoid"] ["gadm"] ["border"]])]
@@ -82,7 +85,7 @@
               :long-block 15
               :window 5}
    "500-16" {:est-start "2005-12-31"
-             :est-end "2012-01-17"
+             :est-end "2012-04-22"
              :s-res "500"
              :t-res "16"
              :neighbors 1
@@ -99,65 +102,235 @@
   [ts-pail-path dataset s-res t-res]
   (split-chunk-tap ts-pail-path [dataset (format "%s-%s" s-res t-res)]))

+(defn map-round
+  [series-obj]
+  (let [[start end series] (thrift/unpack series-obj)]
+    (thrift/TimeSeries* (long start) (long end) (map round (thrift/unpack series)))))
+
 (defn adjusted-precl-tap
   "Document... returns a tap that adjusts for the incoming
   resolution."
-  [ts-pail-path s-res base-t-res t-res]
-  (let [precl-tap (constrained-tap ts-pail-path "precl" s-res base-t-res)]
-    (if (= t-res base-t-res)
-      precl-tap
-      (<- [?path ?final-chunk]
-        (precl-tap ?path ?chunk)
-        (map ?chunk [:location :value] :> ?location ?series)
-        (schema/unpack-pixel-location ?locat)
-        (stretch/ts-expander base-t-res t-res ?series :> ?new-series)
-        (assoc ?chunk
-          :value ?new-series
-          :temporal-res t-res :> ?final-chunk)))))
-
-(defmapcatop expand-rain-pixel
-  [sample line]
-  (let [sample-0 (* 2 sample)
-        line-0   (* 2 line)]
-    (for [x (range 2)
-          y (range 2)]
-      [(+ sample-0 x) (+ line-0 y)])))
-
-(defn new-adjusted-precl-tap
-  "More brittle version that assumes conversion from 1000 to 500m."
-  [ts-pail-path s-res base-t-res t-res]
-  (let [precl-tap (constrained-tap ts-pail-path "precl" s-res base-t-res)]
-    (<- [?path ?final-chunk]
-        (precl-tap ?path ?chunk)
-        (forma/get-loc ?chunk :> ?s-res ?mod-h ?mod-v ?s ?l ?series)
-        (expand-rain-pixel ?s ?l :> ?sample ?line)
-        (schema/pixel-location "500" ?mod-h ?mod-v ?sample ?line :> ?location)
-        (stretch/ts-expander base-t-res t-res ?series :> ?new-series)
-        (assoc ?chunk
-          :value ?new-series
-          :location ?location
-          :temporal-res t-res :> ?final-chunk))))
-
-(defn first-half-query
-  "Poorly named! Returns a query that generates a number of position
-  and dataset identifier"
-  [pail-path ts-pail-path out-path run-key]
-  (let [{:keys [s-res t-res est-end] :as forma-map} (forma-run-parameters run-key)]
-    (assert forma-map (str run-key " is not a valid run key!"))
-    (with-job-conf {"mapreduce.jobtracker.split.metainfo.maxsize" 100000000000}
-      (?- (hfs-seqfile out-path :sinkmode :replace)
-          (forma/forma-query
-           forma-map
-           (constrained-tap ts-pail-path "ndvi" s-res t-res)
-           (constrained-tap ts-pail-path "reli" s-res t-res)
-           (new-adjusted-precl-tap ts-pail-path "1000" "32" t-res)
-           (constrained-tap pail-path "vcf" s-res "00")
-           (tseries/fire-query pail-path
-                               t-res
-                               "2000-11-01"
-                               est-end))))))
+  [ts-path s-res base-t-res t-res src]
+  (if (= t-res base-t-res)
+      src ;;(constrained-tap ts-path "precl" s-res base-t-res)
+      (<- [?path ?adjusted-pixel-chunk]
+          (src ?path ?pixel-chunk)
+          (thrift/unpack ?pixel-chunk :> ?name ?in-pix-loc ?ts ?t-res _)
+          (thrift/unpack ?in-pix-loc :> ?s-res ?mod-h ?mod-v ?sample ?line)
+          (stretch/ts-expander base-t-res t-res ?ts :> ?expanded-ts)
+          (map-round ?expanded-ts :> ?rounded-ts)
+          (thrift/ModisPixelLocation* ?s-res ?mod-h ?mod-v ?sample ?line :> ?out-pix-loc)
+          (thrift/DataChunk* ?name ?out-pix-loc ?rounded-ts ?t-res :> ?adjusted-pixel-chunk)
+          (:distinct false))))

 (defmain formarunner
+  [tmp-root pail-path ts-pail-path fire-pail-path out-path run-key]
+  (let [{:keys [s-res t-res est-end] :as est-map} (forma-run-parameters run-key)
+        mk-filter (fn [vcf-path ts-src] (forma/filter-query (hfs-seqfile vcf-path)
+                                                           (:vcf-limit est-map)
+                                                           ts-src))]
+    (assert est-map (str run-key " is not a valid run key!"))
+
+    (workflow [tmp-root]
+
+              vcf-step
+              ([:tmp-dirs vcf-path]
+                 (?- (hfs-seqfile vcf-path)
+                     (static-tap (constrained-tap pail-path "vcf" s-res "00"))))
+
+              gadm-step
+              ([:tmp-dirs gadm-path]
+                 (?- (hfs-seqfile gadm-path)
+                     (static-tap (constrained-tap pail-path "gadm" s-res "00"))))
+
+              hansen-step
+              ([:tmp-dirs hansen-path]
+                 (?- (hfs-seqfile hansen-path)
+                     (static-tap (constrained-tap pail-path "hansen" s-res "00"))))
+
+              ecoid-step
+              ([:tmp-dirs ecoid-path]
+                 (?- (hfs-seqfile ecoid-path)
+                     (static-tap (constrained-tap pail-path "ecoid" s-res "00"))))
+
+              border-step
+              ([:tmp-dirs border-path]
+                 (?- (hfs-seqfile border-path)
+                     (static-tap (constrained-tap pail-path "border" s-res "00"))))
+
+              static-step
+              ([:tmp-dirs static-path]
+                 (?- (hfs-seqfile static-path)
+                     (forma/consolidate-static (:vcf-limit est-map)
+                                               (hfs-seqfile vcf-path)
+                                               (hfs-seqfile gadm-path)
+                                               (hfs-seqfile hansen-path)
+                                               (hfs-seqfile ecoid-path)
+                                               (hfs-seqfile border-path))))
+
+              ndvi-pail-seq-step
+              ([:tmp-dirs ndvi-seq-path]
+                 "Filters out NDVI with VCF < 25"
+                 (?- (hfs-seqfile ndvi-seq-path)
+                     (<- [?pail-path ?data-chunk]
+                         ((constrained-tap ts-pail-path
+                                           "ndvi"
+                                           s-res
+                                           t-res) ?pail-path ?data-chunk))))
+
+              reli-pail-seq-step
+              ([:tmp-dirs reli-seq-path]
+                 "Filters out reliability with VCF < 25"
+                 (?- (hfs-seqfile reli-seq-path)
+                     (<- [?pail-path ?data-chunk]
+                         ((constrained-tap ts-pail-path
+                                           "reli"
+                                           s-res
+                                           t-res) ?pail-path ?data-chunk))))
+
+              rain-pail-seq-step
+              ([:tmp-dirs rain-seq-path]
+                 "Filter out rain with VCF < 25"
+                 (?- (hfs-seqfile rain-seq-path)
+                     (<- [?pail-path ?data-chunk]
+                         ((constrained-tap ts-pail-path
+                                           "precl"
+                                           s-res
+                                           "32") ?pail-path ?data-chunk))))
+
+              ndvi-filter
+              ([:tmp-dirs ndvi-path]
+                 "Filters out NDVI with VCF < 25"
+                 (?- (hfs-seqfile ndvi-path)
+                     (mk-filter vcf-path (hfs-seqfile ndvi-seq-path))))
+
+              reli-filter
+              ([:tmp-dirs reli-path]
+                 "Filters out reliability with VCF < 25"
+                 (?- (hfs-seqfile reli-path)
+                     (mk-filter vcf-path (hfs-seqfile reli-seq-path))))
+
+              screen-rain
+              ([:tmp-dirs rain-screened-path]
+                 "Only keeps rain for a specific country"
+                 (?- (hfs-seqfile rain-screened-path)
+                     (forma/screen-by-tileset (hfs-seqfile rain-seq-path)
+                                              (tile-set :IDN :BRA))))
+
+              rain-filter
+              ([:tmp-dirs rain-path]
+                 "Filter out rain with VCF < 25"
+                 (?- (hfs-seqfile rain-path)
+                     (mk-filter vcf-path
+                                (adjusted-precl-tap ts-pail-path
+                                                    s-res
+                                                    "32"
+                                                    t-res
+                                                    (hfs-seqfile rain-screened-path)))))
+
+              adjustseries
+              ([:tmp-dirs adjusted-series-path]
+                 "Adjusts lengths of all timeseries so they all cover the same
+                  time spans."
+                 (with-job-conf {"mapred.min.split.size" 805306368}
+                   (?- (hfs-seqfile adjusted-series-path)
+                       (forma/dynamic-filter (hfs-seqfile ndvi-path)
+                                             (hfs-seqfile reli-path)
+                                             (hfs-seqfile rain-path)))))
+
+              cleanseries
+              ([:tmp-dirs clean-series]
+                 "Screen out extremely cloudy pixels. Currently doesn't
+                  actually run the timeseries cleaning function"
+                 (?- (hfs-seqfile clean-series)
+                     (forma/dynamic-clean
+                      est-map
+                      (hfs-seqfile adjusted-series-path))))
+
+              trends
+              ([:tmp-dirs trends-path]
+                 "Runs the trends processing."
+                 (?- (hfs-seqfile trends-path)
+                     (forma/analyze-trends
+                      est-map
+                      (hfs-seqfile clean-series))))
+
+              trends-cleanup
+              ([:tmp-dirs cleanup-path]
+                 "Clean up data after trends to improve join performance. Joins
+                  kill us with lots of observations"
+                 (?- (hfs-seqfile cleanup-path)
+                     (forma/trends-cleanup (hfs-seqfile trends-path))))
+
+              fire-step
+              ([:tmp-dirs fire-path]
+                 "Create fire series"
+                 (?- (hfs-seqfile fire-path)
+                     (tseries/fire-query fire-pail-path
+                                         t-res
+                                         "2000-11-01"
+                                         est-end)))
+
+              adjustfires
+              ([:tmp-dirs adjusted-fire-path]
+                 "Make sure fires data lines up temporally with our other
+                  timeseries."
+                 (?- (hfs-seqfile adjusted-fire-path)
+                     (forma/fire-tap est-map (hfs-seqfile fire-path))))
+
+              mid-forma
+              ([:tmp-dirs forma-mid-path]
+                 "Final step to collect all data for the feature vector -
+                 trends + fires data"
+                 (?- (hfs-seqfile forma-mid-path)
+                     (forma/forma-tap t-res
+                                      est-map
+                                      (hfs-seqfile cleanup-path)
+                                      (hfs-seqfile adjusted-fire-path))))
+
+              final-forma
+              ([:tmp-dirs final-path]
+                 "Process neighbors"
+                 (let [names ["?s-res" "?period" "?mod-h" "?mod-v"
+                              "?sample" "?line" "?forma-val"]
+                       mid-src (-> (hfs-seqfile forma-mid-path)
+                                   (name-vars names))]
+                   (?- (hfs-seqfile final-path)
+                       (forma/forma-query est-map mid-src))))
+
+              beta-data-prep
+              ([:tmp-dirs beta-data-path]
+                 "Pre-generate data needed for beta generation. Saves a bit of
+                  time if you have to run the next step multiple times."
+                 (?- (hfs-seqfile beta-data-path)
+                     (forma/beta-data-prep est-map
+                                           (hfs-seqfile final-path)
+                                           (hfs-seqfile static-path))))
+
+              gen-betas
+              ([:tmp-dirs beta-path]
+                 "Generate beta vector"
+                 (with-job-conf
+                   {"mapred.reduce.tasks" 200
+                    "mapred.child.java.opts" "-Xmx2048M"}
+                   (?- (hfs-seqfile beta-path)
+                       (forma/beta-gen est-map (hfs-seqfile beta-data-path)))))
+
+              forma-estimate
+              ([]
+                 "Apply beta vector"
+                 (?- (hfs-seqfile out-path :sinkmode :replace)
+                     (forma/forma-estimate (hfs-seqfile beta-path)
+                                           (hfs-seqfile final-path)
+                                           (hfs-seqfile static-path))))
+
+              stop-process
+              ([]
+                 "stop everything before deleting the temp directory"
+                 (?- (hfs-seqfile "/mnt/hgfs/Dropbox/yikes")
+                     (hfs-seqfile "/mnt/hgfs/Dropbox/yikestimes"))))))
+
+(defmain simplerunner
   [tmp-root pail-path ts-pail-path out-path run-key]
   (let [{:keys [s-res t-res est-end] :as est-map} (forma-run-parameters run-key)
         mk-filter (fn [vcf-path ts-src]
@@ -169,9 +342,10 @@
               vcf-step
               ([:tmp-dirs vcf-path]
                  (?- (hfs-seqfile vcf-path)
-                     (<- [?subpail ?chunk]
-                         ((constrained-tap pail-path "vcf" s-res "00") ?subpail ?chunk))))
-
+                     (<- [?subpail ?data-chunk]
+                         ((constrained-tap pail-path "vcf" s-res "00") ?subpail ?data-chunk))))
+
+
               ndvi-step
               ([:tmp-dirs ndvi-path]
                  (?- (hfs-seqfile ndvi-path)
@@ -179,103 +353,4 @@
                                 (constrained-tap
                                  ts-pail-path "ndvi" s-res t-res))))

-              fire-step ([:tmp-dirs fire-path]
-                           (?- (hfs-seqfile fire-path)
-                               (tseries/fire-query pail-path
-                                                   t-res
-                                                   "2000-11-01"
-                                                   est-end)))
-
-              adjustfires
-              ([:tmp-dirs adjusted-fire-path]
-                 (?- (hfs-seqfile adjusted-fire-path)
-                     (forma/fire-tap est-map (hfs-seqfile fire-path))))
-
-              rain-step
-              ([:tmp-dirs rain-path]
-                 (?- (hfs-seqfile rain-path)
-                     (mk-filter vcf-path
-                                (new-adjusted-precl-tap
-                                 ts-pail-path s-res "32" t-res))))
-
-              reli-step
-              ([:tmp-dirs reli-path]
-                 (?- (hfs-seqfile reli-path)
-                     (mk-filter vcf-path
-                                (constrained-tap
-                                 ts-pail-path "reli" s-res t-res))))
-
-              adjustseries
-              ([:tmp-dirs adjusted-series-path]
-                 "Adjusts lengths of all timeseries so they all cover the same
-                  time spans."
-                 (with-job-conf {"mapred.min.split.size" 805306368}
-                   (?- (hfs-seqfile adjusted-series-path)
-                       (forma/dynamic-filter (hfs-seqfile ndvi-path)
-                                             (hfs-seqfile reli-path)
-                                             (hfs-seqfile rain-path)))))
-
-              cleanseries ([:tmp-dirs clean-series]
-                             "Runs the trends processing."
-                             (?- (hfs-seqfile clean-series)
-                                 (forma/dynamic-clean
-                                  est-map (hfs-seqfile adjusted-series-path))))
-
-              trends ([:tmp-dirs trends-path]
-                        "Runs the trends processing."
-                        (?- (hfs-seqfile trends-path)
-                            (forma/analyze-trends
-                             est-map (hfs-seqfile clean-series))))
-
-              mid-forma ([:tmp-dirs forma-mid-path
-                          :deps [trends adjustfires]]
-                           (?- (hfs-seqfile forma-mid-path)
-                               (forma/forma-tap (hfs-seqfile trends-path)
-                                                (hfs-seqfile adjusted-fire-path))))
-
-              final-forma
-              ([] (let [names ["?s-res" "?period" "?mod-h" "?mod-v"
-                               "?sample" "?line" "?forma-val"]
-                        mid-src (-> (hfs-seqfile forma-mid-path)
-                                    (name-vars names))]
-                    (?- (hfs-seqfile out-path)
-                        (forma/forma-query est-map mid-src)))))))
-
-(defmain ultrarunner
-  [tmp-root eco-beta-path full-beta-path static-path dynamic-path out-path country-or-eco pre-beta-out-path]
-  (let [est-map (forma-run-parameters "500-16")]
-    (workflow [tmp-root]
-              ;; genbetas
-              ;; ([]
-              ;;    (let [beta-path (if (= "eco" country-or-eco)
-              ;;                      eco-beta-path
-              ;;                      full-beta-path)]
-              ;;      (?- (hfs-seqfile beta-path)
-              ;;          (forma/beta-generator est-map
-              ;;                                (hfs-seqfile final-path)
-              ;;                                (hfs-seqfile static-path)))))
-              applybetas
-              ([] (?- (hfs-seqfile out-path :sinkmode :replace)
-                      (forma/forma-estimate (hfs-seqfile eco-beta-path)
-                                            (hfs-seqfile dynamic-path)
-                                            (hfs-seqfile
-                                            static-path)))))))
-
-(defn run-forma-estimate
-  [beta-src dynamic-src static-src out-loc trap-path period]
-  (?- (hfs-seqfile out-loc :sinkmode :replace)
-      (forma/forma-estimate
-       (hfs-seqfile beta-src)
-       (hfs-seqfile dynamic-src)
-       (hfs-seqfile static-src)
-       (hfs-seqfile trap-path)
-       period)))
-
-(comment
-  (run-forma-estimate "s3n://formaresults/ecobetatemp"
-                      "s3n://formaresults/finalbuckettemp"
-                      "s3n://formaresults/staticbuckettemp"
-                      "s3n://formaresults/finaloutput"
-                      "s3n://formaresults/trapped"
-                      827))
-
+              )))


Generate video even if tests fail

Generate video even if tests fail

--- src/clj_chrome_devtools/cljs/test.clj
+++ src/clj_chrome_devtools/cljs/test.clj
@@ -9,7 +9,7 @@
             [clj-chrome-devtools.impl.util :refer [random-free-port]]
             [org.httpkit.server :as http-server]
             [clojure.string :as str]
-            [clojure.test]
+            [clojure.test :refer [is]]
             [clojure.java.shell :as sh])
   (:import (java.io File)))

@@ -121,12 +121,14 @@
        :private true}
   final-test-report-pattern #"(\d+) failures, (\d+) errors.")

-(defn- assert-test-result [msg]
+(defn- test-result [msg]
   (let [[match errors failures] (re-matches final-test-report-pattern msg)]
     (when match
-      (assert (= "0" errors failures)
-              "ClojureScript tests had failures or errors, see previous output for details.")
-      true)))
+      (if (= "0" errors failures)
+        :ok
+        :fail
+        ;"ClojureScript tests had failures or errors, see previous output for details."
+        ))))

 (defn- poll-test-execution []
   (loop [started? false
@@ -155,13 +157,14 @@
           (doseq [m (mapcat #(str/split % #"\n") msgs)]
             (println "[CLJS]" m))

-          (if-not (some assert-test-result msgs)
+          (if-let [result (some test-result msgs)]
+            {:result result
+             :screenshots screenshots}
             (do
               (Thread/sleep 100)
-              (recur started? screenshots))
-            screenshots))))))
-
-(defn output-screenshot-videos [screenshots framerate]
+              (recur started? screenshots))))))))
+
+(defn output-screenshot-videos [screenshots framerate loop-video?]
   (let [video-names (into #{}
                           (keep #(second (re-matches #"^([^\d]+)-(\d+)\.png$" %)))
                           screenshots)]
@@ -169,7 +172,11 @@
       (when video-name
         (let [input (str video-name "-%d.png")
               output (str video-name ".png")
-              cmd ["ffmpeg" "-framerate" (str framerate) "-y" "-i" input "-f" "apng" "-plays" "0" output]]
+              cmd ["ffmpeg"
+                   "-framerate" (str framerate)
+                   "-y" "-i" input "-f" "apng"
+                   "-plays" (if loop-video? "0" "1")
+                   output]]
           (println "Generate video " output)
           (let [{exit :exit err :err} (apply sh/sh cmd)]
             (if (zero? exit)
@@ -182,7 +189,8 @@
 (defn run-tests
   ([build-output]
    (run-tests build-output nil))
-  ([{:keys [js js-directory]} {:keys [headless? no-sandbox? screenshot-video? framerate
+  ([{:keys [js js-directory]} {:keys [headless? no-sandbox?
+                                      screenshot-video? framerate loop-video?
                                       ring-handler]}]
    (log "Run compiled js test file:" js)
    (let [chrome-fixture (create-chrome-fixture {:headless? (if (some? headless?)
@@ -208,9 +216,11 @@
             (automation/to url)

             (log "Wait for test output")
-            (let [screenshots (poll-test-execution)]
+            (let [{:keys [result screenshots]} (poll-test-execution)]
               (when screenshot-video?
-                (output-screenshot-videos screenshots (or framerate 2))))
+                (output-screenshot-videos screenshots (or framerate 2) loop-video?))
+              (is (= result :ok)
+                  "ClojureScript tests had failures or errors, see previous output for details "))

             (log "Tests done, cleanup")
             (server)


Only get 10 load tests, show them newest to to olders

--- src/cljs/load_test_om/load_tests.cljs
+++ src/cljs/load_test_om/load_tests.cljs
@@ -14,7 +14,7 @@
                    :resource (.-resource v)
                    :action (.-action v)
                    :data-points []}]
-    (om/transact! load-tests :items #(conj % load-test))))
+    (om/transact! load-tests :items (partial into [load-test]))))

 (defn handle-new-data-point [load-test snapshot]
   (let [v (.val snapshot)
@@ -133,7 +133,9 @@
     (will-mount [_]
       (let [fb-ref (js/Firebase. firebase-url)]
         (om/set-state! owner :firebase-ref fb-ref)
-        (.on fb-ref "child_added" (partial handle-new-load-test load-tests))))
+        (-> fb-ref
+            (.limitToLast 10)
+            (.on "child_added" (partial handle-new-load-test load-tests)))))

     om/IWillUnmount
     (will-unmount [_]


avoid extra blank lines in logs

avoid extra blank lines in logs

--- src/riemann/logging.clj
+++ src/riemann/logging.clj
@@ -36,9 +36,9 @@
              (set-level ~logger old-level#))))
       `(do ~@body))))

-(def riemann-layout
+(def riemann-layout
   "A nice format for log lines."
-  (EnhancedPatternLayout. "%p [%d] %t - %c - %m%n%throwable%n"))
+  (EnhancedPatternLayout. "%p [%d] %t - %c - %m%n%throwable"))

 (defn init
   "Initialize log4j. You will probably call this from the config file. You can


add phase_offset arg to ixi_techno FX

add phase_offset arg to ixi_techno FX

--- etc/synthdefs/synth-designs.clj
+++ etc/synthdefs/synth-designs.clj
@@ -1732,6 +1732,7 @@
      mix_slide 0
      phase 4
      phase_slide 0
+     phase_offset 0
      cutoff_min 60
      cutoff_min_slide 0
      cutoff_max 120
@@ -1749,7 +1750,7 @@
           res           (lag res res_slide)
           cutoff_min    (midicps cutoff_min)
           cutoff_max    (midicps cutoff_max)
-          freq          (lin-exp (sin-osc:kr rate) -1 1 cutoff_min cutoff_max)
+          freq          (lin-exp (sin-osc:kr rate (* (- phase_offset 0.25) (* Math/PI 2))) -1 1 cutoff_min cutoff_max)

           [in-l in-r]   (in in_bus 2)
           [new-l new-r] (rlpf [in-l in-r] freq res)
@@ -1765,6 +1766,7 @@
      mix_slide 0
      phase 4
      phase_slide 0
+     phase_offset 0
      cutoff_min 60
      cutoff_min_slide 0
      cutoff_max 120
@@ -1781,7 +1783,7 @@
           res           (lag res res_slide)
           cutoff_min    (midicps cutoff_min)
           cutoff_max    (midicps cutoff_max)
-          freq          (lin-exp (sin-osc:kr rate) -1 1 cutoff_min cutoff_max)
+          freq          (lin-exp (sin-osc:kr rate (* (- phase_offset 0.25) (* Math/PI 2))) -1 1 cutoff_min cutoff_max)

           [in-l in-r]   (in out_bus 2)
           [new-l new-r] (rlpf [in-l in-r] freq res)


Perf improvements for conformers

Perf improvements for conformers

--- src/kixi/datastore/schemastore/conformers.clj
+++ src/kixi/datastore/schemastore/conformers.clj
@@ -2,39 +2,48 @@
   (:require [clojure.core :exclude [integer? double? set?]]
             [clojure.spec :as s]))

+(defn double->int
+  "1.0 will convert to 1; anything else will be rejected"
+  [d]
+  (let [int-val (int d)]
+    (when (== int-val d)
+      int-val)))
+
+(defn double-str?
+  [^String s]
+  (not= -1 (.indexOf s ".")))
+
 (defn str-double->int
   "1. or 1.0...0 will convert to 1"
   [^String s]
-  (when-not (neg? (.indexOf s "."))
-    (some-> (re-find #"^([0-9]+)\.0*$" s)
-            (last)
-            str
-            (Integer/valueOf))))
+  (when (double-str? s)
+    (try
+      (double->int (Double/valueOf s))
+      (catch NumberFormatException e
+        nil))))

-(defn double->int
-  "1.0 will convert to 1; anything else will be rejected"
-  [d]
-  (let [[integer decimal] (clojure.string/split (str d) #"\.")]
-    (when (re-find #"^0+$" decimal)
-      (int d))))
+(defn str->int
+  [^String s]
+  (try
+    (Integer/valueOf s)
+    (catch NumberFormatException e
+      (or
+        (str-double->int s)
+        :clojure.spec/invalid))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Integer

 (defn -integer?
   [x]
-  (cond (and (string? x)
-             (str-double->int x)) (str-double->int x)
-        (string? x) (try
-                      (Integer/valueOf (str x))
-                      (catch Exception e
-                        :clojure.spec/invalid))
+  (cond (string? x) (str->int x)
         (clojure.core/integer? x) x
         (and (clojure.core/double? x)
              (double->int x))     (double->int x)
         :else :clojure.spec/invalid))

 (def integer? (s/conformer -integer?))
+

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Double
@@ -46,7 +55,7 @@
     (clojure.core/integer? x) (double x)
     (string? x) (try
                   (Double/valueOf (str x))
-                  (catch Exception e
+                  (catch NumberFormatException e
                     :clojure.spec/invalid))
     :else :clojure.spec/invalid))


Tweaks to eagerness patch & catch file not found exceptions

--- src/pipeline/grafter/pipeline.clj
+++ src/pipeline/grafter/pipeline.clj
@@ -45,7 +45,8 @@
 (defrecord Pipeline [namespace name args doc meta body])

 (defn fully-qualified-name [pipeline]
-  (symbol (str (:namespace pipeline)) (str (:name pipeline))))
+  (when pipeline
+    (symbol (str (:namespace pipeline)) (str (:name pipeline)))))

 (defn- valid-decl? [decl msg]
   (if (seq decl)
@@ -117,8 +118,15 @@
   (let [rs (io/input-stream is)]
     (PushbackReader. (InputStreamReader. rs))))

-(defn find-resource-pipelines
-  "Reads a sequence of pipeline forms from a resource with the given URL."
-  [url]
-  (with-open [reader (inputstream->pushback-reader url)]
-    (vec (find-pipelines (forms reader)))))
+(defn find-resource-pipelines [url]
+  (try
+    (with-open [reader (inputstream->pushback-reader url)]
+      (doall (find-pipelines (forms reader))))
+    (catch java.io.FileNotFoundException e
+      nil)))
+
+(comment
+  (->> (find-clj-classpath-resources)
+       (mapcat find-resource-pipelines)
+       flatten
+       (filter #(instance? grafter.pipeline.Pipeline %))))


Cleanup

Cleanup

--- test/clojure/clojurewerkz/cassaforte/cql_test.clj
+++ test/clojure/clojurewerkz/cassaforte/cql_test.clj
@@ -93,35 +93,30 @@
               {:payload "updated payload"}
               (where qc))
       (let [x (first (select *session* t (where qc)))]
-        (is (= "updated payload" (:payload x))))
-      (truncate *session* t))))
-
-(deftest test-delete
-  (testing "Delete whole row"
-    (dotimes [i 3]
-      (insert *session* :users {:name (str "name" i)
-                                :age (int i)}))
-    (is (= 3 (perform-count *session* :users)))
-    (delete *session* :users
-            (where {:name "name1"}))
-    (is (= 2 (perform-count *session* :users)))
-    (truncate *session* :users))
-
-  (testing "Delete a column"
-    (insert *session* :users {:name "name1" :age (int 19)})
-    (delete *session* :users
-            (columns :age)
-            (where {:name "name1"}))
-    (is (nil? (:age (select *session* :users))))
-    (truncate *session* :users)))
+        (is (= "updated payload" (:payload x)))))))
+
+(deftest test-delete-row
+  (dotimes [i 3]
+    (insert *session* :users {:name (str "name" i)
+                              :age (int i)}))
+  (is (= 3 (perform-count *session* :users)))
+  (delete *session* :users
+          (where {:name "name1"}))
+  (is (= 2 (perform-count *session* :users))))
+
+(deftest test-delete-column
+  (insert *session* :users {:name "name1" :age (int 19)})
+  (delete *session* :users
+          (columns :age)
+          (where {:name "name1"}))
+  (is (nil? (:age (select *session* :users)))))

 (deftest test-insert-with-timestamp
   (let [r {:name "Alex" :city "Munich" :age (int 19)}]
     (insert *session* :users
             r
             (using {:timestamp (.getTime (java.util.Date.))}))
-    (is (= r (first (select *session* :users))))
-    (truncate *session* :users)))
+    (is (= r (first (select *session* :users))))))

 (deftest test-ttl
   (dotimes [i 3]
@@ -451,35 +446,33 @@
     (client/execute *session*
                     "INSERT INTO users (name, city, age) VALUES ('Alex', 'Munich', 19);"
                     :consistency-level (cp/consistency-level :quorum))
-    (is (= r (first (select *session* :users (limit 1)))))
-    (truncate *session* :users)))
+    (is (= r (first (select *session* :users (limit 1)))))))

 (deftest test-insert-with-forced-prepared-statements
   (let [r        {:name "Alex" :city "Munich" :age (int 19)}
         prepared (client/prepare *session*
-                  (new-query-api/insert :users
-                                        {:name new-query-api/?
-                                         :city new-query-api/?
-                                         :age  new-query-api/?}))]
+                                 (new-query-api/insert :users
+                                                       {:name new-query-api/?
+                                                        :city new-query-api/?
+                                                        :age  new-query-api/?}))]
     (client/execute *session*
                     (client/bind prepared
                                  {:name "Alex" :city "Munich" :age (int 19)}))
     (is (= r (first (select *session* :users (limit 1)))))))

 (deftest test-raw-cql-insert
-  (testing "With default session"
-    (client/execute *session* "INSERT INTO users (name, city, age) VALUES ('Alex', 'Munich', 19);")
-    (is (= {:name "Alex" :city "Munich" :age (int 19)}
-           (first (client/execute *session* "SELECT * FROM users;"))))
-    (client/execute *session* "TRUNCATE users;"))
-  (testing "Prepared statement"
-    (client/execute *session*
-                    (client/bind
-                     (client/prepare *session* "INSERT INTO users (name, city, age) VALUES (?, ?, ?);")
-                     ["Alex" "Munich" (int 19)]))
-    (is (= {:name "Alex" :city "Munich" :age (int 19)}
-           (first (client/execute *session* "SELECT * FROM users;"))))
-    (client/execute *session* "TRUNCATE users;")))
+  (client/execute *session* "INSERT INTO users (name, city, age) VALUES ('Alex', 'Munich', 19);")
+  (is (= {:name "Alex" :city "Munich" :age (int 19)}
+         (first (client/execute *session* "SELECT * FROM users;"))))
+  (client/execute *session* "TRUNCATE users;"))
+
+(deftest test-raw-cql-with-prepared
+  (client/execute *session*
+                  (client/bind
+                   (client/prepare *session* "INSERT INTO users (name, city, age) VALUES (?, ?, ?);")
+                   ["Alex" "Munich" (int 19)]))
+  (is (= {:name "Alex" :city "Munich" :age (int 19)}
+         (first (client/execute *session* "SELECT * FROM users;")))))

 (deftest test-insert-nils
   (let [r {:name "Alex" :city "Munich" :age nil}]
@@ -498,12 +491,12 @@

 (deftest test-insert-with-atomic-batch-without-prepared-statements
   (client/execute *session*
-   (new-query-api/unlogged-batch
-    (new-query-api/queries
-     (new-query-api/insert :users
-                           {:name "Alex" :city "Munich" :age (int 19)})
-     (new-query-api/insert :users
-                           {:name "Fritz" :city "Hamburg" :age (int 28)}))))
+                  (new-query-api/unlogged-batch
+                   (new-query-api/queries
+                    (new-query-api/insert :users
+                                          {:name "Alex" :city "Munich" :age (int 19)})
+                    (new-query-api/insert :users
+                                          {:name "Fritz" :city "Hamburg" :age (int 28)}))))
   (is (= [{:name "Alex" :city "Munich" :age (int 19)}
           {:name "Fritz" :city "Hamburg" :age (int 28)}]
          (sort-by :name (select *session* :users)))))


Formatting

Formatting

--- test/clojure/clojurewerkz/cassaforte/cql_test.clj
+++ test/clojure/clojurewerkz/cassaforte/cql_test.clj
@@ -61,9 +61,9 @@
     (let [t   :events_by_device_id_and_date
           fmt (tf/formatter "yyyy-MM-dd")
           id  "device-000000001"
-          qc [[=  :device_id id]
-              [=  :date "2014-11-13"]
-              [=  :created_at (uuids/start-of (cc/to-long (date-time 2014 11 13 12)))]]]
+          qc  [[=  :device_id id]
+               [=  :date "2014-11-13"]
+               [=  :created_at (uuids/start-of (cc/to-long (date-time 2014 11 13 12)))]]]
       (testing "Bulk update"
         (truncate s t)
          (is (= 0 (perform-count s t)))


Fixing issue causing logging to be disabled when running tests.

--- test/cmr/indexer/test/services/index_versions.clj
+++ test/cmr/indexer/test/services/index_versions.clj
@@ -57,7 +57,8 @@
     (try
       (f)
       (finally
-        (lifecycle/stop server nil)))))
+        (lifecycle/stop server nil)
+        (timbre/set-config! [:appenders :standard-out :enabled?] true)))))

 ;; Run once for the whole test suite
 (use-fixtures :once server-setup)


Add more tests for different types of compound queries

--- test/com/puppetlabs/puppetdb/test/query/event.clj
+++ test/com/puppetlabs/puppetdb/test/query/event.clj
@@ -167,6 +167,25 @@
             (is (= actual expected)
               (format "Results didn't match for query '%s'" query))))))

+    (testing "negated regex queries"
+      (doseq [[field value matches]
+              [[:resource-type  "otify"               []]
+               [:resource-title "^[Nn]otify,\\s*yo$"  [2 3]]
+               [:status         "^.ucces."            [3]]
+               [:property       "^[Mm][\\w\\s]+"      [3]]
+               [:message        "notify, yo"          [3]]
+               [:resource-title "^bunk$"              [1 2 3]]
+               [:certname       "^foo\\."             []]
+               [:certname       "^.*\\.mydomain\\.com$" [1 2 3]]]]
+        (testing (format "negated regex query on field '%s'" field)
+          (let [expected  (expected-resource-events
+            (utils/select-values basic-events matches)
+            report-hash)
+                query     ["not" ["~" (name field) value]]
+                actual    (resource-events-query-result query)]
+            (is (= actual expected)
+              (format "Results didn't match for query '%s'" query))))))
+
     (testing "compound queries"
       (testing "'or' equality queries"
         (doseq [[terms matches]
@@ -179,8 +198,7 @@
                    [[[:new-value      "notify, yo"]
                      [:resource-title "notify, yar"]
                      [:resource-title "hi"]]            [1 2 3]]]]
-          (let [equality-fn (fn [m [k v]] (= v (m k)))
-                expected    (expected-resource-events
+          (let [expected    (expected-resource-events
                               (utils/select-values basic-events matches)
                               report-hash)
                 term-fn     (fn [[field value]] ["=" (name field) value])
@@ -202,17 +220,51 @@
                    [:certname       "foo.local"]]     [1]]
                  [[[:certname       "foo.local"]
                    [:resource-type  "Notify"]]        [1 2 3]]]]
-          (let [equality-fn (fn [m [k v]] (= v (m k)))
-                expected    (expected-resource-events
+          (let [expected    (expected-resource-events
                               (utils/select-values basic-events matches)
                               report-hash)
                 term-fn     (fn [[field value]] ["=" (name field) value])
                 query       (vec (cons "and" (map term-fn terms)))
                 actual      (resource-events-query-result query)]
             (is (= actual expected)
+              (format "Results didn't match for query '%s'" query)))))
+
+      (testing "nested compound queries"
+        (doseq [[query matches]
+                [[["and"
+                    ["or"
+                      ["=" "resource-title" "hi"]
+                      ["=" "resource-title" "notify, yo"]]
+                    ["=" "status" "success"]]               [1]]
+                 [["or"
+                    ["and"
+                      ["=" "resource-title" "hi"]
+                      ["=" "status" "success"]]
+                    ["and"
+                      ["=" "resource-type" "Notify"]
+                      ["=" "property" "message"]]]          [1 2]]]]
+          (let [expected  (expected-resource-events
+                            (utils/select-values basic-events matches)
+                            report-hash)
+                actual    (resource-events-query-result query)]
+            (is (= actual expected)
+              (format "Results didn't match for query '%s'" query)))))
+
+      (testing "compound queries with both equality and inequality"
+        (doseq [[query matches]
+                [[["and"
+                    ["=" "status" "success"]
+                    ["<" "timestamp" "2011-01-01T12:00:02-03:00"]]  [1]]
+                 [["or"
+                    ["=" "status" "skipped"]
+                    ["<" "timestamp" "2011-01-01T12:00:02-03:00"]]  [1 3]]]]
+          (let [expected  (expected-resource-events
+                            (utils/select-values basic-events matches)
+                            report-hash)
+                actual    (resource-events-query-result query)]
+            (is (= actual expected)
               (format "Results didn't match for query '%s'" query)))))))

-


Improved instructions

Improved instructions

--- src/day8/re_frame_10x/view/event.cljs
+++ src/day8/re_frame_10x/view/event.cljs
@@ -134,17 +134,23 @@
    :child [components/simple-render (:result line) [@(rf/subscribe [:epochs/current-epoch-id]) code-execution-id i]]])

-(defn event-panel-instructions []
-  [rc/v-box
-   :children [[:span.bm-heading-text.light-heading "Event Panel"]
-              [rc/p "TODO: Need some big love here"]
-              [rc/p "This amazing panel can contain the actual code of the event along with all of it's intermediate values"]
-              [rc/p "But to get to this magic, you need to manually mark up your project:"]
-              [rc/p "1) Add " [:span.bold "[day8.re-frame/debux \"0.5.0-SNAPSHOT\"]"] " to the :dev :dependencies section in project.clj"]
-              [rc/p "2) Add " [:span.bold "\"debux.cs.core.trace_enabled_QMARK_\" true"] " to the :closure-defines section in project.clj"]
-              [rc/p "3) Add " [:span.bold "[debux.cs.core :refer-macros [fn-traced]]"] " to the :require section of the event code file(s)"]
-              [rc/p "4) Replace " [:span.bold "fn"] " with " [:span.bold "fn-traced"] " in the events to be traced in this panel"]
-              ]])
+(defn event-panel-instructions
+  []
+  (let [current-event @(rf/subscribe [:epochs/current-event])
+        event-str     (if (some? current-event)
+                        (subs (prn-str current-event) 0 400)
+                        "No event")]
+    [rc/v-box
+     :children [[:span.bm-heading-text.light-heading event-str]
+                [rc/p {:style {:font-style "italic"}} "Code trace is not currently available for this event"]
+                [:br]
+                [rc/p "This panel can show the actual code of the event along with all of it's intermediate values."]
+                [rc/p "To get to this magic going, you need to make a few adjustments to your project:"]
+                [:ol
+                 [:li [rc/p "Add " [:span.bold "[day8.re-frame/debux \"0.5.0-SNAPSHOT\"]"] " to the :dev :dependencies section in project.clj"]]
+                 [:li [rc/p "Add " [:span.bold "\"debux.cs.core.trace_enabled_QMARK_\" true"] " to the :closure-defines section in project.clj"]]
+                 [:li [rc/p "Add " [:span.bold "[debux.cs.core :refer-macros [fn-traced]]"] " to the :require section of the event code file(s)"]]
+                 [:li [rc/p "Replace " [:span.bold "fn"] " with " [:span.bold "fn-traced"] " in the events to be traced in this panel"]]]]]))

 ;; Terminology:


config file location; line length

config file location; line length

--- Clojure-Websockets/MainApp/src/clj/birdwatch/main.clj
+++ Clojure-Websockets/MainApp/src/clj/birdwatch/main.clj
@@ -1,7 +1,8 @@
 (ns birdwatch.main
-  "This is the main namespace of the server side of BirdWatch. It is written in Clojure and makes
-   use of the systems-toolbox library (https://github.com/matthiasn/BirdWatch) for building and
-   wiring components. Below, a switchboard is created, which is a specialized component for
+  "This is the main namespace of the server side of BirdWatch. It is written in
+   Clojure and makes use of the systems-toolbox library
+   (https://github.com/matthiasn/BirdWatch) for building and wiring components.
+   Below, a switchboard is created, which is a specialized component for
    wiring components together so that messages flow through a system as desired."

   (:require [matthiasn.birdwatch-specs.specs]
@@ -23,40 +24,46 @@
 (pretty/install-pretty-logging)
 (pretty/install-uncaught-exception-handler)

-(def conf (edn/read-string (slurp "conf.edn")))
+(def conf-filepath (get (System/getenv) "CONF_PATH" "conf.edn"))
+(def conf (edn/read-string (slurp conf-filepath)))

 (defonce switchboard (sb/component :backend/switchboard))

 (defn restart!
-  "Starts (or restarts) a system built out of the specified subsystems. The switchboard will
-  then fire up subsystems according to the blueprint maps, which are in passed in the second
-  position of the :cmd/init-comp vectors. These subsystems are then wired to provide the
-  communication paths required by the application.
-  The system can be restarted on the REPL. For example, say we modify the
-  birdwatch.percolator.percolator namespace. Then, we can reload it:
+  "Starts (or restarts) a system built out of the specified subsystems. The
+   switchboard will then fire up subsystems according to the blueprint maps,
+   which are in passed in the second position of the :cmd/init-comp vectors.
+   These subsystems are then wired to provide the communication paths required
+   by the application.
+   The system can be restarted on the REPL. For example, say we modify the
+   birdwatch.percolator.percolator namespace. Then, we can reload it:

     (require '[birdwatch.percolator.percolator :as perc] :reload)

-  Then, calling this function again will restart the system while maintaining the state of
-  the individual subsystems."
+   Then, calling this function again will restart the system while maintaining
+   the state of the individual subsystems."
   []
   (sb/send-mult-cmd
     switchboard
     [[:cmd/init-comp
-      #{(sente/cmp-map :backend/ws-cmp markup/sente-map)    ; WebSockets component
-        (sched/cmp-map :backend/scheduler-cmp)              ; Scheduler component
-        (pc/cmp-map :backend/persistence-cmp conf)          ; Persistence-related component
-        (redis/cmp-map :backend/interop-cmp (:redis conf))  ; Redis PubSub interop between JVMs
-        (perc/cmp-map :backend/percolator-cmp conf)         ; Matching tweets with searches
-        (metrics/cmp-map :backend/metrics-cmp)}]            ; Metrics and stats
+      #{(sente/cmp-map :backend/ws-cmp markup/sente-map)
+        (sched/cmp-map :backend/scheduler-cmp)
+        (pc/cmp-map :backend/persistence-cmp conf)
+        (redis/cmp-map :backend/interop-cmp (:redis conf))
+        (perc/cmp-map :backend/percolator-cmp conf)
+        (metrics/cmp-map :backend/metrics-cmp)}]

      [:cmd/route {:from #{:backend/scheduler-cmp :backend/ws-cmp}
                   :to   :backend/persistence-cmp}]

-     [:cmd/route {:from #{:backend/persistence-cmp :backend/percolator-cmp :backend/metrics-cmp}
+     [:cmd/route {:from #{:backend/persistence-cmp
+                          :backend/percolator-cmp
+                          :backend/metrics-cmp}
                   :to   :backend/ws-cmp}]

-     [:cmd/route {:from #{:backend/interop-cmp :backend/ws-cmp :backend/scheduler-cmp}
+     [:cmd/route {:from #{:backend/interop-cmp
+                          :backend/ws-cmp
+                          :backend/scheduler-cmp}
                   :to   :backend/percolator-cmp}]

      [:cmd/observe-state {:from :backend/ws-cmp
@@ -74,16 +81,17 @@
                                           :message [:schedule/count-users]
                                           :repeat  true}]}]
      [:cmd/send {:to  :backend/scheduler-cmp
-                 :msg [:cmd/schedule-new {:timeout 5000
-                                          :message (with-meta [:cmd/get-jvm-stats]
-                                                              {:sente-uid :broadcast})
-                                          :repeat  true}]}]]))
+                 :msg [:cmd/schedule-new
+                       {:timeout 5000
+                        :message (with-meta [:cmd/get-jvm-stats]
+                                            {:sente-uid :broadcast})
+                        :repeat  true}]}]]))

 (defn -main
-  "Starts the application from command line. Also saves and logs process ID. The system that is
-   fired up when start! is called proceeds in core.async's thread pool. Since we don't want the
-   application to exit when just because the current thread is out of work, we just put it
-   to sleep."
+  "Starts the application from command line. Also saves and logs process ID.
+   The system that is fired up when start! is called proceeds in core.async's
+   thread pool. Since we don't want the application to exit when just because
+   the current thread is out of work, we just put it to sleep."
   [& args]
   (pid/save (:pidfile-name conf))
   (pid/delete-on-shutdown! (:pidfile-name conf))


windows stacktrace bombing

windows stacktrace bombing

--- sidecar/src/figwheel_sidecar/auto_builder.clj
+++ sidecar/src/figwheel_sidecar/auto_builder.clj
@@ -8,6 +8,7 @@
    [cljs.analyzer :as ana]
    [cljs.env]
    [clj-stacktrace.repl]
+   [clojure.stacktrace :as stack]
    [clojurescript-build.core :as cbuild]
    [clojurescript-build.auto :as auto]
    [clojure.java.io :as io]
@@ -21,9 +22,12 @@
       (util/sh (update-in command [:shell] (fn [old] (concat old [message]))))
       (catch Throwable e
         (println (auto/red "Error running :notify-command:"))
-        (clj-stacktrace.repl/pst+ e)))))
+        (stack/print-cause-trace exception 1)
+        #_(clj-stacktrace.repl/pst+ e)))))

 (defn notify-on-complete [{:keys [build-options parsed-notify-command]}]
+  (println "Build options - after build")
+  (prn build-options)
   (let [{:keys [output-to]} build-options]
     (notify-cljs
      parsed-notify-command
@@ -45,7 +49,8 @@

 (defn handle-exceptions [figwheel-server {:keys [build-options exception id] :as build}]
   (println (auto/red (str "Compiling \"" (:output-to build-options) "\" failed.")))
-  (clj-stacktrace.repl/pst+ exception)
+  (stack/print-cause-trace exception 1)
+  #_(clj-stacktrace.repl/pst+ exception)
   (fig/compile-error-occured
    (merge-build-into-server-state figwheel-server build)
    exception))


Fix indentation

Fix indentation

--- src-cljs/frontend/components/pages/workflow.cljs
+++ src-cljs/frontend/components/pages/workflow.cljs
@@ -182,13 +182,13 @@
   static om-next/IQuery
   (query [this]
     (if (feature/enabled? :workflows-pagination)
-    [:project/name
-     {:project/organization [:organization/vcs-type :organization/name]}
-     `{(:routed/page {:page/connection :project/workflow-runs
-                      :page/count 4})
-       [:connection/total-count
-        :connection/offset
-        {:connection/edges [{:edge/node ~(om-next/get-query RunRow)}]}]}
+      [:project/name
+       {:project/organization [:organization/vcs-type :organization/name]}
+       `{(:routed/page {:page/connection :project/workflow-runs
+                        :page/count 4})
+         [:connection/total-count
+          :connection/offset
+          {:connection/edges [{:edge/node ~(om-next/get-query RunRow)}]}]}
        {'[:app/route-params _] [:page/number]}]

       [:project/name
@@ -197,37 +197,37 @@
   Object
   (render [this]
     (if (feature/enabled? :workflows-pagination)
-    (component
-      (let [props (om-next/props this)
-            page-num (get-in props ['[:app/route-params _] :page/number])
-            {project-name :project/name
-             {vcs-type :organization/vcs-type
-              org-name :organization/name} :project/organization} props
-
-            {:keys [connection/total-count
-                    connection/offset
-                    connection/edges]}
-            (:routed/page props)]
-        (if (pos? total-count)
-          (html
-           [:div
-            [:.page-info "Showing " [:span.run-numbers (inc offset) "–" (+ offset (count edges))]]
-            (run-row-collection (map :edge/node edges))
-            [:.list-pager
-             (if (< 1 page-num)
-               [:a {:href (routes/v1-project-workflows-path vcs-type org-name project-name (dec page-num))}
-                "← Newer workflow runs"]
-               [:span
-                "← Newer workflow runs"])
-             (if (> total-count (+ offset (count edges)))
-               [:a {:href (routes/v1-project-workflows-path vcs-type org-name project-name (inc page-num))}
-                "Older workflow runs →"]
-               [:span
-                "Older workflow runs →"])]])
-          (card/basic
-           (empty-state/empty-state
-            {:icon (icon/workflows)
-             :heading (html [:span (empty-state/important (str org-name "/" project-name)) " has no workflows defined yet"])
+      (component
+        (let [props (om-next/props this)
+              page-num (get-in props ['[:app/route-params _] :page/number])
+              {project-name :project/name
+               {vcs-type :organization/vcs-type
+                org-name :organization/name} :project/organization} props
+
+              {:keys [connection/total-count
+                      connection/offset
+                      connection/edges]}
+              (:routed/page props)]
+          (if (pos? total-count)
+            (html
+             [:div
+              [:.page-info "Showing " [:span.run-numbers (inc offset) "–" (+ offset (count edges))]]
+              (run-row-collection (map :edge/node edges))
+              [:.list-pager
+               (if (< 1 page-num)
+                 [:a {:href (routes/v1-project-workflows-path vcs-type org-name project-name (dec page-num))}
+                  "← Newer workflow runs"]
+                 [:span
+                  "← Newer workflow runs"])
+               (if (> total-count (+ offset (count edges)))
+                 [:a {:href (routes/v1-project-workflows-path vcs-type org-name project-name (inc page-num))}
+                  "Older workflow runs →"]
+                 [:span
+                  "Older workflow runs →"])]])
+            (card/basic
+             (empty-state/empty-state
+              {:icon (icon/workflows)
+               :heading (html [:span (empty-state/important (str org-name "/" project-name)) " has no workflows defined yet"])
                :subheading (str "Add a workflow section to " project-name "'s config to start running workflows.")})))))

       (component


Correctly handle SQL errors in <?all-rows. Fixes #40.

--- src/datomish/sqlite.cljc
+++ src/datomish/sqlite.cljc
@@ -76,7 +76,7 @@
                ;; channel being rejected and no further row callbacks
                ;; being called.
                (when (second result)
-                 (put! result c))
+                 (put! c result))
                (close! c))))

 (defn all-rows


Start using with-context in cats.core ns instead of with-monad.

--- src/cats/core.cljc
+++ src/cats/core.cljc
@@ -108,7 +108,7 @@

   Example:

-      (with-monad either/either-monad
+      (with-context either/either-monad
         (pure 1)
       ;; => #<Right [1]>
   "
@@ -134,7 +134,7 @@
   compose operations with `bind` function."
   [mv f]
   (let [ctx (get-current-context mv)]
-    (with-monad ctx
+    (with-context ctx
       (p/mbind ctx mv f))))

 (defn mzero
@@ -379,7 +379,7 @@
   [mvs]
   {:pre [(not-empty mvs)]}
   (let [ctx (get-current-context (first mvs))]
-    (with-monad ctx
+    (with-context ctx
       (reduce (fn [mvs mv]
                 (mlet [v mv
                        vs mvs]
@@ -444,7 +444,7 @@
       ;=> <Nothing>
   "
   [p mv]
-  (with-monad (get-current-context mv)
+  (with-context (get-current-context mv)
     (mlet [v mv
            :when (p v)]
           (return v))))
@@ -492,7 +492,7 @@
 (defn >=>
   "Left-to-right composition of monads."
   [mf mg x]
-  (with-monad (get-current-context mf)
+  (with-context (get-current-context mf)
     (mlet [a (mf x)
            b (mg a)]
           (return b))))
@@ -501,7 +501,7 @@
   "Right-to-left composition of monads.
   Same as `>=>` with its first two arguments flipped."
   [mg mf x]
-  (with-monad (get-current-context mf)
+  (with-context (get-current-context mf)
     (mlet [a (mf x)
            b (mg a)]
           (return b))))


Show animated arrows in right prev/curr sub-phases.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -58,13 +58,13 @@
                                (assoc-in [:actxs child-actx]
                                          {:children {} :wait-chs {}})
                                (assoc-in [:actxs actx :children child-actx] true)))
-               [{:delta :actx-start :actx actx :child-actx child-actx}]))
+               [{:delta :actx-start :actx actx :child-actx child-actx :phase :curr}]))
     :end (fn [vis actx args]
            (let [[child-actx result] args]
              (swap! vis #(-> %
                              (dissoc-in [:actxs child-actx])
                              (dissoc-in [:actxs actx :children child-actx])))
-             [{:delta :actx-end :actx actx :child-actx child-actx}]))}
+             [{:delta :actx-end :actx actx :child-actx child-actx :phase :prev}]))}
    "aclose"
    {:before (fn [vis actx args]
               (let [[ch] args] nil))
@@ -84,7 +84,7 @@
                                (dissoc-in [:chs ch :msgs msg])))
                (when (nil? msg) ; The ch is closed.
                  (swap! vis #(dissoc-in % [:chs ch])))
-               [{:delta :take :msg msg :ch ch :actx actx}]))}
+               [{:delta :take :msg msg :ch ch :actx actx :phase :prev}]))}
    "aput"
    {:before (fn [vis actx args]
               (let [[ch msg] args]
@@ -92,7 +92,7 @@
                                 (assoc-in [:actxs actx :wait-chs ch] :put)
                                 (vis-add-ch ch nil)
                                 (assoc-in [:chs ch :msgs msg] true)))
-                [{:delta :put :msg msg :actx actx :ch ch}]))
+                [{:delta :put :msg msg :actx actx :ch ch :phase :prev}]))
     :after (fn [vis actx args]
              (let [[ch msg result] args]
                (swap! vis #(-> %
@@ -115,7 +115,8 @@
                                                  (assoc-in [:actxs actx :wait-chs ch]
                                                            action)))
                                  (when (= action :put)
-                                   [{:delta :put :msg (first msgv) :actx actx :ch ch}])))
+                                   [{:delta :put :msg (first msgv) :actx actx :ch ch
+                                     :phase :prev}])))
                              ch-actions))))
     :after (fn [vis actx args]
              (let [[ch-bindings result] args
@@ -127,7 +128,8 @@
                (when (nil? result-msg) ; The ch is closed.
                  (swap! vis #(dissoc-in % [:chs result-ch])))
                (when (some #(= % result-ch) ch-bindings)
-                 [{:delta :take :msg result-msg :ch result-ch :actx actx}])))}})
+                 [{:delta :take :msg result-msg :ch result-ch :actx actx
+                   :phase :prev}])))}})

 ;; ------------------------------------------------

@@ -167,7 +169,7 @@
        [])
      "</div>"]))

-(defn vis-svg-actxs [vis positions deltas]
+(defn vis-svg-actxs [vis positions deltas phase]
   (let [stroke-width 1
         line-height 21
         chs (:chs vis)
@@ -195,33 +197,34 @@
                      (:wait-chs actx-info))))
            (:actxs vis))
      (mapv (fn [delta]
-             (case (:delta delta)
-               :put (when (get chs (:ch delta))
-                      ["<g transform='translate(500," (actx-y (:actx delta)) ")'>"
-                       "<line class='delta' x1='0' y1='0' x2='100' y2='"
-                       (- (ch-y (:ch delta)) (actx-y (:actx delta)))
-                       "' stroke='green' stroke-width='1' marker-end='url(#triangle)'/>"
-                       "</g>"])
-               :take (when (get chs (:ch delta))
-                       ["<g transform='translate(600," (ch-y (:ch delta)) ")'>"
-                        "<line class='delta' x1='0' y1='0' x2='-100' y2='"
-                        (- (actx-y (:actx delta)) (ch-y (:ch delta)))
-                        "' stroke='" (if (:msg delta) "green" "black")
-                        "' stroke-width='1' marker-end='url(#triangle)'/>"
-                        "</g>"])
-               :actx-start (when (> (actx-y (:child-actx delta)) line-height)
-                             ["<g transform='translate(30," (actx-y (:actx delta)) ")'>"
-                              "<line class='delta' x1='0' y1='0' x2='30' y2='"
-                              (- (actx-y (:child-actx delta)) (actx-y (:actx delta)))
-                              "' stroke='green' stroke-width='1' marker-end='url(#triangle)'/>"
+             (when (= phase (:phase delta))
+               (case (:delta delta)
+                 :put (when (get chs (:ch delta))
+                        ["<g transform='translate(500," (actx-y (:actx delta)) ")'>"
+                         "<line class='delta' x1='0' y1='0' x2='100' y2='"
+                         (- (ch-y (:ch delta)) (actx-y (:actx delta)))
+                         "' stroke='green' stroke-width='1' marker-end='url(#triangle)'/>"
+                         "</g>"])
+                 :take (when (get chs (:ch delta))
+                         ["<g transform='translate(600," (ch-y (:ch delta)) ")'>"
+                          "<line class='delta' x1='0' y1='0' x2='-100' y2='"
+                          (- (actx-y (:actx delta)) (ch-y (:ch delta)))
+                          "' stroke='" (if (:msg delta) "green" "black")
+                          "' stroke-width='1' marker-end='url(#triangle)'/>"
+                          "</g>"])
+                 :actx-start (when (> (actx-y (:child-actx delta)) line-height)
+                               ["<g transform='translate(30," (actx-y (:actx delta)) ")'>"
+                                "<line class='delta' x1='0' y1='0' x2='30' y2='"
+                                (- (actx-y (:child-actx delta)) (actx-y (:actx delta)))
+                                "' stroke='green' stroke-width='1' marker-end='url(#triangle)'/>"
+                                "</g>"])
+                 :actx-end (when (> (actx-y (:child-actx delta)) line-height)
+                             ["<g transform='translate(60," (actx-y (:child-actx delta)) ")'>"
+                              "<line class='delta' x1='0' y1='0' x2='-30' y2='"
+                              (- (actx-y (:actx delta)) (actx-y (:child-actx delta)))
+                              "' stroke='black' stroke-width='1' marker-end='url(#triangle)'/>"
                               "</g>"])
-               :actx-end (when (> (actx-y (:child-actx delta)) line-height)
-                           ["<g transform='translate(60," (actx-y (:child-actx delta)) ")'>"
-                            "<line class='delta' x1='0' y1='0' x2='-30' y2='"
-                            (- (actx-y (:actx delta)) (actx-y (:child-actx delta)))
-                            "' stroke='black' stroke-width='1' marker-end='url(#triangle)'/>"
-                            "</g>"])
-               nil))
+                 nil)))
            deltas)]))

 ;; ------------------------------------------------
@@ -268,14 +271,16 @@
                           (str num-events ": " (last actx) " " verb " " step " " args))
         (when (and (not (zero? @event-delay)) (not-empty deltas) vis-last vis-last-positions)
           (set-el-innerHTML "vis-svg"
-                            (apply str (flatten (vis-svg-actxs vis-last vis-last-positions deltas))))
+                            (apply str (flatten (vis-svg-actxs vis-last vis-last-positions
+                                                               deltas :prev))))
           (when (> @event-delay 0) (<! (timeout @event-delay)))
           (when (< @event-delay 0) (<! step-ch)))
         (set-el-innerHTML "vis-html"
                           (apply str (flatten (vis-html-actx @vis @root-actx vis-positions
                                                              actx-ch-ch-infos))))
         (set-el-innerHTML "vis-svg"
-                          (apply str (flatten (vis-svg-actxs @vis @vis-positions nil))))
+                          (apply str (flatten (vis-svg-actxs @vis @vis-positions
+                                                             deltas :curr))))
         (recur (inc num-events) @vis @vis-positions)))
     (ago world w
          (reset! root-actx world)


adds with-connection macro

adds with-connection macro

--- src/cetcd/core.clj
+++ src/cetcd/core.clj
@@ -4,16 +4,24 @@
             [org.httpkit.client :as http]
             [slingshot.slingshot :refer [throw+ try+]]))

-(def ^{:dynamic true} *etcd-config* {:protocol "http" :host "127.0.0.1" :port 4001})
+(def default-config {:protocol "http" :host "127.0.0.1" :port 4001})
+
+(def ^{:dynamic true} *etcd-config* default-config)

 (defn set-connection!
   "Blindly copied the approach from congomongo, but without most of the protections"
-  [{:keys [protocol host port]
-    :or {protocol "http" host "127.0.0.1" port 4001}}]
-  (let [config {:protocol protocol :host host :port port}]
+  [{:keys [protocol host port]}]
+  (let [config (merge default-config {:protocol protocol :host host :port port})]
     (alter-var-root #'*etcd-config* (constantly config))
     (when (thread-bound? #'*etcd-config*)
       (set! *etcd-config* config))))
+
+(defmacro with-connection [config & body]
+  `(do
+     (let [config# (merge default-config ~config)]
+       (println config#)
+       (binding [*etcd-config* config#]
+         ~@body))))

 (defn base-url
   "Constructs url used for all api calls"


Fix admintools page deleting translations

--- src/cljs/salava/admin/ui/admintool_content.cljs
+++ src/cljs/salava/admin/ui/admintool_content.cljs
@@ -17,7 +17,8 @@
 (defn delete-item [state visible_area item_owner]
   (let [{:keys [item_id mail item_owner_id gallery-state init-data name item_type]} @state
         mail (cursor state [:mail])
-        item_ownertext (if (= 1 (count item_owner_id)) (str (t :admin/Earners) " " item_owner) item_owner)]
+        item_ownertext (if (or (= "page" item_type)  (= 1 (count item_owner_id))) (str (t :admin/Earners) " " item_owner) item_owner)
+        ]
     [:div {:class "row"}
      [:div {:class "col-md-12 sub-heading"}
       [:a {:href "#" :on-click #(do (.preventDefault %) (reset! visible_area (if (= "delete-item" @visible_area) "" "delete-item")))} (t :core/Delete) ]]
@@ -143,7 +144,8 @@

 (defn private-item [state visible_area item_owner]
   (let [{:keys [item_type item_id item_owner_id  gallery-state init-data name]} @state
-        item_ownertext (if (= 1 (count item_owner_id)) (str (t :admin/Earners) " " item_owner) item_owner)]
+        item_ownertext (if (or (= "page" item_type)  (= 1 (count item_owner_id))) (str (t :admin/Earners) " " item_owner) item_owner)
+        ]
     [:div {:class "row"}
      [:div {:class "col-md-12 sub-heading"}
       [:a {:href "#" :on-click #(do (.preventDefault %) (reset! visible_area (if (= "private-item" @visible_area) "" "private-item")))} (t :admin/Privatethis)]]


Fix ns decl

Fix ns decl

--- test/caesium/crypto/secretbox_test.clj
+++ test/caesium/crypto/secretbox_test.clj
@@ -1,9 +1,9 @@
 (ns caesium.crypto.secretbox-test
   (:require [caesium.crypto.secretbox :as s]
+            [caesium.test-utils :refer [const-test]]
             [caesium.util :as u]
             [caesium.vectors :as v]
-            [caesium.test-utils :refer [const-test]]
-            [clojure.test :refer [deftest is are testing]]))
+            [clojure.test :refer [are deftest testing]]))

 (const-test
  s/keybytes 32


testing ssh access

testing ssh access

--- test/celestial/integration/proxmox.clj
+++ test/celestial/integration/proxmox.clj
@@ -1,6 +1,8 @@
 (ns celestial.integration.proxmox
   "Integration tests assume a proxmox vm with local address make sure to configure it"
   (:require
+     [celestial.common :refer (get!)]
+     [supernal.sshj :refer (execute)]
      [flatland.useful.map :refer (dissoc-in*)]
      [celestial.common :refer (slurp-edn)]
      [celestial.fixtures :refer (with-conf redis-prox-spec redis-bridged-prox-spec)]
@@ -18,12 +20,14 @@

 ; generators

-(defn running-seq [ct]
+(defn running-seq [{:keys [network] :as ct}]
   (.stop ct)
   (.delete ct)
   (.create ct)
   (.start ct)
   (.status ct) => "running"
+  ; making sure its ssh-able
+  (execute "touch /tmp/foo" {:host (:ip_address network) :user "root"}) => nil
   (.stop ct)
   (.delete ct))


fix total formatting

fix total formatting

--- frontend/src/leftover/core.cljs
+++ frontend/src/leftover/core.cljs
@@ -4,6 +4,7 @@
             [om-tools.dom :as dom :include-macros true]
             [cljs.core.async :refer [put! chan <! >! close!]]
             [goog.net.XhrIo :as xhr]
+            [goog.string :as gstring]
             [om-bootstrap.button :as obb]
             [om-bootstrap.input :as obi]
             [om-bootstrap.table :as obt]
@@ -98,7 +99,7 @@
   (reify om/IRender
     (render [this]
       (dom/h3 {:class "col-sm-6 currenttotal"}
-               (str "Current Total: " (apply - (:start-amount data) (map :amount (:previous-payments data))))))))
+               (str "Current Total: " (gstring/format "$%.02f" (apply - (:start-amount data) (map :amount (:previous-payments data)))))))))

 (defn main-view [app owner]
   (reify om/IRender