Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47b44e3
commit 638bf0a
Showing
21 changed files
with
1,119 additions
and
805 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
(ns clojush.log | ||
(:require [clojush.structured-logger :refer [->structured-logger]] | ||
[clojush.log.events :refer [label->compute-graph]] | ||
[clojush.log.handlers :refer [handlers]])) | ||
;; this stuff is spread out over many files in subdirectories | ||
;; Not only does this help with keeping files shorter, but it also allows | ||
;; us to use the defnk names directly in the graph, because we don't | ||
;; have to namespace them. For example, if we define `best` in the | ||
;; lexicase file, then we can just throw that in the graph we defined | ||
;; there, and it will registered under :best. | ||
|
||
(def structured-logger | ||
(->structured-logger | ||
{:handlers handlers | ||
:label->compute-graph label->compute-graph})) | ||
|
||
(def log! (:log! structured-logger)) | ||
|
||
(def label->computed (:label->computed structured-logger)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(ns clojush.log.events | ||
(:require [clojush.log.events.init] | ||
[clojush.log.events.config] | ||
[clojush.log.events.generation])) | ||
|
||
(def label->compute-graph | ||
{:init clojush.log.events.init/compute-graph | ||
:config clojush.log.events.config/compute-graph | ||
:generation clojush.log.events.generation/compute-graph}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
(ns clojush.log.events.config | ||
(:require [plumbing.core :refer [defnk]] | ||
[plumbing.graph :as graph] | ||
[clj-random.core :as random] | ||
[local-file] | ||
[clojure.string :as string])) | ||
|
||
(defnk clojush-version [] | ||
(let [version-str (apply str (butlast (re-find #"\".*\"" | ||
(first (string/split-lines | ||
(local-file/slurp* "project.clj"))))))] | ||
(.substring version-str 1 (count version-str)))) | ||
|
||
(defnk argmap [argmap-input] | ||
argmap-input) | ||
|
||
(defnk registered-instructions [registered-instructions-input] | ||
registered-instructions-input) | ||
|
||
(defnk argmap-with-random-str [argmap-input] | ||
(update argmap :random-seed random/seed-to-string)) | ||
|
||
(defnk git-hash [] | ||
(let [dir (local-file/project-dir)] | ||
(string/trim | ||
(slurp | ||
(str dir | ||
"/.git/" | ||
(subs | ||
(string/trim | ||
(slurp | ||
(str dir "/.git/HEAD"))) | ||
5)))))) | ||
|
||
(defnk initialization-ms [timing-map] | ||
(:initialization timing-map)) | ||
|
||
(def compute-graph | ||
(graph/graph | ||
clojush-version | ||
argmap | ||
registered-instructions | ||
git-hash | ||
initialization-ms | ||
argmap-with-random-str)) |
Oops, something went wrong.