AllenNeuralDynamics / AllenNeuralDynamics/brainwasher
Save/Reconstitute Starting State
- 主要语言
- Python
- 星标
- 0
- 派生
- 1
- PR 合并指标
- 30 天内没有已合并 PR
描述
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.
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。