brightway-lca/brightway2-data

Are concurrent database modifications supported in Brightway?

shantanu1singh opened this issue · 1 comments

Copying over my question on SO here too.

I'm trying to run Brightway (Version 2.5) on an application with the intent to support the creation of multiple new activities/exchanges in parallel on the same database (Ecoinvent). Does Brightway support concurrent execution of database modifications?

I tried doing this but I keep getting into errors such as 'database is locked' or 'LockError' (stack trace below).

Stack:

File "/Users/shantanu/repos/carbontrail-brightway/ef_module.py", line 490, in create_location_specific_activity new_activity = original_activity.copy() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/shantanu/anaconda3/lib/python3.11/site-packages/bw2data/project.py", line 446, in writable_project return wrapped(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/shantanu/anaconda3/lib/python3.11/site-packages/bw2data/backends/proxies.py", line 446, in copy activity.save() File "/Users/shantanu/anaconda3/lib/python3.11/site-packages/bw2data/project.py", line 446, in writable_project return wrapped(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/shantanu/anaconda3/lib/python3.11/site-packages/bw2data/backends/proxies.py", line 287, in save IndexManager(Database(self["database"]).filename).update_dataset(self._data) File "/Users/shantanu/anaconda3/lib/python3.11/site-packages/bw2data/search/indices.py", line 50, in update_dataset writer = self.get().writer() ^^^^^^^^^^^^^^^^^^^ File "/Users/shantanu/anaconda3/lib/python3.11/site-packages/whoosh/index.py", line 464, in writer return SegmentWriter(self, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/shantanu/anaconda3/lib/python3.11/site-packages/whoosh/writing.py", line 515, in init raise LockError whoosh.index.LockError

I'm using a single project across the app and have even tried setting bd.projects.read_only to False.

cmutel commented

Closing in favor of SO