-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent_eve.bb
More file actions
executable file
·34 lines (26 loc) · 1.07 KB
/
agent_eve.bb
File metadata and controls
executable file
·34 lines (26 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bb
;; Agent 3: Eve the File Sharer
(load-file "client.bb")
(require '[workshop.client :as ws])
(ws/configure! {:url "http://localhost:4242" :agent "analyzer.eve"})
(println "[Eve] Starting file agent...")
;; Create temp files and upload them
(dotimes [i 3]
(Thread/sleep 2000)
;; Create a temp file
(let [temp-file (java.io.File/createTempFile (str "analysis-" i) ".txt")]
(spit temp-file (str "Analysis Results Batch " i "\n"
"Generated: " (java.time.Instant/now) "\n"
"Records processed: " (* (inc i) 100) "\n"
"Status: SUCCESS\n"))
;; Upload it
(let [hash (ws/upload-file! temp-file)]
(println (format "[Eve] Uploaded file %d/3: %s" (inc i) hash))
;; Reference in a message
(ws/publish! "results" "analysis.complete"
{:batch i :records (* (inc i) 100)}
:files [hash])
(println (format "[Eve] Published results for batch %d" i)))
;; Clean up temp file
(.delete temp-file)))
(println "[Eve] Done!")