From 526e15b829e1d42a3888fe4cf0db39e6441d6bd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Al=C3=A1n=20Mu=C3=B1oz?= <amuoz@ed.ac.uk>
Date: Wed, 2 Feb 2022 14:35:51 +0000
Subject: [PATCH] add statewriter

---
 aliby/pipeline.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/aliby/pipeline.py b/aliby/pipeline.py
index f41eadf6..c0bd873e 100644
--- a/aliby/pipeline.py
+++ b/aliby/pipeline.py
@@ -263,6 +263,9 @@ class Pipeline(ProcessABC):
                 )
                 bwriter = BabyWriter(filename)
 
+                # State Writer to recover interrupted experiments
+                swriter = StateWriter(filename)
+
                 # Limit extraction parameters during run using the available channels in tiler
                 av_channels = set((*tiler.channels, "general"))
                 config["extraction"]["tree"] = {
@@ -316,6 +319,10 @@ class Pipeline(ProcessABC):
                         # )
                         t = perf_counter()
                         bwriter.write(seg, overwrite=["mother_assign"])
+                        swriter.write(
+                            data=runner.crawler.tracker_states,
+                            overwrite=swriter.datatypes.keys(),
+                        )
                         logging.debug(f"Timing:Writing-baby:{perf_counter() - t}s")
 
                         # TODO add time-skipping for cases when the
-- 
GitLab