cellmap_flow.finetune.session.store =================================== .. py:module:: cellmap_flow.finetune.session.store .. autoapi-nested-parse:: Which session a base output path means, and the volumes registered for painting. Attributes ---------- .. autoapisummary:: cellmap_flow.finetune.session.store.logger cellmap_flow.finetune.session.store.SESSION_DIR_RE Classes ------- .. autoapisummary:: cellmap_flow.finetune.session.store.SessionStore Module Contents --------------- .. py:data:: logger .. py:data:: SESSION_DIR_RE .. py:class:: SessionStore(sessions: dict, volumes: Optional[dict] = None) Sessions and the volume registry, kept in the dicts it is given. ``sessions`` maps a base output path to the session this process made under it (the dashboard's ``get_session().output_sessions``); ``volumes`` maps a volume id -- its MinIO bucket key without ".zarr" -- to its record (``get_session().annotation_volumes``). The store holds nothing else, so any number of them over the same dicts agree. Both dicts live in memory only; ``latest_on_disk`` is what finds a session again after a restart. .. py:method:: get_or_create(base: str) -> str The session this process uses under ``base``: the one it made before, else a new ``/`` (not created on disk). .. py:method:: latest_on_disk(base: str) -> Optional[str] The newest session under ``base`` that has something to train on. That is the latest ``//`` whose corrections/ holds a virtual-sources manifest. The in-memory map dies with the dashboard, so after a restart get_or_create hands out a new, empty session, and submitting training for the base path failed with "Corrections path does not exist" although the session painted before the restart was right there. None when there is none. .. py:method:: register_volume(volume_id: str, *, keep_sync_state: bool = False, **data) -> dict Record a volume being served for painting; returns its record. The record starts with no chunk sync state, so the next sync compares MinIO against nothing and pulls every chunk. ``keep_sync_state`` updates an existing record instead, keeping the state a pull just recorded (an instance correction reattached after its pre-mirror pull). .. py:method:: volumes() -> dict The registry itself: volume id -> record. .. py:method:: session_volume(corrections_dir: Optional[str] = None) ``(volume_id, record)`` of the volume a session is painting, or ``(None, None)``. That is the last one registered for ``corrections_dir``, or for any corrections dir when it is None: a session can hold several volumes, and the latest is the one the user just made or reattached. Every route asks this, so a crop import, the good regions and training all mean the same volume; load-crops used to take the first instead, and imported into one volume while the user painted another.