AllenNeuralDynamics / AllenNeuralDynamics/brainwasher

Save/Reconstitute Starting State

Open
#24 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

It should be possible to reconstitute the starting state either from reset or from most software crash situations.

Requirements:
1. We need to know:
* waste container contents and volumes
* reaction vessel contents
* prime states
* nice-to-have: how much liquid was pulled from the source reservoirs
* nice-to-have: how many times each valve has been cycled (useful for scheduling replacements later).
* pump contents
We will probably reset everything else to put it into a known state (example: pump position).
1. We should be able to relaunch machine into this known state.

This become important in the event of a power failure where the machine may fail with liquid inside of it, and that liquid may need to be directed to a particular waste container.

A few implementation options exist:
* write the output state to a file in a known location on the PC
* double-buffer if needed (2 files)
* pass the state in as a filepath or data structure upon instrument `__init__`.
* re-wrap every method in a `try`/`finally` block ([link](https://stackoverflow.com/questions/11349183/how-to-wrap-every-method-of-a-class)), so that we can update state after every method executes.

For syntactically describing state, we can:
* use objects from pydantic so that we can serialize them to dictionary output in human readable form
* drawback: capturing anything state-like from a python object may need to be additionally represented in this model somewhere.
* ignore syntax altogether and just pickle live objects to a file every time we want to capture state.
* drawback: we can't read this
* If we can represent State through all keyword arguments across all object instances, we can just periodically update the config `devices` dict. Then when we relaunch, the system will recover from the correct state.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.