cellmap_flow.dashboard.state
The dashboard’s state, read and written through one object: get_session().
One Session per process, made at import and filled by the CLIs,
services/startup and create_and_run_app. It lives in this module
rather than in Flask’s app.extensions because the CLIs fill it before
dashboard.app is imported (they import it lazily so --help stays
fast); because launch threads, job-monitor listeners, the MinIO sync thread
and the log panel’s handler run with no app context; and so that this module
imports without Flask.
The Session forwards three parts to their owners, which also serve processes that have no dashboard:
The launcher settings in ~/.cellmap_flow/server_config.yaml, one attribute per key of
jobs.settings.SERVER_CONFIG_DEFAULTS(queue,charge_group,walltime, …), andsettings,server_config,server_config_cachedandsave_server_config():jobs.settings.launcher_settings().The chain:
input_normsandpostprocess(the live steps, read-only),pipeline_spec(the same as data), andset_pipeline(), the one way to change them:process_chain.process_chain().jobs, the running inference servers’ jobs:jobs.launch.started_jobs().
The rest it stores itself, in __slots__, so a misspelt attribute raises
rather than being stored beside the real one:
The data and the viewer:
dataset_path,resample,viewer,raw,neuroglancer_url,dashboard_url,shaders,shader_controls,extra_layers,shown_channels; andlayer_blob(), the chain as every prediction layer’s URL carries it, andshown_channel(), the channel a model’s layer opens on.The models:
models_config,model_catalog,start_postprocess, the postprocessing a model’s start set, anddeleted_in_viewer, the models stopped because their layer was deleted in the viewer.The pipeline builder’s last apply:
builder_state,builder_model_configs.Blockwise’s
tmp_dirandblockwise_tasks_dir, andtasks_dir().The finetune tab’s MinIO and volumes:
minio_state,label_undo,annotation_volumes,output_sessions; the models its ranking was given by reference,rank_added, and what it fitted each model’s settings to,rank_fits; its AI annotation’sai_annotate; its training jobs’finetune_job_manager, and therestart_keythat restarts one from the viewer; the Hugging Face sign-in and publishes of its finetuned models,huggingface; the Review tab’sreview.The log panel’s
log_buffer,log_idsandlog_clients; the box tool’sbbx_generator_state.
Read the session through get_session() when it is needed, never into a
module global: tests/conftest.py installs a fresh Session for every test.
Attributes
Classes
The dashboard's state; see the module docstring. |
Functions
|
The dashboard's session. |
Module Contents
- cellmap_flow.dashboard.state.LAYER_BOOKKEEPING = ('shaders', 'shader_controls', 'extra_layers')
- class cellmap_flow.dashboard.state.Session
The dashboard’s state; see the module docstring.
- dataset_path = None
- resample = True
- viewer = None
- raw = None
- neuroglancer_url = None
- dashboard_url = None
- shaders
- shader_controls
- extra_layers
- shown_channels
- models_config = []
- model_catalog
- start_postprocess = None
- deleted_in_viewer = []
- builder_model_configs
- tmp_dir
- blockwise_tasks_dir
- minio_state
- annotation_volumes
- output_sessions
- rank_added
- rank_fits
- review = None
- label_undo
- ai_annotate
- huggingface
- restart_key
- log_buffer
- log_ids
- log_clients = []
- bbx_generator_state
- forget_layer(name)
Drop
name’s LAYER_BOOKKEEPING, so a later layer of that name starts fresh.
- layer_blob(dashboard_url=None)
The args blob of a prediction layer’s URL (viewer.layers.prediction_url): the chain (
pipeline_spec), the dashboard’s address and the chain’s digest, as the browser app’s layers carry them (web/src/backend/serving.ts).Every layer is built through this, whatever started its model (the CLI, Submit, Add, a finetune, Submit’s redraw), so an inference server running a merging postprocessor knows where to post its merged ids (serving.chunkmirage_ops), and a redraw of the chain a layer already shows is told by its URL (routes.pipeline._shows). The address is the dashboard’s own (
dashboard_url, by IP, which a server on the cluster can reach), or elsedashboard_urlas given, the address a request reached the dashboard by; left out when neither is known.
- shown_channel(model_name)
The channel
model_name’s layer opens on (viewer.layers prediction_layer’schannel): the one picked for it (shown_channels), else the one picked for the model it is a finetune of, as finetune_layers names each iteration (<base>_finetuned...), so a finetune of mito’s channel shows mito too; None when none was picked (the layer opens where its server says).
- property jobs
The running inference servers’ jobs, each with its model_name and host: jobs.launch.started_jobs(). Assigning replaces the list’s contents, so start_hosts and cleanup_handler keep seeing it.
- property input_norms
The live input normalizers. Changed only by set_pipeline().
- property postprocess
The live postprocessors. Changed only by set_pipeline().
- property pipeline_spec
The chain as data (PipelineSpec), derived on every read.
- set_pipeline(spec, built=None)
Replace the chain; see ProcessChain.set.
- property builder_state
{inputs, outputs, edges, normalizers, models, postprocessors}, each a list of its nodes, all empty until the first apply. A new dict on every read.- Type:
What the builder last applied, as it sent it
- property settings
The launcher settings themselves (jobs.settings.LauncherSettings).
- property server_config
value} of the saved settings.
- Type:
{key
- property server_config_cached
Whether the settings came from, or were saved to, the file.
- save_server_config()
Write the settings to ~/.cellmap_flow/server_config.yaml.
- tasks_dir() str
blockwise_tasks_dir, made if it is missing.
- property finetune_job_manager
The training jobs’ FinetuneJobManager, made when first asked for.