Skip to content

Commit 9e0d94b

Browse files
Add trace namespace to track per run trajectories
1 parent ee84cc1 commit 9e0d94b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/docker.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
;; Tty wraps the process in a pseudo terminal
108108
{:StdinOnce true
109109
:OpenStdin true}
110-
(defn create-container [{:keys [image entrypoint command host-dir env thread-id opts] :or {opts {:Tty true}}}]
110+
(defn create-container [{:keys [image entrypoint command host-dir env thread-id opts mounts] :or {opts {:Tty true}}}]
111111
(let [payload (json/generate-string
112112
(merge
113113
{:Image image}
@@ -120,7 +120,8 @@
120120
(concat [(format "%s:/project:rw" host-dir)
121121
"docker-lsp:/docker-lsp"
122122
"/var/run/docker.sock:/var/run/docker.sock"]
123-
(when thread-id [(format "%s:/thread:rw" thread-id)]))}
123+
(when thread-id [(format "%s:/thread:rw" thread-id)])
124+
mounts)}
124125
:WorkingDir "/project"})
125126
(when entrypoint {:Entrypoint entrypoint})
126127
(when command {:Cmd command})))]

src/trace.clj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(ns trace
2+
(:require
3+
[cheshire.core :as json]))
4+
5+
(def trace (atom {}))
6+
7+
(defn container-call [definition]
8+
(swap! trace update-in [:container-calls] (fnil concat []) [(into {} (dissoc definition :prompts))]))
9+
10+
(defn dump []
11+
(spit "trace.edn" (pr-str @trace)))

0 commit comments

Comments
 (0)