dgbowl / tomato

tomato: au-tomation without the pain!
https://dgbowl.github.io/tomato
GNU General Public License v3.0
5 stars 6 forks source link

Make last datapoint measured easily accessible #97

Open g-kimbell opened 3 weeks ago

g-kimbell commented 3 weeks ago

It would be very useful for us to easily access the last datapoint from a pipeline, e.g. if we want to check that we are measuring a sensible open circuit voltage.

The first solution is to snapshot and transfer the file, but this can be extremely slow.

I implemented a solution which grabs the last json file saved, however this is still relatively slow (ssh in, check data folder, transfer latest json)

Having this accessible from the database would be nice, for example 'ketchup status -vv' also gives a column with last datapoint of every pipeline.

PeterKraus commented 3 weeks ago

The short term plan is to expose the current "status" of any component using the DriverInterface:

https://github.com/dgbowl/tomato/blob/f0b44fa02532cd9d16c312a235074371dd8805ff/src/tomato/driverinterface_1_0/__init__.py#L314-L321

The actual implementation will then be up to the individual drivers. The rough plan is that if a task is running on the device, the task main loop handles caching the data and storing the latest "datapoint" on the instance of the component, which then gets returned by this dev_status call; if a task is not running, the hardware can be optionally queried for a reply with fresh data.