Re-add pipeline docstrings.

Re-add pipeline docstrings.

--- src/onyx/peer/pipeline_extensions.clj
+++ src/onyx/peer/pipeline_extensions.clj
@@ -16,15 +16,16 @@
             [sealResource [clojure.lang.IPersistentMap] Object]])

 (defprotocol PipelineInput
-  ;   "Acknowledges a message at the native level for a batch of message ids.
-  ;    Must return a map."
-  (ack-message [this event message-id])
-  ;   "Releases a message id from the pending message pool and retries it."
-  (retry-message [this event message-id])
-  ;   "Returns true if this message ID is pending."
-  (pending? [this event message-id])
-  ;   "Returns true if this input resource has been exhausted."
-  (drained? [this event]))
+  "Input pipeline protocol. All input pipelines must implement this protocol."
+  (ack-message [this event message-id]
+               "Acknowledges a message at the native level for a batch of message ids.
+               Must return a map.")
+  (retry-message [this event message-id]
+                 "Releases a message id from the pending message pool and retries it.")
+  (pending? [this event message-id]
+            "Returns true if this message ID is pending.")
+  (drained? [this event]
+            "Returns true if this input resource has been exhausted."))

 (extend-protocol PipelineInput
   onyx.peer.IPipelineInput
@@ -38,23 +39,24 @@
     (.isDrained this event)))

 (defprotocol Pipeline
-  ;   "Reads :onyx/batch-size segments off the incoming data source.
-  ;    Must return a map with key :onyx.core/batch and value seq representing
-  ;    the ingested segments. The seq must be maps of two keys:
+  "Pipeline protocol. All pipelines must implement this protocols i.e. input, output, functions"
+  (read-batch [this event]
+              "Reads :onyx/batch-size segments off the incoming data source.
+              Must return a map with key :onyx.core/batch and value seq representing
+              the ingested segments. The seq must be maps of two keys:

-  ;    - :input - A keyword representing the task that the message came from
-  ;    - :message - The consumed message"
-  (read-batch [this event])
-  ;   "Writes segments to the outgoing data source. Must return a map."
-  (write-batch [this event])
-  ;   "Closes any resources that remain open during a task being executed.
-  ;    Called once at the end of a task for each virtual peer after the incoming
-  ;    queue has been exhausted. Only called once globally for a single task."
+              - :input - A keyword representing the task that the message came from
+              - :message - The consumed message")
+  (write-batch [this event]
+               "Writes segments to the outgoing data source. Must return a map.")
+  (seal-resource [this event]
+                 "Closes any resources that remain open during a task being executed.
+                 Called once at the end of a task for each virtual peer after the incoming
+                 queue has been exhausted. Only called once globally for a single task."

-  ;   "Closes any resources that remain open during a task being executed.
-  ;    Called once at the end of a task for each virtual peer after the incoming
-  ;    queue has been exhausted. Only called once globally for a single task."
-  (seal-resource [this event]))
+                 "Closes any resources that remain open during a task being executed.
+                 Called once at the end of a task for each virtual peer after the incoming
+                 queue has been exhausted. Only called once globally for a single task."))

 (extend-protocol Pipeline
   onyx.peer.IPipeline


Fix handling of ';' statement

Fix handling of ';' statement

--- src/luaclj/parser.clj
+++ src/luaclj/parser.clj
@@ -272,6 +272,8 @@
               (second args)
               (= "break" (first args))
               '(break)
+              (= ";" (first args))
+              []
               :else
               (first args))]
     (debug "stat-fn return:" r)
@@ -425,12 +427,12 @@
           :exp7 :exp8 :exp9 :exp10 :exp12])))

-(defn parse-lua [lua-str opts]
+(defn parse-lua [lua-str & opts]
   (->> lua-str
        lua-parser
        (insta/transform (assoc transform-map
                                :chunk
-                               (partial chunk-fn opts)))))
+                               (partial chunk-fn (or (first opts) {}))))))

 (comment

@@ -649,5 +651,6 @@
   (try (pprint (insta/transform transform-map (lua-parser (slurp-lua "resources/test/for.lua"))))
        (catch Exception ex (clojure.stacktrace/print-stack-trace ex)))
   (pprint tree)
+  ((eval (parse-lua "local v = 0; for i = 1,100 do v = v + i end return v")))
   (prewalk #(do (debug %1) %1) tree)
          )


fix require

fix require

--- src/ci3/server/core.clj
+++ src/ci3/server/core.clj
@@ -4,7 +4,6 @@
    [ci3.build.core :as build]
    [unifn.rest :as rest]
    [ci3.server.watch]
-   [ci3.server.api]
    [ci3.repo.core :as repo]
    [unifn.env]
    [unifn.formats]


Clean up example.

Clean up example.

--- src/cli4clj/example.clj
+++ src/cli4clj/example.clj
@@ -12,8 +12,8 @@
           The example can be run via \"lein run\"."}
   cli4clj.example
   (:require
-    (cli4clj [cli :refer :all])
-    (clojure [pprint :refer :all]))
+    (cli4clj [cli :as cli])
+    (clojure [pprint :as pprint]))
   (:gen-class))

 ;;; This function is just used for providing an example below.
@@ -24,61 +24,59 @@
 ;;; Simple cli4clj usage example:
 ;;; In the simplest scenario only the commands have to be defined.
 ;;; In the following, an example using a simple scenario along with some explanations is provided:
-;;;          cli4clj is configured via an "options" map.
-;;;          | Commands are stored in a nested map using the key :cmds in the options map.
-;;;          |  |      As first simple example command, we define a command called "test".
-;;;          |  |      |     The function to be called for the command is defined via :fn.
-;;;          |  |      |     |  In this example we use an anonymous function.
-;;;          |  |      |     |  However, arbitrary functions can be used.
-  (start-cli {:cmds {:test {:fn #(println "This is a test.")
-;;;                         Optionally a short information text can be given.
-                            :short-info "Test Command"
-;;;                         Another long information text can be optionally given as well.
-                            :long-info "Prints a test message to stdout."}
-;;;                  "Aliases" can be used, e.g., for defining shortcuts by relating to existing commands.
-;;;                  The order in which aliases and commands are defined does not matter.
-;;;                  Just make sure that the alias refers to an existing command.
-                     :t :test
-;;;                  Commands can also accept arguments as shown for the "add" example."
-;;;                  All Clojure data types are supported as arguments.
-;;;                  However, no sanity checks, e.g., with respect to the number of arguments or the argument type(s), are performed.
-;;;                  If things go wrong, exceptions will be thrown and printed.
-                     :add  {:fn (fn [summand1 summand2] (+ summand1 summand2))
-                            :short-info "Add two values."}
-                            :a :add
-;;;                  cli4clj already provides some pre-defined commands, from which some can overridden while others cannot.
-;;;                  "h" is a pre-defined command but it can be overridden.
-;;;                  This is shown by using the definition of an alias to test as example.
-                     :h :test
-;;;                  The pre-defined "help" command, however, cannot be overridden.
-;;;                  Please note that "help" and "exit" cannot be overridden by any user defined command.
-                     :help :test
-;;;                  The following simple example command is used to illustrate that arbitrary Clojure data types can be used.
-;;;                  The command is intended to take a seq (e.g., a list or vector) which it converts into a CSV string.
-                     :to-csv {:fn (fn [data] (reduce (fn [s d] (str s "," d)) (str (first data)) (rest data)))
-;;;                           A "completion-hint" can be displayed along with the function arguments via tab-completion.
-;;;                           In the CLI, press the tab-key to test the tab-completion feature.
-                              :completion-hint "The data argument can be of any Clojure sequence type, e.g., [1 2 3] or (:a :b :c). Note that the list is not quoted."
-                              :short-info "Seq to CSV"
-                              :long-info "E.g.: \"to-csv [1 2 3]\""}
-;;;                  The following example shows the use of a named function.
-;;;                  The divide function is also used to illustrate the behavior on errors during processing (e.g., try to divide by 0).
-                     :divide {:fn divide
-;;;                           The completion-hint may also refer to another command property such as the short info.
-                              :completion-hint :short-info
-                              :short-info "Divide two values."
-                              :long-info "The first argument will be divided by the second argument."}
-                     :d :divide
-;;;                  The following example shows the use of optional arguments.
-;;;                  It can also be used to test how different types of inputs are treated.
-                     :print {:fn (fn [arg & opt-args]
-                                   (print "Arg-type:" (type arg) "Arg: ")
-                                   (pprint arg)
-                                   (print "Opt-args: ")
-                                   (pprint opt-args))
-                             :short-info "Pretty print the supplied arguments."
-                             :long-ingo "This function pretty prints its supplied arguments. It takes at least one argument."}
-                     :p :print
-                    }
-             }))
+;;;              cli4clj is configured via an "options" map.
+;;;              | Commands are stored in a nested map using the key :cmds in the options map.
+;;;              |  |      As first simple example command, we define a command called "test".
+;;;              |  |      |     The function to be called for the command is defined via :fn.
+;;;              |  |      |     |  In this example we use an anonymous function.
+;;;              |  |      |     |  However, arbitrary functions can be used.
+  (cli/start-cli {:cmds {:test {:fn #(println "This is a test.")
+;;;                             Optionally a short information text can be given.
+                                :short-info "Test Command"
+;;;                             Another long information text can be optionally given as well.
+                                :long-info "Prints a test message to stdout."}
+;;;                      "Aliases" can be used, e.g., for defining shortcuts by relating to existing commands.
+;;;                      The order in which aliases and commands are defined does not matter.
+;;;                      Just make sure that the alias refers to an existing command.
+                         :t :test
+;;;                      Commands can also accept arguments as shown for the "add" example."
+;;;                      All Clojure data types are supported as arguments.
+;;;                      However, no sanity checks, e.g., with respect to the number of arguments or the argument type(s), are performed.
+;;;                      If things go wrong, exceptions will be thrown and printed.
+                         :add  {:fn (fn [summand1 summand2] (+ summand1 summand2))
+                                :short-info "Add two values."}
+                                :a :add
+;;;                      cli4clj already provides some pre-defined commands, from which some can overridden while others cannot.
+;;;                      "h" is a pre-defined command but it can be overridden.
+;;;                      This is shown by using the definition of an alias to test as example.
+                         :h :test
+;;;                      The pre-defined "help" command, however, cannot be overridden.
+;;;                      Please note that "help" and "exit" cannot be overridden by any user defined command.
+                         :help :test
+;;;                      The following simple example command is used to illustrate that arbitrary Clojure data types can be used.
+;;;                      The command is intended to take a seq (e.g., a list or vector) which it converts into a CSV string.
+                         :to-csv {:fn (fn [data] (reduce (fn [s d] (str s "," d)) (str (first data)) (rest data)))
+;;;                               A "completion-hint" can be displayed along with the function arguments via tab-completion.
+;;;                               In the CLI, press the tab-key to test the tab-completion feature.
+                                  :completion-hint "The data argument can be of any Clojure sequence type, e.g., [1 2 3] or (:a :b :c). Note that the list is not quoted."
+                                  :short-info "Seq to CSV"
+                                  :long-info "E.g.: \"to-csv [1 2 3]\""}
+;;;                      The following example shows the use of a named function.
+;;;                      The divide function is also used to illustrate the behavior on errors during processing (e.g., try to divide by 0).
+                         :divide {:fn divide
+;;;                               The completion-hint may also refer to another command property such as the short info.
+                                  :completion-hint :short-info
+                                  :short-info "Divide two values."
+                                  :long-info "The first argument will be divided by the second argument."}
+                         :d :divide
+;;;                      The following example shows the use of optional arguments.
+;;;                      It can also be used to test how different types of inputs are treated.
+                         :print {:fn (fn [arg & opt-args]
+                                       (print "Arg-type:" (type arg) "Arg: ")
+                                       (pprint/pprint arg)
+                                       (print "Opt-args: ")
+                                       (pprint/pprint opt-args))
+                                 :short-info "Pretty print the supplied arguments."
+                                 :long-ingo "This function pretty prints its supplied arguments. It takes at least one argument."}
+                         :p :print}}))


unused import

unused import

--- src/clj_http/client.clj
+++ src/clj_http/client.clj
@@ -11,7 +11,6 @@
             [clj-http.util :as util])
   (:import (java.io InputStream File)
            (java.net URL UnknownHostException)
-           (org.apache.http.conn.params ConnPerRouteBean)
            (org.apache.http.entity BufferedHttpEntity ByteArrayEntity
                                    InputStreamEntity FileEntity StringEntity))
   (:refer-clojure :exclude (get)))


Fix bugs around PersistentTreeMap, PersistentHashMap

A missing ctor argument is supplied in tree-map-append, missing
protocol method and .toString implementations are supplied in PTM- and
PHM-related auxiliary types.

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -3359,11 +3359,21 @@
                (.inode-assoc! edit shift key2hash key2 val2 added-leaf?)))))))

 (deftype NodeSeq [meta nodes i s]
+  Object
+  (toString [this]
+    (pr-str this))
+
   IMeta
   (-meta [coll] meta)

   IWithMeta
   (-with-meta [coll meta] (NodeSeq. meta nodes i s))
+
+  ICollection
+  (-conj [coll o] (cons o coll))
+
+  IEmptyableCollection
+  (-empty [coll] (with-meta cljs.core.List/EMPTY meta))

   ISequential
   ISeq
@@ -3381,7 +3391,10 @@
   (-seq [this] this)

   IEquiv
-  (-equiv [coll other] (equiv-sequential coll other)))
+  (-equiv [coll other] (equiv-sequential coll other))
+
+  IHash
+  (-hash [coll] (hash-coll coll)))

 (defn- create-inode-seq
   ([nodes]
@@ -3401,11 +3414,21 @@
        (NodeSeq. nil nodes i s))))

 (deftype ArrayNodeSeq [meta nodes i s]
+  Object
+  (toString [this]
+    (pr-str this))
+
   IMeta
   (-meta [coll] meta)

   IWithMeta
   (-with-meta [coll meta] (ArrayNodeSeq. meta nodes i s))
+
+  ICollection
+  (-conj [coll o] (cons o coll))
+
+  IEmptyableCollection
+  (-empty [coll] (with-meta cljs.core.List/EMPTY meta))

   ISequential
   ISeq
@@ -3416,7 +3439,10 @@
   (-seq [this] this)

   IEquiv
-  (-equiv [coll other] (equiv-sequential coll other)))
+  (-equiv [coll other] (equiv-sequential coll other))
+
+  IHash
+  (-hash [coll] (hash-coll coll)))

 (defn- create-array-node-seq
   ([nodes] (create-array-node-seq nil nodes 0 nil))
@@ -3772,6 +3798,9 @@

 (deftype BlackNode [key val left right]
   Object
+  (toString [this]
+    (pr-str this))
+
   (add-left [node ins]
     (.balance-left ins node))

@@ -3871,6 +3900,9 @@

 (deftype RedNode [key val left right]
   Object
+  (toString [this]
+    (pr-str this))
+
   (add-left [node ins]
     (RedNode. key val ins right))

@@ -4039,6 +4071,7 @@
                               (.-right app)
                               (.-right right)))
           (RedNode. (.-key left) (.-val left)
+                    (.-left left)
                     (RedNode. (.-key right) (.-val right) app (.-right right)))))
       (RedNode. (.-key left) (.-val left)
                 (.-left left)


CLJS-1068: node target define

CLJS-1068: node target define

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -16,6 +16,9 @@
 (def *clojurescript-version*)

 (def *unchecked-if* false)
+
+(def ^{:jsdoc ["@define"]}
+  node-target false)

 (defonce
   ^{:doc "Each runtime environment provides a different way to print output.


Make object creation in lookup-sentinel adv mode compatible.

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -136,8 +136,6 @@
 (defn nil? [x]
   "Returns true if x is nil, false otherwise."
   (identical? x nil))
-
-(def ^:private lookup-sentinel (goog.global.Object.))

 ;;;;;;;;;;;;;;;;;;; protocols on primitives ;;;;;;;;
 (declare hash-map list equiv-sequential)
@@ -476,6 +474,7 @@

 ;;;;;;;;;;;;;;;; preds ;;;;;;;;;;;;;;;;;;

+(def ^:private lookup-sentinel (js-obj))

 (defn false?
   "Returns true if x is the value false, false otherwise."


* src/cljs/cljs/core.cljs: move IPrintable function implementation

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -218,11 +218,6 @@

 (defn type [x]
   (js* "(~{x}).constructor"))
-
-(extend-type js/Function
-  IPrintable
-  (-pr-seq [this]
-    (list "#<" (str this) ">")))

 ;;;;;;;;;;;;;;;;;;; protocols on primitives ;;;;;;;;
 (declare hash-map list equiv-sequential)
@@ -2978,6 +2973,10 @@
                    (goog.string.quote obj)
                    obj))))

+  function
+  (-pr-seq [this]
+    (list "#<" (str this) ">"))
+
   LazySeq
   (-pr-seq [coll opts] (pr-sequential pr-seq "(" " " ")" opts coll))


Added propper print of date

Added propper print of date

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -6193,7 +6193,21 @@
     (list "#<" (str this) ">"))

   js/Date
-  (-pr-seq [d opts] #_(.toISOString d) "12233445")
+  (-pr-seq [d _]
+    (let [normalize (fn [n len]
+                      (loop [ns (str n)]
+                        (if (< (count ns) len)
+                          (recur (str "0" ns))
+                          ns)))]
+      (str "#inst \""
+           (.getUTCFullYear d)                   "-"
+           (normalize (inc (.getUTCMonth d)) 2)  "-"
+           (normalize (.getUTCDate d) 2)         "T"
+           (normalize (.getUTCHours d) 2)        ":"
+           (normalize (.getUTCMinutes d) 2)      ":"
+           (normalize (.getUTCSeconds d) 2)      "."
+           (normalize (.getUTCMilliseconds d) 3) "-"
+           "00:00\"")))

   LazySeq
   (-pr-seq [coll opts] (pr-sequential pr-seq "(" " " ")" opts coll))


A bit cleaner

A bit cleaner

--- src/cljs_rest/core.cljs
+++ src/cljs_rest/core.cljs
@@ -121,21 +121,21 @@
 (def link-pattern
   #"<(.*?)>; rel=\"(.*?)\"")

-(defn parse-link [headers]
-  (if-let [link (:link headers)]
-    (let [matches (re-seq link-pattern link)
-          link* (reduce
-                  (fn [acc [_ url key-str]]
-                    (assoc acc (keyword key-str) url))
-                  {}
-                  matches)]
-      (assoc headers :link link*))
-    headers))
+(defn expand-link [link]
+  (when link
+    (let [matches (re-seq link-pattern link)]
+      (if (empty? matches)
+          link
+          (reduce
+            (fn [acc [_ url key-str]]
+              (assoc acc (keyword key-str) url))
+            {}
+            matches)))))

 (defn expand-headers [headers]
   (-> headers
       with-keywords
-      parse-link))
+      (update :link expand-link)))

 (defn request
   ([url] (request url {}))


Add new connect method.

Add new connect method.

--- src/clojure/nanomsg.clj
+++ src/clojure/nanomsg.clj
@@ -23,6 +23,19 @@
   [^RWSocket sock, ^String dir]
   (.connect sock dir)
   sock)
+
+(defn socket
+  "Geiven a socket type, create a new instance
+  of corresponding socket."
+  ([^RWSocket socktype] (socket socktype {}))
+  ([^RWSocket socktype opts]
+   {:pre [(supported-sockets socktype)]}
+   (let [cls      (-> socktype supported-sockets)
+         instance (.newInstance cls)]
+     (cond
+       (:bind opts) (bind instance (:bind opts))
+       (:connect opts) (connect instance (:connect opts)))
+     instance)))

 (defn subscribe
   "Subscribe a current subscriber socket


lein-template release

lein-template release

--- lein-template/project.clj
+++ lein-template/project.clj
@@ -1,7 +1,7 @@
 ;; Copyright © 2014 JUXT LTD.

 ;; We call this project modular to make the invocation: lein new modular appname
-(defproject modular/lein-template "0.6.7"
+(defproject modular/lein-template "0.6.8"
   :description "Leiningen template for a full-featured component based app using modular extensions."
   :license {:name "The MIT License"
             :url "http://opensource.org/licenses/MIT"}


Remove use of shutdown hook, as timer is a daemon thread anyway.

--- src/containium/core.clj
+++ src/containium/core.clj
@@ -267,10 +267,8 @@
                (run []
                  (let [threads (keys (Thread/getAllStackTraces))]
                    (println (apply str "Threads still running (" (count threads) "):\n  "
-                                   (interpose "\n  " threads))))))
-        cancel-thread (Thread. #(.cancel timer))]
-    (.schedule timer task (* wait 1000))
-    (.addShutdownHook (Runtime/getRuntime) cancel-thread)))
+                                   (interpose "\n  " threads))))))]
+    (.schedule timer task (* wait 1000))))

 ;;; The coordinating functions.


Delete static param that should not be used

--- src/freecoin/params.clj
+++ src/freecoin/params.clj
@@ -29,11 +29,6 @@
             [freecoin.translation :as trans]))

 (def version "software release version" "0.2")
-
-;; TODO: perhaps already configured in ring?
-(def host
-  {:address "fork"
-   :port 8000})

 ;; defaults
 (def encryption


Add round-double

Add round-double

--- src/hydrofoil/utils.clj
+++ src/hydrofoil/utils.clj
@@ -13,3 +13,8 @@
   "Takes a double and returns a double with four points of accuracy"
   [lower-bound upper-bound]
   (/ (double (+ (rand-int (* (- upper-bound lower-bound) 100)) (* lower-bound 100)))100))
+
+(defn round-double
+   "Takes a double and returns a double with four points of accuracy"
+   [n]
+   (double (/ (int (+ (* n 10000) 0.5)) 10000)))


cleanup: remove invalid test

cleanup: remove invalid test

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -15,35 +15,6 @@
             #?(:clj [clojure.tools.logging :as log])
             #?(:cljs [babel.logjs :as log])
             [dag_unify.core :refer [get-in strip-refs]]))
-
-(deftest generate-irregular-present
-  (let [form {:english {:a {:english {:past {:1sing "was",
-                                             :3plur "were",
-                                             :1plur "were",
-                                             :2plur "were",
-                                             :3sing "was",
-                                             :2sing "were"},
-                                      :agr {:person :3rd
-                                            :gender :fem
-                                            :pronoun false
-                                            :number :sing}
-                                      :english "be",
-                                      :cat :verb,
-                                      :infl :present,
-                                      :present {:1sing "am",
-                                                :3plur "are",
-                                                :1plur "are",
-                                                :2plur "are",
-                                                :3sing "is",
-                                                :2sing "are"}}}
-                        :b {:agr {:gender :fem
-                                  :number :sing
-                                  :person :3rd}
-                            :cat :noun
-                            :english "Antonia"
-                            :pronoun false}}}]
-    (is (= (fo form)
-           "is Antonia"))))

 (deftest generate-irregular-present-1
   (let [form {:english {:a {:cat :verb,
@@ -124,44 +95,6 @@
     (is (= (fo form)
            "is Juan"))))

-(deftest generate-irregular-present-4
-  (let [form {:a {:a {:english "your"}
-                  :b {:english "name",
-                      :pronoun false,
-                      :cat :noun,
-                      :agr {:pronoun false,
-                            :gender :masc,
-                            :number :sing,
-                            :person :3rd}}}
-              :b {:a {:agr {:pronoun false,
-                            :gender :masc,
-                            :number :sing,
-                            :person :3rd},
-                      :past {:2plur "were",
-                             :3sing "was",
-                             :2sing "were",
-                             :1sing "was",
-                             :3plur "were",
-                             :1plur "were"},
-                      :english "be",
-                      :present {:2plur "are",
-                                :3sing "is",
-                                :2sing "are",
-                                :1sing "am",
-                                :3plur "are",
-                                :1plur "are"},
-                      :infl :present,
-                      :cat :verb}
-                  :b {:cat :noun,
-                      :pronoun false,
-                      :agr {:pronoun false,
-                            :gender :masc,
-                            :number :sing,
-                            :person :3rd},
-                      :english "Juan"}}}]
-    (is (or false (= (fo form)
-                    "your name is Juan")))))
-
 (deftest generate-irregular-imperfect
   (let [form {:english
               {:a {:english "you all",


whitespace

whitespace

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -511,12 +511,12 @@

 (deftest present-progressive-ends-with-e
   (let [spec1 {:modified false
-              :root {:english {:english "participate"}}
-              :synsem {:cat :verb
-                       :subcat ()
-                       :sem {:tense :present
-                             :aspect :progressive
-                             :subj {:pred :I}}}}
+               :root {:english {:english "participate"}}
+               :synsem {:cat :verb
+                        :subcat ()
+                        :sem {:tense :present
+                              :aspect :progressive
+                              :subj {:pred :I}}}}
         spec2 {:modified false
                :root {:english {:english "hope"}}
                :synsem {:cat :verb


track a few more things with statsd

track a few more things with statsd

--- src/pc/http/sente.clj
+++ src/pc/http/sente.clj
@@ -64,6 +64,24 @@
 (defonce team-subs (atom {}))

 (defonce client-stats (atom {}))
+
+(defn track-document-subs []
+  (add-watch document-subs :statsd (fn [_ _ old-state new-state]
+                                     (when (not= (count old-state)
+                                                 (count new-state))
+                                       (statsd/gauge "document-subs" (count new-state))))))
+
+(defn track-clients []
+  (add-watch client-stats :statsd (fn [_ _ old-state new-state]
+                                    (when (not= (count old-state)
+                                                (count new-state))
+                                      (statsd/gauge "connected-clients" (count new-state))))))
+
+(defn track-team-subs []
+  (add-watch team-subs :statsd (fn [_ _ old-state new-state]
+                                 (when (not= (count old-state)
+                                             (count new-state))
+                                   (statsd/gauge "team-subs" (count new-state))))))

 (defn notify-document-transaction [db {:keys [read-only-data admin-data]}]
   (let [doc (:transaction/document read-only-data)
@@ -748,6 +766,9 @@
                                                        {:user-id-fn #'user-id-fn})]
     (reset! sente-state fns)
     (setup-ws-handlers fns)
+    (track-document-subs)
+    (track-clients)
+    (track-team-subs)
     fns))

 (defn shutdown [& {:keys [sleep-ms]


test-grace-period-with-token better handling of non-200 response (#393)

--- waiter/integration/waiter/request_timeout_test.clj
+++ waiter/integration/waiter/request_timeout_test.clj
@@ -177,14 +177,14 @@
           (is (str/blank? (:instance-id response))))
         (.await long-request-ended-latch)))))

-(deftest ^:parallel ^:integration-fast test-grace-period-with-tokens
+(deftest ^:parallel ^:integration-fast ^:resource-heavy test-grace-period-with-tokens
   (testing-using-waiter-url
     (let [grace-period (t/minutes 2)
           startup-delay-ms (-> grace-period t/in-millis (* 0.75) long)
           token (rand-name)]
       (try
         (log/info "Creating token for" token)
-        (let [{:keys [status body]}
+        (let [response
               (post-token waiter-url {:cmd (kitchen-cmd (str "--port $PORT0 --start-up-sleep-ms "
                                                              startup-delay-ms))
                                       :version "not-used"
@@ -196,22 +196,23 @@
                                       :name (str "test" token)
                                       :grace-period-secs (t/in-seconds grace-period)
                                       :cmd-type "shell"})]
-          (is (= 200 status) (str "Did not get a 200 response. " body)))
+          (assert-response-status response 200))
         (log/info "Making request for" token)
-        (let [{:keys [status body service-id] :as response} (make-request-with-debug-info
-                                                              {:x-waiter-token token}
-                                                              #(make-request waiter-url "/secrun" :headers %))
-              instance-acquired-delay-ms (-> response
-                                             :headers
-                                             (get "x-waiter-get-available-instance-ns")
-                                             Long/parseLong
-                                             (quot 1000000))] ; truncated nanos->millis
-          (is (= 200 status) (str "Did not get a 200 response. " body))
-          (is (<= startup-delay-ms instance-acquired-delay-ms)
-              (format "Healthy instance was found in just %dms (too short)" instance-acquired-delay-ms))
-          (when (and (= 200 status) (can-query-for-grace-period? waiter-url))
+        (let [{:keys [status service-id] :as response} (make-request-with-debug-info
+                                                         {:x-waiter-token token}
+                                                         #(make-request waiter-url "/secrun" :headers %))]
+          (assert-response-status response 200)
+          (when (= 200 status)
             (log/info "Verifying app grace period for" token)
-            (is (= (t/in-seconds grace-period) (service-id->grace-period waiter-url service-id))))
+            (let [instance-acquired-delay-ms (-> response
+                                                 :headers
+                                                 (get "x-waiter-get-available-instance-ns" -1)
+                                                 Long/parseLong
+                                                 (quot 1000000))] ; truncated nanos->millis
+              (is (<= startup-delay-ms instance-acquired-delay-ms)
+                  (str "Healthy instance was found in just " instance-acquired-delay-ms " ms (too short)")))
+            (when (using-marathon? waiter-url)
+              (is (= (t/in-seconds grace-period) (service-id->grace-period waiter-url service-id)))))
           (delete-service waiter-url service-id))
         (finally
           (delete-token-and-assert waiter-url token))))))


Fixing problem with "too many open files" after running tests in nrepl for about a thousand times.

--- test/clojurewerkz/cassaforte/test_helper.clj
+++ test/clojurewerkz/cassaforte/test_helper.clj
@@ -7,12 +7,14 @@

 (defn initialize-cql
   [f]
-  (cc/connect! "127.0.0.1")
-  (cql/set-keyspace "CassaforteTest1")
+  (when (not (bound? (var cc/*cassandra-client*)))
+    (cc/connect! "127.0.0.1")
+    (with-thrift-exception-handling
+      (cql/set-keyspace "cassaforte_test_1")))
   (f))

 ;;
 ;; TBD
 ;;
 (defn initialize-thrift
-  [f])+  [f])


upsert-lookups-test

upsert-lookups-test

--- test/er_cassandra/model/alia/upsert_test.clj
+++ test/er_cassandra/model/alia/upsert_test.clj
@@ -223,10 +223,35 @@
     (is (= nil (fetch-record :upsert_mixed_lookup_test_by_phone
                              [:phone] "456")))))

-(deftest lookup-record-seq-test)
-
-(deftest with-columns-option-for-lookups
-  (let [m (t/create-entity
+(deftest lookup-record-seq-test
+  (testing "mixed lookups seq"
+    (let [m (create-mixed-lookup-entity)
+          nick-t (->> m :lookup-key-tables
+                      (filter #(= :upsert_mixed_lookup_test_by_nick (:name %)))
+                      first)
+          email-t (->> m :lookup-key-tables
+                       (filter #(= :upsert_mixed_lookup_test_by_email (:name %)))
+                       first)
+          phone-t (->> m :lookup-key-tables
+                       (filter #(= :upsert_mixed_lookup_test_by_phone (:name %)))
+                       first)
+          [org-id id] [(uuid/v1) (uuid/v1)]
+          r {:org_id org-id :id id
+             :nick "foo"
+             :email #{"foo@bar.com" "foo@baz.com"}
+             :phone ["123" "456"]}
+
+          rs (u/lookup-record-seq m nil r)]
+
+      (is (= (set
+              [[nick-t {:org_id org-id :id id :nick "foo"}]
+               [email-t {:org_id org-id :id id :email "foo@bar.com"}]
+               [email-t {:org_id org-id :id id :email "foo@baz.com"}]
+               [phone-t {:org_id org-id :id id :phone "123"}]
+               [phone-t {:org_id org-id :id id :phone "456"}]])
+             (set rs)))))
+  (testing "with-columns option"
+    (let [m (t/create-entity
            {:primary-table {:name :foos :key [:id]}
             :secondary-tables [{:name :foos_by_bar :key [:bar]}
                                {:name :foos_by_baz :key [:baz]}]
@@ -253,9 +278,41 @@
           1      (count lookups)
           :C1    (:c1 lrecord)
           :C2    (:c2 lrecord)
-          false  (contains? lrecord :c3))))))
-
-(deftest upsert-lookups-test)
+          false  (contains? lrecord :c3)))))))
+
+
+(deftest upsert-lookups-test
+  (let [m (create-mixed-lookup-entity)
+        [org-id id] [(uuid/v1) (uuid/v1)]
+
+        nick-foo-r {:org_id org-id :id id :nick "foo"}
+
+        [status
+         record
+         reason] @(u/upsert-lookups
+                   tu/*model-session*
+                   m
+                   nil
+                   {:org_id org-id :id id
+                    :nick "foo"
+                    :email #{"foo@bar.com" "foo@baz.com"}
+                    :phone ["123" "456"]})]
+
+    (is (= {:org_id org-id :id id :nick "foo"}
+           (fetch-record :upsert_mixed_lookup_test_by_nick
+                         [:org_id :nick] [org-id "foo"])))
+    (is (= {:org_id org-id :id id :email "foo@bar.com"}
+           (fetch-record :upsert_mixed_lookup_test_by_email
+                         [:email] ["foo@bar.com"])))
+    (is (= {:org_id org-id :id id :email "foo@baz.com"}
+           (fetch-record :upsert_mixed_lookup_test_by_email
+                         [:email] ["foo@baz.com"])))
+    (is (= {:org_id org-id :id id :phone "123"}
+           (fetch-record :upsert_mixed_lookup_test_by_phone
+                         [:phone] "123")))
+    (is (= {:org_id org-id :id id :phone "456"}
+           (fetch-record :upsert_mixed_lookup_test_by_phone
+                         [:phone] "456")))))

 (deftest copy-unique-keys-test)


fixed test

fixed test

--- test/meo/store_test.clj
+++ test/meo/store_test.clj
@@ -120,8 +120,8 @@
                        :message [:options/gen]
                        :timeout 5000}]
                      (-> @test-atom first)))
-              (is (= :cmd/schedule-new (-> @test-atom second first)))
-              (is (= :sync/imap (-> @test-atom (get 2) first)))
+              (is (= :sync/imap (-> @test-atom second first)))
+              (is (= :entry/saved (-> @test-atom (get 2) first)))
               (is (= test-entry
                      (dissoc saved-msg :id :task :text :last_saved :vclock))))))))))

@@ -202,8 +202,8 @@
                        :message [:options/gen]
                        :timeout 5000}]
                      (-> @test-atom first)))
-              (is (= :cmd/schedule-new (-> @test-atom second first)))
-              (is (= :sync/imap (-> @test-atom (get 2) first)))
+              (is (= :sync/imap (-> @test-atom second first)))
+              (is (= :entry/saved (-> @test-atom (get 2) first)))
               (is (= updated-test-entry
                      (dissoc saved-msg :id :text :task :last_saved :vclock)))))


Rename function.

Rename function.

--- src/pubhouse/core.clj
+++ src/pubhouse/core.clj
@@ -6,22 +6,13 @@
             [hiccup.core :as hiccup]
             [me.raynes.fs :as fs]))

-(def ^:dynamic *site-map*
-  "This contain the hash created by recursively reading metadata from content files
-  in the build directory."
-
-  nil)
+(def ^:dynamic *site-map* nil)

 (def ^:dynamic site nil)

-(def ^:dynamic *meta-sep*
-  "The separator that splits each content file into meta and content sections."
-  "===")
+(def ^:dynamic *meta-sep*  "===")

-(def ^:dynamic *block-sep*
-  "Separator used in content files to denote line-oriented preprocessing
-  blocks."
-  "$$$")
+(def ^:dynamic *block-sep* "$$$")

 (def content-file? (complement fs/directory?))

@@ -37,8 +28,6 @@
 (defn page-record? [x] (and (coll? x) (contains? x :mod-time)))

 (defn build-file!
-  "Merge the hash from the meta-information lines of `file` with useful
-  file-system information, such as the path and url relative to the root."
   [file lines]
   [(mk-page-record file lines)
    (content-section lines)])
@@ -47,22 +36,17 @@
   [root-dir]
   (map-directory! build-file! content-file? root-dir))

-;; A site is our primary way of keeping track of content files as they
-;; change.
-
-(defn conj-site-map
+(defn add-page
   [site-map page-record]
   (assoc-in site-map
             (map keyword (fs/split (:path page-record)))
             page-record))

 (defn build-site-map!
-  "Creates a nested persistent map where the keys are filenames and directory
-  names, and entries are maps of the same type, or file records."
   [root-dir]
   (reset! *site-map*
           (let [root-part (first (fs/split root-dir))]
-            (get (reduce #(conj-site-map %1 (first %2))
+            (get (reduce #(add-page %1 (first %2))
                          {}
                          (build-files! root-dir))
                  (keyword root-part)))))
@@ -88,9 +72,6 @@
                          site-map))

 (defmulti render-file
-  "Takes as its first argument a map of the type returned by `build-file!`,
-  and as its second argument a lazy sequence of the lines of the corresponding
-  file. Should return a string which will be written to the output file."
   (comp fs/extension :path))

 (defmethod render-file ".md"
@@ -100,7 +81,7 @@
     [:head [:title (:title page-record)]]
     [:body (md-to-html-string (join "\n" content-lines))]]))

-(defn mk-output
+(defn build-path
   [root path]
   (clojure.java.io/as-file
    (str (join "/" (cons root (drop 2 (fs/split (strip-extension path)))))
@@ -114,7 +95,7 @@

 (defn compile-file!
   [site-map build-root [page-record lines]]
-  (let [output (mk-output build-root (:path page-record))]
+  (let [output (build-path build-root (:path page-record))]
     (with-parent-dir output
       (fn []
         (with-open [writer (clojure.java.io/writer output)]


output log in JSON format for graph generation

- not yet capturing server_time correctly
- log file is still hardcoded

… and yes, I'm hand-writing JSON. I want it to write out (streaming) as data is available rather than generating a big object in memory and I didn't feel like using Jackson for such simple JSON.

--- ws-client/src/main/clojure/ws/client/ws-client.clj
+++ ws-client/src/main/clojure/ws/client/ws-client.clj
@@ -16,9 +16,16 @@
   ([url num-threads]
     (println "Starting load test")
     ; response-log-agent: used for sending response logs to and serializing them to output
-    (let [response-log-agent (agent 0)]
-	    (with-open [log-writer (writer "/tmp/test2.txt")]
+    (let [response-log-agent (agent -1)]
+	    (with-open [log-writer (io/writer "/tmp/test2.txt")]
 	      (println "Log file opened")
+        ; hand write some JSON
+        (.write log-writer (str "{"))
+        (.write log-writer (str "\n\t\"request\" : \"" url "\","))
+        (.write log-writer (str "\n\t\"start_time\" : \"" (get-formatted-date (new java.util.Date)) "\","))
+        (.write log-writer (str "\n\t\"num_threads\" : " num-threads ","))
+        (.write log-writer (str "\n\t\"requests\" : [\n"))
+        ; start the load test and output logs into the JSON
 	      (http/with-connection-pool {:timeout 500 :threads 20 :insecure? false :default-per-route 20}
 	        (let [futures (doall (for [i (range num-threads)]
 	                             (future
@@ -28,9 +35,24 @@
 	          (doseq [f futures]
 	            ; wait for each future to complete
 	            (deref f))
-	          ; (println (deref f 900 #(future-cancel f))) ; this isn't working (returns function but doesn't execute it)
+	          ; (println (deref f 900 #(future-cancel f))) ; trying to have a timeout that cancels but this isn't working (returns function but doesn't execute it)
+           ; wait for all response-logs to be written
+           (await response-log-agent)
+           ; finish the JSON log file
+           (.write log-writer (str "]"))
+           (.write log-writer (str "\n\t\"end_time\" : \"" (get-formatted-date (new java.util.Date)) "\""))
+           (.write log-writer (str "\n}\n"))
 	          (println "Done load test.")))))))

+; run load test against default server with 2 threads
+(comment (run-load-test "http://localhost:8888/ws-java-servlet-blocking/testA" 2))
+
+; format dates like "Fri, 15 Feb 2013 15:13:41"
+(def date-format (new java.text.SimpleDateFormat "EEE, dd MMM yyyy HH:MM:SS"))
+
+(defn get-formatted-date
+  [date]
+  (.format date-format date))

 (defmacro duration-in-millis
   "Evaluates expr and records the time it took in millis.
@@ -46,13 +68,19 @@
    This function itself should not nothing blocking."
   [time-in-millis response-log-agent log-writer num-threads]
   (send-off response-log-agent (fn [count]
-              (.write log-writer (str "timestamp:" (System/currentTimeMillis) " threads: " num-threads " duration: " time-in-millis "\n"))
-              (if (= 10 count)
-                (do
-                  (.flush log-writer); flush writer every 10 log entries
-                  0) ; return 0 as the value to reset count
-                (inc count) ; increment the agent value as a counter
-              )
+              (let [prefix
+                    (if (= -1 count)
+                      ; first execution (only tabs)
+                      (do (inc count) "\t\t")
+                      ; all other executions (comma, newline and tabs)
+                      ",\n\t\t")]
+                (.write log-writer (str prefix "{\"timestamp\" : " (System/currentTimeMillis) ", \"total_time\" : " time-in-millis ", \"server_time\" : " time-in-millis "}"))
+                (if (= 10 count)
+                  (do
+                    (.flush log-writer); flush writer every 10 log entries
+                    0) ; return 0 as the value to reset count
+                  (inc count) ; increment the agent value as a counter
+                  ))
               )))

 (defn- send-requests


Fixing attempt to access to directory before checking user authorization and avoid dumps listing error

--- storm-core/src/clj/backtype/storm/daemon/logviewer.clj
+++ storm-core/src/clj/backtype/storm/daemon/logviewer.clj
@@ -950,6 +950,17 @@
       :headers {"Access-Control-Allow-Origin" origin
                 "Access-Control-Allow-Credentials" "true"})))

+(defn get-profiler-dump-files
+  [dir]
+  (filter (comp not nil?)
+        (for [f (.listFiles dir)]
+          (let [name (.getName f)]
+            (if (or
+                  (.endsWith name ".txt")
+                  (.endsWith name ".jfr")
+                  (.endsWith name ".bin"))
+              (.getName f))))))
+
 (defroutes log-routes
   (GET "/log" [:as req & m]
     (try
@@ -967,15 +978,30 @@
         (ring-response-from-exception ex))))
   (GET "/dumps/:topo-id/:host-port/:filename"
        [:as {:keys [servlet-request servlet-response log-root]} topo-id host-port filename &m]
-     (let [port (second (split host-port #":"))]
-       (-> (resp/response (File. (str log-root
-                                      file-path-separator
-                                      topo-id
-                                      file-path-separator
-                                      port
-                                      file-path-separator
-                                      filename)))
-           (resp/content-type "application/octet-stream"))))
+     (let [user (.getUserName http-creds-handler servlet-request)
+           port (second (split host-port #":"))
+           dir (File. (str log-root
+                           file-path-separator
+                           topo-id
+                           file-path-separator
+                           port))
+           file (File. (str log-root
+                            file-path-separator
+                            topo-id
+                            file-path-separator
+                            port
+                            file-path-separator
+                            filename))]
+       (if (and (.exists dir) (.exists file))
+         (if (or (blank? (*STORM-CONF* UI-FILTER))
+               (authorized-log-user? user
+                                     (str topo-id file-path-separator port file-path-separator "worker.log")
+                                     *STORM-CONF*))
+           (-> (resp/response file)
+               (resp/content-type "application/octet-stream"))
+           (unauthorized-user-html user))
+         (-> (resp/response "Page not found")
+           (resp/status 404)))))
   (GET "/dumps/:topo-id/:host-port"
        [:as {:keys [servlet-request servlet-response log-root]} topo-id host-port &m]
      (let [user (.getUserName http-creds-handler servlet-request)
@@ -984,18 +1010,12 @@
                            file-path-separator
                            topo-id
                            file-path-separator
-                           port))
-           files (filter (comp not nil?)
-                         (for [f (.listFiles dir)]
-                           (let [name (.getName f)]
-                             (if (or
-                                  (.endsWith name ".txt")
-                                  (.endsWith name ".jfr")
-                                  (.endsWith name ".bin"))
-                               (.getName f)))))]
+                           port))]
        (if (.exists dir)
          (if (or (blank? (*STORM-CONF* UI-FILTER))
-               (authorized-log-user? user "worker.log" *STORM-CONF*))
+               (authorized-log-user? user
+                                     (str topo-id file-path-separator port file-path-separator "worker.log")
+                                     *STORM-CONF*))
            (html4
              [:head
               [:title "File Dumps - Storm Log Viewer"]
@@ -1004,7 +1024,7 @@
               (include-css "/css/style.css")]
              [:body
               [:ul
-               (for [file files]
+               (for [file (get-profiler-dump-files dir)]
                  [:li
                   [:a {:href (str "/dumps/" topo-id "/" host-port "/" file)} file ]])]])
            (unauthorized-user-html user))


Correct barrel-radius docstring.

Correct barrel-radius docstring.

--- config.clj
+++ config.clj
@@ -6,9 +6,8 @@
   3.688)

 (def barrel-radius
-  "Outside radius of the barrel lantern in meters. Approximately 12.1 feet."
+  "Outside radius of the barrel lantern in meters. Approximately 4 inches."
   0.099)
-

 (def pixel-strip
   "Strip definition with pixel count and inter-pixel spacing."


implement allowed-wall-move?

implement allowed-wall-move?

--- src/quoridor/core.clj
+++ src/quoridor/core.clj
@@ -93,7 +93,12 @@
   [state move]
   (if (and (= (count move) 4)
            (not (contains? (state :walls) move)))
-    true
+    (let [normalised-move (normalise-wall-move move)
+          left-pos (subs normalised-move 0 2)
+          right-pos (subs normalised-move 2 4)]
+      (and (contains? (board/char-range \a \g) (first left-pos))
+           (contains? (board/char-range \1 \7) (second left-pos))
+           (= (right left-pos) right-pos)))
     false))

 (defn- black-won?


Grant group write access to the structured dir for periodicals

Fixes #20

--- src/mdr2/production.clj
+++ src/mdr2/production.clj
@@ -125,9 +125,16 @@
                (remove #{(path/recording-path production)}))]
     (nio/create-directories! dir)
     ;; make sure recording and recorded are group writable
-    (when (#{path/recorded-path path/recording-path path/split-path} dir)
-      (let [permissions (conj (nio/posix-file-permissions dir)
-                              (nio/posix-file-permission :group-write))]
+    (when (or (#{(path/recorded-path production)
+                 (path/recording-path production)
+                 (path/split-path production)} dir)
+              ;; FIXME: this is a temporary workaround. Until all
+              ;; narrators have been migrated to obi etext needs write
+              ;; access to the structured dir
+              (and (= (:production_type production) "periodical")
+                   (= (path/structured-path production) dir)))
+      (let [permissions (doto (nio/posix-file-permissions dir)
+                          (.add (nio/posix-file-permission :group-write)))]
         (nio/set-posix-file-permissions! dir permissions)))))

 (defn create!


add newlines to help text

add newlines to help text

--- src/riffmuse/core.clj
+++ src/riffmuse/core.clj
@@ -7,8 +7,8 @@
   (:gen-class :main true))

-(def ^:private help
-"riffmuse is a command-line tool that algorithmically generates notes within a given scale, hopefully inspiring you to create a riff using those notes.
+(def ^:private help "
+riffmuse is a command-line tool that algorithmically generates notes within a given scale, hopefully inspiring you to create a riff using those notes.

 Simply pass the scale you'd like your riff in as command-line arguments. Input is not case-sensitive, and can be abbreviated in a variety of ways.

@@ -37,7 +37,8 @@
     riffmuse random
     etc.

-Running 'riffmuse help' or 'riffmuse h' will display this help text.")
+Running 'riffmuse help' or 'riffmuse h' will display this help text.
+")

 (def ^:private scale-choices


Introducing the Named protocol

Introducing the Named protocol

--- src/app/javaparser.clj
+++ src/app/javaparser.clj
@@ -136,6 +136,19 @@
     (let [pn (.getParentNode this)]
       (packageName pn))))

+(defprotocol Named
+  (getName [this]))
+
+(extend-protocol Named
+  TypeDeclaration
+  (getName [this]
+    (.getName this)))
+
+(extend-protocol Named
+  SingleFieldDeclaration
+  (getName [this]
+    (getName (.getId (.variable this)))))
+
 (defn getName [el]
   (if
     (map? el)


improve comment

improve comment

--- src/babel/workbook.clj
+++ src/babel/workbook.clj
@@ -194,7 +194,8 @@
                         :sem {:pred :be
                               :subj {:pred :I}}}}
               @fr/small)
-    ;; needed to avoid
+
+    ;; the below is needed to avoid:
     ;;INFO  56:12,470 com.mchange.v2.c3p0.C3P0Registry:
     ;; jdk1.5 management interfaces unavailable... JMX support disabled.
     ;; java.security.AccessControlException: access denied


Canceled runs can "Rerun failed jobs" too

This actually reruns failed *and canceled* jobs. Clarifying the copy will be a
future card; this is a quick fix to expose functionality the backend already
supports because a customer has asked for it.

(Also, renaming `rerunnable-from-start-statuses` to
`rerunnable-from-failed-statuses`, because the name appears to have been
incorrect.)

--- src-cljs/frontend/components/pieces/run_row.cljs
+++ src-cljs/frontend/components/pieces/run_row.cljs
@@ -42,7 +42,7 @@
                                      :run-status/failed
                                      :run-status/canceled})

-(def ^:private rerunnable-from-start-statuses #{:run-status/failed})
+(def ^:private rerunnable-from-failed-statuses #{:run-status/failed :run-status/canceled})

 (defui PRs
   Object
@@ -220,7 +220,7 @@
                   [:span "Rerun"]
                   [:i.fa.fa-chevron-down.dropdown-toggle {:data-toggle "dropdown"}]
                   [:ul.dropdown-menu.pull-right
-                   (when (rerunnable-from-start-statuses status)
+                   (when (rerunnable-from-failed-statuses status)
                      [:li
                       [:a
                        {:on-click (fn [_event]


Update equalize function to work with special numbers

- Double/NaN
- Double/POSITIVE_INFINITY
- Double/NEGATIVE_INFINITY

--- test/transit/verify.clj
+++ test/transit/verify.clj
@@ -144,10 +144,29 @@
       (throw (ex-info "Response timeout" {:status :timeout}))
       result)))

+(defn special-number? [node]
+  (and (number? node)
+       (or (.equals node Double/NaN)
+           (.equals node Double/POSITIVE_INFINITY)
+           (.equals node Double/NEGATIVE_INFINITY))))
+
+(def special-number-symbols
+  {:NaN (gensym)
+   :Infinity (gensym)
+   :-Infinity (gensym)})
+
+(defn replace-special-number [number]
+  (special-number-symbols
+   (cond (.equals number Double/NaN) :Nan
+         (.equals number Double/POSITIVE_INFINITY) :Infinity
+         (.equals number Double/NEGATIVE_INFINITY) :-Infinity)))
+
 (defn equalize [data]
   (walk/prewalk (fn [node]
                   (cond (and (number? node)
-                             (not (ratio? node)))             (.stripTrailingZeros (bigdec node))
+                             (not (ratio? node))
+                             (not (special-number? node)))    (.stripTrailingZeros (bigdec node))
+                        (special-number? node)                (replace-special-number node)
                         (instance? java.util.Map$Entry node)  node
                         (sequential? node)                    (seq node)
                         (instance? Character node)            (str node)


Adds support for db-name in plugin

Adds support for db-name in plugin

--- src/onyx/plugin/sql.clj
+++ src/onyx/plugin/sql.clj
@@ -18,7 +18,7 @@
   {:datasource
    (doto (ComboPooledDataSource.)
      (.setDriverClass (:classname spec))
-     (.setJdbcUrl (str "jdbc:" (:subprotocol spec) ":" (:subname spec)))
+     (.setJdbcUrl (str "jdbc:" (:subprotocol spec) ":" (:subname spec) "/" (:db-name spec)))
      (.setUser (:user spec))
      (.setPassword (:password spec))
      (.setMaxIdleTimeExcessConnections (* 30 60))
@@ -29,7 +29,8 @@
                  :subprotocol (:sql/subprotocol task-map)
                  :subname (:sql/subname task-map)
                  :user (:sql/user task-map)
-                 :password (:sql/password task-map)}]
+                 :password (:sql/password task-map)
+                 :db-name (:sql/db-name task-map)}]
     (create-pool db-spec)))

 ; (defn partition-table-by-uuid [{:keys [onyx.core/task-map sql/pool] :as event}]


CMR-8282: Fixed typo.

CMR-8282: Fixed typo.

--- ingest-app/src/cmr/ingest/api/subscriptions.clj
+++ ingest-app/src/cmr/ingest/api/subscriptions.clj
@@ -233,7 +233,7 @@
              user-id))))

 (defn- validate-native-id-not-blank
-  "Valiate the given native-id is not blank. Raise error if it is."
+  "Validate the given native-id is not blank. Raise error if it is."
   [native-id]
   (when (string/blank? native-id)
     (errors/throw-service-error


fix namespace reference

fix namespace reference

--- src/bract/core/dev.clj
+++ src/bract/core/dev.clj
@@ -10,7 +10,7 @@
 (ns bract.core.dev
   "Development and test support."
   (:require
-    [bract.core.config  :as config]
+    [bract.core.keydef  :as kdef]
     [bract.core.echo    :as echo]
     [bract.core.inducer :as inducer]
     [bract.core.util    :as util])
@@ -61,8 +61,8 @@
 ;; ----- default -----

-(def default-root-context {(key config/ctx-config-files) ["config/config.dev.edn"]
-                           (key config/ctx-launch?)      false})
+(def default-root-context {(key kdef/ctx-config-files) ["kdef/config.dev.edn"]
+                           (key kdef/ctx-launch?)      false})

 (def default-root-inducers [inducer/set-verbosity
@@ -126,7 +126,7 @@
   (util/expected map? "app-context to be initialized as map using inducer bract.core.dev/record-context!" app-context)
   (echo/with-latency-capture "Launching application"
     (-> app-context
-      (assoc (key config/ctx-launch?) true)
+      (assoc (key kdef/ctx-launch?) true)
       inducer/invoke-launcher
       record-context!)))


Fixed crash nut found problem with knowledge update

--- src/skat/gameplay.clj
+++ src/skat/gameplay.clj
@@ -77,9 +77,10 @@
                                 middle (if (= middle player) cards [])
                                 rear   (if (= rear   player) cards []) }
                               { front #{}, middle #{}, rear #{} }))
-          (out-of-cards? [player-knowledge]
-            (some #(-> % :cards-owned blank?) player-knowledge))
-          (game-finished? [knowledge] (out-of-cards? (vals knowledge)))]
+          (get-cards-owned [{ :keys [:self :cards-owned] }]
+            (get cards-owned self))
+          (game-finished? [knowledge]
+            (some #(-> % get-cards-owned empty?) knowledge))]
     (let [initial-knowledge { front  (initial-knowledge-for front  f-cards)
                               middle (initial-knowledge-for middle m-cards)
                               rear   (initial-knowledge-for rear   r-cards) }


Split out prog-base.

Split out prog-base.

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -13,23 +13,18 @@
             [cbfg.world.lane]
             [cbfg.world.base :refer [world-cmd-loop]]))

-;; TODO: How to assign locations to world entities before rendering?
+(def prog-base (atom {})) ; { :world => world-actx
+                          ;   :net-listen-ch => ch
+                          ;   :net-connect-ch => ch
+                          ;   :res-ch => ch }

 (def prog-history
   (atom {:snapshots {0 {}
                      10 {:a 1 :b 2 :c 3 :d 4}
                      20 {:a 11 :b 22 :c 33 :d 44}}
-         :prog-world {} ; { :world => world-actx
-                        ;   :net-listen-ch => ch
-                        ;   :net-connect-ch => ch
-                        ;   :servers => { server-addr => ports }
-                        ;   :clients => { client-addr => client-info }
-                        ;   :res-ch => ch }
-         :prog-events [[0 :snapshot]
-                       [1 :event [:a 1]]
-                       [2 :event [:b 2]]
-                       [3 :event [:c 3]]
-                       [4 :event [:d 4]]]}))
+         :prog-peers {:servers {}  ; { server-addr => ports }
+                      :clients {}} ; { client-addr => client-info }
+         :prog-events []}))

 (def run-world       (atom {:a 10}))
 (def run-world-hover (atom nil))
@@ -56,6 +51,7 @@
            (fn [[last-snapshot-ts res] [ts kind args]]
              (if (= kind :snapshot)
                [ts (conj res
+
                          (dom/li #js {:className "snapshot"
                                       :onMouseEnter #(on-event-focus ts nil)
                                       :onMouseLeave #(on-event-blur ts nil)}
@@ -74,7 +70,7 @@
   (apply dom/select #js {:id "client"}
          (map (fn [client-addr]
                 (dom/option #js {:value client-addr} (str client-addr)))
-              (keys (:clients (:prog-world app))))))
+              (keys (:clients (:prog-peers app))))))

 (defn init-roots []
   (om/root render-world run-world
@@ -123,20 +119,16 @@
                   :gen-id gen-id})
             delayed-event-cb (fn [vis-next]
                                (println :on-delayed-event-cb @last-id))]
-        (swap! prog-history
-               #(assoc % :prog-world
-                       {:world world
-                        :net-listen-ch (achan-buf world 10)
-                        :net-connect-ch (achan-buf world 10)
-                        :servers {}
-                        :clients {}
-                        :res-ch (achan-buf world 10)}))
+        (reset! prog-base {:world world
+                           :net-listen-ch (achan-buf world 10)
+                           :net-connect-ch (achan-buf world 10)
+                           :res-ch (achan-buf world 10)})
         (cbfg.vis/process-events vis event-delay cbfg.vis/vis-event-handlers
                                  event-ch step-ch event-run-ch)
         (cbfg.vis/process-render el-prefix world event-run-ch delayed-event-cb)
         (make-net world
-                  (:net-listen-ch (:prog-world @prog-history))
-                  (:net-connect-ch (:prog-world @prog-history)))
+                  (:net-listen-ch @prog-base)
+                  (:net-connect-ch @prog-base))
         (let [vis-chs {}
               req-ch (achan world)
               cmd-ch (map< (fn [ev] {:op (.-id (.-target ev))
@@ -155,16 +147,17 @@
               prog-js (str "with (cbfg.world.t1) {" prog "}")
               prog-res (try (js/eval prog-js) (catch js/Object ex ex))]
           (world-cmd-loop world cbfg.world.lane/cmd-handlers cmd-ch
-                          req-ch (:res-ch (:prog-world @prog-history))
+                          req-ch (:res-ch @prog-base)
                           vis-chs world-vis-init el-prefix)
           (act-loop cmd-dispatch-loop world [num-dispatches 0]
                     (when-let [msg (atake cmd-dispatch-loop req-ch)]
                       (when-let [client-req-ch
                                  (get-in @prog-history
-                                         [:prog-world :clients (:client msg) :req-ch])]
+                                         [:prog-peers :clients (:client msg) :req-ch])]
                         (aput cmd-dispatch-loop client-req-ch msg))
                       (recur (inc num-dispatches))))
           (println :prog-res prog-res)
+          (println :prog-history prog-history)
           (go-loop [] ; Process expand/collapse UI events.
             (let [actx-id (cbfg.vis/no-prefix (.-id (.-target (<! expand-ch))))]
               (doseq [[actx actx-info] (:actxs @vis)]
@@ -192,36 +185,34 @@
 ; --------------------------------------------

 (defn kv-server [server-addr & ports]
-  (let [prog-world (:prog-world @prog-history)
-        world (:world prog-world)
+  (let [world (:world @prog-base)
         done (atom false)]
     (act server-init world
          (doseq [port ports]
            (when-let [listen-result-ch (achan server-init)]
-             (aput server-init (:net-listen-ch prog-world)
+             (aput server-init (:net-listen-ch @prog-base)
                    [server-addr port listen-result-ch])
              (when-let [[accept-ch close-accept-ch] (atake server-init listen-result-ch)]
                (cbfg.world.net/server-accept-loop world accept-ch close-accept-ch)
                (swap! prog-history
-                      #(let [ph (update-in % [:prog-world :servers server-addr]
+                      #(let [ph (update-in % [:prog-peers :servers server-addr]
                                            conj port)]
                          (update-in ph [:prog-events] conj
                                     [(count (:prog-events ph))
                                      :event
-                                     (:prog-world ph)]))))))
+                                     (:prog-peers ph)]))))))
          (reset! done true))
     (wait-done done)))

 (defn kv-client [client-addr server-addr server-port]
-  (let [prog-world (:prog-world @prog-history)
-        world (:world prog-world)
+  (let [world (:world @prog-base)
         done (atom false)]
     (act client-init world
-         (let [req-ch (cbfg.world.net/client-loop world (:net-connect-ch prog-world)
+         (let [req-ch (cbfg.world.net/client-loop world (:net-connect-ch @prog-base)
                                                   server-addr server-port
-                                                  client-addr (:res-ch prog-world))]
+                                                  client-addr (:res-ch @prog-base))]
            (swap! prog-history
-                  #(let [ph (assoc-in % [:prog-world :clients client-addr]
+                  #(let [ph (assoc-in % [:prog-peers :clients client-addr]
                                       {:client-addr client-addr
                                        :server-addr server-addr
                                        :server-port server-port
@@ -229,6 +220,6 @@
                      (update-in ph [:prog-events] conj
                                 [(count (:prog-events ph))
                                  :event
-                                 (:prog-world ph)]))))
+                                 (:prog-peers ph)]))))
            (reset! done true))
     (wait-done done)))


Got lane-close working in t2.

Got lane-close working in t2.

--- src/cbfg/world/t2.cljs
+++ src/cbfg/world/t2.cljs
@@ -123,7 +123,7 @@
    "add" cbfg.world.base/example-add
    "sub" cbfg.world.base/example-add
    "count" cbfg.world.base/example-count
-   "lane-close" cbfg.world.base/lane-close ; TODO!
+   "lane-close" #(println "NEVER REACHED")
    "lane-state" #(msg-req %1 :lane-state-ch %2)})

 (defn rq-handler [actx m] ((get rq-handlers (:op m)) actx m))
@@ -132,7 +132,8 @@

 (defn cmd-handler [c] (assoc c :rq rq-handler))

-(def cmd-handlers (into {} (map (fn [k] [k cmd-handler]) (keys rq-handlers))))
+(def cmd-handlers (merge (into {} (map (fn [k] [k cmd-handler]) (keys rq-handlers)))
+                         {"lane-close" #(assoc % :rq rq-handler :op :lane-close)}))

 (defn ev-msg [ev]
   (assoc (cbfg.world.t1/ev-msg ev)


Fix test explanation.

Fix test explanation.

--- test/open_company/unit/resources/stakeholder_update/distinct_updates.clj
+++ test/open_company/unit/resources/stakeholder_update/distinct_updates.clj
@@ -47,7 +47,7 @@

   (facts "and de-duplication"

-    (facts "because there is the same title, author, and within a day"
+    (facts "because there is the same title and author within a day"
       (let [two-updates [(update-for {}) (update-for {:created-at (ago (t/hours 1))})]]
         ; 2 -> 1 distinct
         (su/distinct-updates two-updates) => [(first (in-order two-updates))])


clojure added multiple contracts

clojure added multiple contracts

--- src/clj/ibclj/core.clj
+++ src/clj/ibclj/core.clj
@@ -4,7 +4,7 @@
              :refer [>! <! >!! <!! go chan buffer close! thread
                      alts! alts!! timeout go-loop]])
   [:import com.ib.controller.ApiController
-           (com.ib.controller ApiController$TopMktDataAdapter)
+           (com.ib.controller ApiController$TopMktDataAdapter NewContract)
            ])

@@ -20,10 +20,10 @@

     ))

-(defn create-contract [symbol]
+(defn create-contract [symbol type]
   (doto (com.ib.controller.NewContract.)
     (.symbol symbol)
-    (.secType com.ib.controller.Types$SecType/STK)
+    (.secType type)
     (.expiry "")
     (.strike 0.0)
     (.right com.ib.controller.Types$Right/None)
@@ -43,41 +43,58 @@
                                         ))))

-(defn create-row [c]
+(defn create-row [c ^NewContract contract]
   (reify
     com.ib.controller.ApiController$ITopMktDataHandler
     (tickPrice [this tick-type p auto-execute?]
       ;(println (.name tick-type) "price: " p)
-      (>!! c [(.name tick-type) p])
+      (>!! c [(.symbol contract) (.name tick-type) p])
       )
     (tickSize [this tick-type size]
       ;(println (.name tick-type) "size: " size)
-      (>!! c [(.name tick-type) size])
+      (>!! c [(.symbol contract) (.name tick-type) size])
       )
     (tickString [this tick-type val]
       ;(println (.name tick-type) "LastTime: " val)
-      (>!! c [(.name tick-type) val])
+      (>!! c [(.symbol contract) (.name tick-type) val])
       )
     (marketDataType [this data-type]
       (println "Frozen? " (= data-type com.ib.controller.Types$MktDataType/Frozen)))
     (tickSnapshotEnd [this] (println "tick snapshot end"))
     ))

+(defn contract-ctx [c sym type]
+  (let [contract (create-contract sym type)
+        row (create-row c contract)]
+    {:contract contract :sym sym :type type :row row}
+    ))
+
+(defn subscribe! [api ctx c]
+  (.reqTopMktData api (:contract ctx) "" false (:row ctx)))
+
+(defn unsubscribe! [api ctx]
+  (.cancelTopMktData api (:row ctx)))

 (defn start []
   (let [api (api-ctrl)
-        contract (create-contract "VXX")
         c (chan)
-        row (create-row c)]
+        vxx-ctx (contract-ctx c "VXX" com.ib.controller.Types$SecType/STK)
+        spy-ctx (contract-ctx c "SPY" com.ib.controller.Types$SecType/STK)
+]
     (.connect api "localhost" 7497 5)
-    (.reqTopMktData api contract "" false row)
+
+    (subscribe! api vxx-ctx c)
+    (subscribe! api spy-ctx c)

     (go-loop []
              (println (<! c))
              (recur))

     (Thread/sleep 100000)
-    (.cancelTopMktData api row)
+
+    (unsubscribe! api vxx-ctx)
+    (unsubscribe! api spy-ctx)
+
     (.disconnect api)))

@@ -85,3 +102,6 @@
   "the main function"
   []
   (start))
+
+
+(start)


Refactor random-plush-instruction-map

Refactor random-plush-instruction-map

--- src/clojush/random.clj
+++ src/clojush/random.clj
@@ -52,9 +52,8 @@
                                            close-parens-probabilities [0.772 0.206 0.021 0.001]
                                            silent-instruction-probability 0}}]
    (let [markers (concat epigenetic-markers
-                         (if random-insertion
-                           [:instruction :random-insertion]
-                           [:instruction]))]
+                         [:instruction]
+                         (if random-insertion [:random-insertion]))]
      (zipmap markers
              (map (fn [marker]
                     (case marker


Add a docstring for embedded.clj

Add a docstring for embedded.clj

--- src/clojure/clojurewerkz/cassaforte/embedded.clj
+++ src/clojure/clojurewerkz/cassaforte/embedded.clj
@@ -1,7 +1,12 @@
 (ns clojurewerkz.cassaforte.embedded
   "Provides facility functions for working with an embedded Cassandra server, which is very useful
    for testing your application without having a C* cluster running and for cases when application
-   requires Standalone Cassandra without additional installation."
+   requires Standalone Cassandra without additional installation.
+
+   In order to work with an embedded cluster, you'll have to have `cassandra-all` dependency in your
+   project.clj, for example:
+
+      [org.apache.cassandra/cassandra-all \"2.0.2\"]"
   (:require [clojure.java.io :as io])
   (:import [org.apache.cassandra.service CassandraDaemon]
            [org.apache.cassandra.config DatabaseDescriptor]))


Have bandage increase hp.

Have bandage increase hp.

--- src/robinson/update.clj
+++ src/robinson/update.clj
@@ -495,6 +495,14 @@
         new-state)
         state)))

+(defn apply-bandage
+  [state]
+  (-> state
+    (dec-item-count :bandage)
+    (assoc-in [:world :player :hp] (get-in state [:world :player :max-hp]))
+    (assoc-in [:world :current-state] :normal)
+    (append-log "You apply the bandage.")))
+
 (defn assoc-apply-item
   [state item]
   (assoc-in state [:world :apply-item] item))
@@ -513,6 +521,8 @@
           (assoc-apply-item item)
           ((fn [state]
             (cond
+              (= id :bandage)
+                (apply-bandage state)
               (= id :match)
                 (-> state
                   (assoc-current-state :apply-item-normal)


Fix reflection warnings

Fix reflection warnings

--- ring-core/src/ring/core/protocols.clj
+++ ring-core/src/ring/core/protocols.clj
@@ -1,6 +1,7 @@
 (ns ring.core.protocols
   "Protocols necessary for Ring."
   {:added "1.6"}
+  (:import [java.io Writer OutputStream])
   (:require [clojure.java.io :as io]
             [ring.util.response :as response]))

@@ -10,7 +11,7 @@
     "Write a value representing a response body to an output stream. The stream
     will be closed after the value had been written."))

-(defn- response-writer [response output-stream]
+(defn- ^Writer response-writer [response output-stream]
   (if-let [charset (response/get-charset response)]
     (io/writer output-stream :encoding charset)
     (io/writer output-stream)))
@@ -26,11 +27,11 @@
       (doseq [chunk body]
         (.write writer (str chunk)))))
   java.io.InputStream
-  (write-body-to-stream [body _ output-stream]
+  (write-body-to-stream [body _ ^OutputStream output-stream]
     (with-open [out output-stream, body body]
       (io/copy body out)))
   java.io.File
-  (write-body-to-stream [body _ output-stream]
+  (write-body-to-stream [body _ ^OutputStream output-stream]
     (with-open [out output-stream]
       (io/copy body out)))
   nil


Updating version to v1.62.5-SNAPSHOT

Updating version to v1.62.5-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.62.4"
+(defproject cook "1.62.5-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.10.3"]


Bumps version to 1.53.7-SNAPSHOT

Bumps version to 1.53.7-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.53.6"
+(defproject cook "1.53.7-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Updating version for v1.61.3-SNAPSHOT

Updating version for v1.61.3-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.61.2"
+(defproject cook "1.61.3-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.10.3"]


Broke it

Broke it

--- go-fighweel/src/cloj/core.cljc
+++ go-fighweel/src/cloj/core.cljc
@@ -7,21 +7,32 @@
     [cloj.protocols.system    :as sys-p]
     [cloj.protocols.window    :as win-p]
     [cloj.protocols.resources :as res-p]
+
     [cloj.protocols.render    :as rend-p :refer [clear!
                                                  box!]]
     [cloj.protocols.keyboard  :as key-p]))

-(def quit? (atom false))
-
-(def tm (atom 0.0))
-
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (defn funny-col [t]
   [(cos-01 t)
    (cos-01 (* t 3.1))
    (cos-01 (* t (cos-01 (* t 2))))
    1.0 ])

-(def quit-keys [:key-escape :key-q])
+(defn draw-frame [r t]
+  (do
+    (clear! r (funny-col t))
+    (box! r (v2 10 10) (v2 100 100) [0 0 0 1])))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defprotocol IGameKeys
+  (update! [_])
+  (quit? [_])
+  (up? [_])
+  (down? [_])
+  (left? [_])
+  (right? [_])
+  (fire? [_]))

 (defn any-keys-pressed? [keypfn ks]
   (->
@@ -29,17 +40,41 @@
       (or r (keypfn v)))
     (reduce false ks)))

-(defn any-quit-keys-pressed? [keypfn] (any-keys-pressed? keypfn quit-keys))
+(defn mk-game-keys [keyb key-defs]
+  (let [any-pressed? (fn [kk]
+                       (any-keys-pressed?
+                         (:state #(key-p/get-key-state keyb %))
+                         (kk key-defs)))]

-(defn draw-frame [r t]
-  (do
-    (clear! r (funny-col t))
-    (box! r (v2 10 10) (v2 100 100) [0 0 0 1])))
+    (reify
+      IGameKeys
+      (update![_] (key-p/update! keyb))
+      (quit?  [_] (any-pressed? :quit))
+      (up?    [_] (any-pressed? :up))
+      (down?  [_] (any-pressed? :down))
+      (left?  [_] (any-pressed? :left))
+      (right? [_] (any-pressed? :right))
+      (fire?  [_] (any-pressed? :fire))
+      ))
+  )
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

+(def key-defs
+  {:quit  [:key-esc :key-q]
+   :up    [:key-up :key-k]
+   :down  [:key-down :key-j]
+   :left  [:key-left :key-h]
+   :right [:key-right :key-l]
+   :fire  [:key-space] })
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (defn main [sys]
   (let [window (sys-p/get-window sys)
-        keyb   (sys-p/get-keyboard sys)
-        key-pressed? #(:state (key-p/get-key-state keyb %))
+
+        gkeys (->
+                (sys-p/get-keyboard sys)
+                (mk-game-keys key-defs))
+
         r (sys-p/get-render-engine sys)]

     (do
@@ -48,10 +83,13 @@
       (try
         (loop [t 0]
           (do
-            (key-p/update! keyb)
+            (update! gkeys)
+
             (win-p/update! window)
+
             (draw-frame r t)
-            (when-not (any-quit-keys-pressed? key-pressed?)
+
+            (when-not (quit? gkeys)
               (recur (+ t (/ 1 60))))))

         (catch Exception e


UserDomain, AdminDomain's Contact

UserDomain, AdminDomain's Contact

--- configuration/xml-input-extent.clj
+++ configuration/xml-input-extent.clj
@@ -27,117 +27,31 @@
                 (mapping [:Place-attribute] :Place)
                 (mapping [:Address-attribute] :Address)))

+(for [:glue:Domains :AdminDomain :Contact]
+  (add-instance :Contact
+                (mapping [:Distributed :Distributed-text-node] :Distributed)
+                (mapping [:Owner :Owner-text-node] :Owner)
+                (mapping [:WWW :WWW-text-node] :WWW)
+                (mapping [:Description :Description-text-node] :Description)
+                (mapping [:LocalID :LocalID-text-node :ID] :ID)
+                (mapping [:Name :Name-text-node] :Name)
+                (mapping [:OtherInfo :OtherInfo-text-node] :OtherInfo)
+                (mapping [:Latitude-attribute] :Latitude)
+                (mapping [:Longitude-attribute] :Longitude)
+                (mapping [:PostCode-attribute] :PostCode)
+                (mapping [:Country-attribute] :Country)
+                (mapping [:CreationTime-attribute] :CreationTime)
+                (mapping [:Validity-attribute] :Validity)))

+(for [:glue:Domains :UserDomain]
+  (add-instance :UserDomain (mapping [:Distributed :Distributed-text-node] :Distributed)
+                (mapping [:Owner :Owner-text-node] :Owner)
+                (mapping [:WWW :WWW-text-node] :WWW)
+                (mapping [:Description :Description-text-node] :Description)
+                (mapping [:ID :ID-text-node :ID] :ID)
+                (mapping [:Name :Name-text-node] :Name)
+                (mapping [:OtherInfo :OtherInfo-text-node] :OtherInfo)
+                (mapping [:Level-text-node] :Level)
+                (mapping [:UserManager-text-node] :UserManager)
+                (mapping [:Member-text-node] :Member)))

-;(class :Extension
-;       (attributes
-;         :LocalID
-;         :Key
-;         :Value))
-;
-;(class :Entity
-;       (attributes
-;         :ID
-;         :Validity
-;         :CreationTime
-;         :OtherInfo
-;         :Name))
-;
-;(class :Domain
-;       (attributes
-;         :WWW
-;         :Description)
-;       (extends :Entity))
-;
-;(class :Share
-;       (attributes
-;         :Description)
-;       (extends :Entity))
-;
-;(class :Service
-;       (attributes
-;         :StatusInfo
-;         :QualityLevel
-;         :Capability
-;         :Type
-;         :Complexity)
-;       (extends :Entity))
-;
-;(class :Location
-;       (attributes
-;         :Latitude
-;         :Longitude
-;         :PostCode
-;         :Country
-;         :Place
-;         :Address)
-;       (extends :Entity))
-;
-;(class :AdminDomain
-;       (attributes
-;         :Distributed
-;         :Owner)
-;       (extends :Domain))
-;
-;(class :UserDomain
-;       (attributes
-;         :Member
-;         :UserManager
-;         :Level)
-;       (extends :Domain))
-;
-;(class :Contact
-;       (attributes
-;         :Type
-;         :Detail)
-;       (extends :Entity))
-;
-;(class :Manager
-;       (attributes
-;         :ProductVersion
-;         :ProductName)
-;       (extends :Entity))
-;
-;(class :Resource
-;       (extends :Entity))
-;
-;(class :Endpoint
-;       (attributes
-;         :StartTime
-;         :HealthStateInfo
-;         :SupportedProfile
-;         :InterfaceVersion
-;         :InterfaceExtension
-;         :HealthState
-;         :URL
-;         :DowntimeAnnounce
-;         :QualityLevel
-;         :IssuerCA
-;         :DowntimeStart
-;         :DowntimeInfo
-;         :WSDL
-;         :ServingState
-;         :Implementor
-;         :Semantics
-;         :Technology
-;         :Capability
-;         :ImplementationName
-;         :ImplementationVersion
-;         :DowntimeEnd
-;         :TrustedCA)
-;       (extends :Entity))
-;
-;(class :Activity
-;       (extends :Entity))
-;
-;(class :Policy
-;       (attributes
-;         :Rule
-;         :Scheme)
-;       (extends :Entity))
-;
-;(class :AccessPolicy
-;       (extends :Policy))
-;
-;(class :MappingPolicy
-;       (extends :Policy))


Supports a default k8s pool (#1788)

Supports a default k8s pool (#1788)

* Supports a default k8s pool

* Update api.clj

--- scheduler/src/cook/kubernetes/api.clj
+++ scheduler/src/cook/kubernetes/api.clj
@@ -4,9 +4,9 @@
             [clojure.string :as str]
             [clojure.tools.logging :as log]
             [clojure.walk :as walk]
+            [cook.cached-queries :as cached-queries]
             [cook.config :as config]
             [cook.kubernetes.metrics :as metrics]
-            [cook.pool :as pool]
             [cook.regexp-tools :as regexp-tools]
             [cook.scheduler.constraints :as constraints]
             [cook.task :as task]
@@ -841,7 +841,7 @@
         {:keys [docker volumes]} container
         {:keys [image parameters port-mapping]} docker
         {:keys [environment]} command
-        pool-name (some-> job :job/pool :pool/name)
+        pool-name (cached-queries/job->pool-name job)
         ; gpu count is not stored in scalar-requests because Fenzo does not handle gpus in binpacking
         gpus (or (:gpus resources) 0)
         gpu-model-requested (constraints/job->gpu-model-requested gpus job pool-name)
@@ -899,7 +899,7 @@
         progress-env (task/build-executor-environment job)
         checkpoint-env (checkpoint->env checkpoint)
         metadata-env {"COOK_COMPUTE_CLUSTER_NAME" compute-cluster-name
-                      "COOK_POOL" (pool/pool-name-or-default pool-name)
+                      "COOK_POOL" pool-name
                       "COOK_SCHEDULER_REST_URL" (config/scheduler-rest-url)}
         main-env-base (merge environment params-env progress-env sandbox-env checkpoint-env metadata-env)
         progress-file-var (get main-env-base task/progress-meta-env-name task/default-progress-env-name)
@@ -1062,16 +1062,10 @@
     (.setRestartPolicy pod-spec "Never")

     (.addTolerationsItem pod-spec toleration-for-deletion-candidate-of-autoscaler)
-    ; TODO:
-    ; This will need to change to allow for setting the toleration
-    ; for the default pool when the pool was not specified by the
-    ; user. For the time being, this isn't a problem only if / when
-    ; the default pool is not being fed offers from Kubernetes.
-    (when pool-name
-      (.addTolerationsItem pod-spec (toleration-for-pool cook-pool-taint-name cook-pool-taint-prefix pool-name))
-      ; We need to make sure synthetic pods --- which don't have a hostname set --- have a node selector
-      ; to run only in nodes labelled with the appropriate cook pool
-      (when-not hostname (add-node-selector pod-spec cook-pool-label-name pool-name)))
+    (.addTolerationsItem pod-spec (toleration-for-pool cook-pool-taint-name cook-pool-taint-prefix pool-name))
+    ; We need to make sure synthetic pods --- which don't have a hostname set --- have a node selector
+    ; to run only in nodes labelled with the appropriate cook pool
+    (when-not hostname (add-node-selector pod-spec cook-pool-label-name pool-name))

     (when pod-constraints
       (doseq [{:keys [constraint/attribute


UCT seems to work

UCT seems to work

--- src/ulam/connect4.clj
+++ src/ulam/connect4.clj
@@ -22,7 +22,7 @@

 (defn valid-moves [state]
   (filter identity (map (partial highest-column (concat (:p1 state) (:p2 state)))
-        cols)))
+                        cols)))

 (valid-moves (init))

@@ -85,8 +85,7 @@
            :score 0
            :moves #{}
            :children {:move
-                       {:visited 0 :score 0 :children {}}
-                       }})
+                       {:visited 0 :score 0 :children {}}}})

 (defn uct [node parent-visits]
   (+ (/ (:score node)
@@ -101,8 +100,6 @@
       (update-in (concat (interleave (repeat :children) path) [:visited]) inc)
       (update-in (concat (interleave (repeat :children) path) [:score]) #(+ % result))))

-
-
 (defn backprop [root path result]
   (if-not (empty? path)
     (recur (update-node root path result)
@@ -111,34 +108,56 @@
     (update-node root [] result)))

 (backprop {:visited 0 :score 0 :children {0 {:visited 0 :score 0}}}
-             [0]
-             15)
+          [0]
+          15)

+(defn traverse [node path]
+  (if (empty? path)
+    node
+    (recur (get (:children node) (first path))
+           (rest path))))

+(defn best-child [node]
+  (last (sort-by #(uct (second %) (:visited node)) (:children node))))

-(defn process [mtcs node]
-  (if-not (empty? (:unvisited node))
-    (let [move (rand-nth (vec (:unvisited node)))
-          new-node (add-node move (perform-move (:state node) move))
-          result (simulate-step (perform-move (:state node) move))
-          ]
-      (recur (-> mtcs
-                 (update-in [:unvisited] disj move)
-                 (assoc-in [:children move] new-node)
-                 (backprop [move] result)
-               ) mtcs))
-    (map #(uct % (:visited node))
-         (vals (:children node)))))
+(def a [1 2 3])
+(first a)
+(first (concat a [:b]))
+(concat a [:b])

-(let [root (add-node :root (init))]
-  (process root root))
-
-(defn simulate-step [state]
+(defn simulate-game [state]
   (cond (check-win (:p1 state)) 1
         (check-win (:p2 state)) -1
         (empty? (valid-moves state)) 0
         :else (let [move (rand-nth (valid-moves state))]
                 (recur (perform-move state move)))))
+
+(defn process [mtcs path]
+  (if false #_(> (:visited mtcs) 10000)
+    (best-child mtcs)
+    (let [node (traverse mtcs path)
+          child-path (interleave (repeat :children) path)]
+      (cond (not (empty? (:unvisited node)))
+            (let [move (rand-nth (seq (:unvisited node)))
+                  new-state (perform-move (:state node) move)
+                  new-node (add-node move new-state)
+                  result (simulate-game new-state)]
+              (recur (-> mtcs
+                         (update-in (concat child-path [:unvisited]) disj move)
+                         (assoc-in (concat child-path [:children move]) new-node)
+                         (backprop (concat path [move]) result)
+                         ) []))
+
+            (empty? (:children node))
+            (println "terminal")
+            :else (let [[child-n _] (best-child node)]
+                    (recur mtcs (conj path child-n)))))))
+
+(loop [root (add-node :root (init))]
+  (println (process root []))
+  #_(recur root))
+
+

 (defn simulate [state]
   (let [valids (valid-moves state)]
@@ -149,7 +168,7 @@
       (if (= 1 (mod n 10000))
         (format-stats stats))
       (let [random-move (rand-nth valids)
-            result (simulate-step (perform-move state random-move))]
+            result (simulate-game (perform-move state random-move))]
         (recur (inc n)
                (-> stats
                    (update-in [random-move :n] inc)


Remove login / logout from main view

Remove login / logout from main view

--- src/discuss/views.cljs
+++ src/discuss/views.cljs
@@ -73,19 +73,11 @@
   "Get the user's avatar and add login + logout functions to it."
   []
   (dom/div #js {:className "discuss-avatar-main-wrapper pull-right text-muted text-center"}
-           (if (lib/logged-in?)
+           (when (lib/logged-in?)
              (dom/div nil
                       (dom/img #js {:src       (lib/get-avatar)
                                     :className "discuss-avatar-main img-responsive img-circle"})
-                      (dom/span nil (str (translate :common :hello) " " (lib/get-nickname) "!"))
-                      " "
-                      (dom/span #js {:className "pointer"
-                                     :onClick   auth/logout}
-                                (vlib/fa-icon "fa-sign-out")))
-             (dom/div #js {:className "pointer"
-                           :onClick   #(lib/change-view! :login)}
-                      (vlib/fa-icon "fa-sign-in")
-                      (translate :common :login :space)))))
+                      (dom/span nil (str (translate :common :hello) " " (lib/get-nickname) "!"))))))

 (defn login-form [_ owner]
   (reify


Tidy up

Tidy up

--- src/discuss/views.cljs
+++ src/discuss/views.cljs
@@ -3,16 +3,16 @@
             [om.dom :as dom :include-macros true]
             [clojure.string :as string]
             [discuss.components.bubbles :as bubbles]
+            [discuss.components.contribute :as contribute]
+            [discuss.components.clipboard :as clipboard]
             [discuss.communication.auth :as auth]
-            [discuss.components.clipboard :as clipboard]
             [discuss.communication.main :as com]
             [discuss.history :as history]
+            [discuss.references.main :as ref]
+            [discuss.utils.bootstrap :as bs]
             [discuss.utils.common :as lib]
             [discuss.utils.extensions]
-            [discuss.utils.views :as vlib]
-            [discuss.references.main :as ref]
-            [discuss.components.sidebar :as sidebar]
-            [discuss.utils.bootstrap :as bs]))
+            [discuss.utils.views :as vlib]))

 ;;;; Elements
 (defn control-elements []