dbbs-lab / bsb-core

The Brain Scaffold Builder
https://bsb.readthedocs.io
GNU General Public License v3.0
22 stars 16 forks source link

Lazy load the network topology once it is needed #706

Closed Helveg closed 1 year ago

Helveg commented 1 year ago

Currently we eager load the network topology when the network boots. This causes all the topology dependencies such as large NRRD files, and the Allen data, to be read and loaded before the network is accessible. This could be prevented by making .topology a cached property that lazy loads itself.

Helveg commented 1 year ago

Edit: The problem is that the partition and region configuration nodes are mutated when they are assembled into a topology, and they return incorrect information until this has been done. Any access to the partitions or regions would be incorrect until .topology is accessed, but one, and the framework, never really has to. So either we use __getattribute__ to lazy load the topology once self.scaffold exists and self._config_root._config_isbooted or something, or we eager load it like we do now.

Helveg commented 1 year ago

Closing as "won't fix" for now, but feel free to reopen if anyone has nice insights.