Repository navigation
Description
Improves quality of life and saving cached events data and setting to allow user to restore state after restarting the interactive shell. This also enable sharing session, by allowing the cache to be placed on a shared network drive, teams can collaboratively view and plot each other's live scan data.
Goals
Acceptance criteria : What journeys should the user be able to complete to consider your feature done
Be as specific as you can, check them off once they work. Add more if you find more requirements during development. Issue should only be considered done after all of them are checked
- When a user launches the client with the -s flag (e.g., sm-bluesky client -b p99 -s cm44186-1), the session ID is saved locally so it is remembered for next time.
- When a user launches the client without the -s flag, the application automatically loads and connects using their last used session ID.
- When a hardware scan finishes, the collected scan_data is automatically saved to disk so it isn't lost when the terminal is closed.
- When a user opens a new interactive shell, their previously collected scan_data is automatically loaded back into memory, allowing them to instantly run plot() on scans from their previous session.
- If the local cache files are deleted or corrupted, the client gracefully ignores them and starts fresh without crashing.
Tasks
base on the goals, deduce the tasks required. check them off once they're done
- Implement a writer to save and load the last-used session ID when the CLI is invoked.
- Update the CLI logic to fall back to the cached session ID if the
-sflag is omitted. - Implement and write scan_data to a cache directory (e.g.,
~/.sm-bluesky/cache/<session_id>/) when a scan finishes. - Add loading logic to
BlueAPISessionstartup to read existing data from the cache directory and populate self.scan_data dictionary. - Ensure all cache reading/writing includes error handling to start fresh if cache are corrupted or missing.
- Update the documentation to explain the new session caching behaviour.
- Add a section to the documentation highlighting how users can utilize IPython's built-in
%storemagic command to manually persist variables across sessions and what is automatically stored.
Related Resources
any images/gifs, mockups/wireframes that would aid the development should be listed here
MockUp : link to mockup
Coda doc: link to coda
Additional context
Add any other context or screenshots about the feature request here.
Activity
Relm-Arrowny commentedon Oct 7, 2026
@DiamondLightSource/smg Thinking about what format to store the scan_data so it can be restored between session and I am thinking picket/json or hdf5/nexus, any thought?
It also just cross my mind that, we have everything we need here to replace the nexus writer here.
oliwenmandiamond commentedon Oct 7, 2026
I think we need to be careful, we don't want to reinvent bits such as nexus-writing as this isn't our job, this is a core team issue. We only need to provide a bare minimum client for us to be able to run move devices, run scans and maybe plot some data as go along to easily test plans and devices (and maybe let some scientists also play with). Other services such as tiled, nexus writing and of course blueapi are maintained by core team and it should be used or improved for our needs, not replaced.
This is only because we are waiting for UI to catch up. I think we need to define some clear boundaries of what we should and should not cover here. We still have a lot of devices to migrate for each beamline, so I personally think we should spend some time migrating some more devices so we have stuff to play with
oliwenmandiamond commentedon Oct 7, 2026
As for actual formats, I think picket/json will be easiest and simplest to do as we already store it in a python dictionary. hdf5 will be another dependency and complication