From 822b03fd9ca1331cbf3e8985902b5ebad25ad329 Mon Sep 17 00:00:00 2001
From: "a.stevan" <antoine.stevan@isae-supaero.fr>
Date: Wed, 29 May 2024 15:12:46 +0200
Subject: [PATCH] add `inbreeding inspect`

---
 bins/inbreeding/inspect.nu | 32 ++++++++++++++++++++++++++++++++
 bins/inbreeding/mod.nu     |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 bins/inbreeding/inspect.nu

diff --git a/bins/inbreeding/inspect.nu b/bins/inbreeding/inspect.nu
new file mode 100644
index 00000000..8fe9d548
--- /dev/null
+++ b/bins/inbreeding/inspect.nu
@@ -0,0 +1,32 @@
+use consts.nu
+use path.nu [ "remove-cache-prefix" ]
+
+def get-seeds [] [ nothing -> list<string> ] {
+    $consts.CACHE | path join '*' | into glob | ls $in | get name | each { path split | last }
+}
+
+export def main [seed: int@get-seeds]: [
+    nothing -> table<
+        seed: string,
+        timestamp: string,
+        env: string,
+        strategy: string,
+        k: string,
+        n: string,
+        nb_bytes: string,
+        m: int,
+    >
+] {
+    $consts.CACHE
+        | path join ($seed | into string) '*'
+        | into glob
+        | ls $in
+        | insert m { ls $in.name | length }
+        | select name m
+        | update name {
+            remove-cache-prefix
+                | parse $consts.FULL_EXPERIMENT_FORMAT
+        }
+        | flatten --all name
+}
+
diff --git a/bins/inbreeding/mod.nu b/bins/inbreeding/mod.nu
index 6917cad3..f3bdbd9d 100644
--- a/bins/inbreeding/mod.nu
+++ b/bins/inbreeding/mod.nu
@@ -1,4 +1,5 @@
 export use build.nu
 export use run.nu
+export use inspect.nu
 export use load.nu
 export use plot.nu
-- 
GitLab