Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use less transactions #1112

Merged
merged 27 commits into from
Sep 25, 2023
Merged

Use less transactions #1112

merged 27 commits into from
Sep 25, 2023

Conversation

Christian-B
Copy link
Member

@Christian-B Christian-B commented Sep 20, 2023

This Pr is based on ideas from #1062

The purpose is to reduce the number of database transaction.

The basic idea is that all database patterns follow the pattern
with xyzDatabase() as db:

  • The enter starts a transaction and caches a cursor
  • SQLiteDB has a few pass through methods which check the cursor/transaction exists and uses that
  • Exit commits the transaction and nukes the cached cursor so it can not be reused.

Most changes are just tabbing after the removal of the
with self.transaction() as cursor:

While NOT recommended it is possible to have two xyzDatabase Objects open on the same file
BUT if you write to both it goes BOOM!
see test_double_with

The pattern
with DsSqlliteDatabase() as db:
dsg = DataSpecificationGenerator(0, 1, 3, vertex, db)
looks strange in tests but was used so that
_GraphDataSpecificationWriter runs the whole generation in a single transaction

A few code changes includes:

  • The View now holds the path of the DsSqlliteDatabase
  • Database queries moved from SpinnMan to Fec

Must be Done at the same time as:
SpiNNakerManchester/SpiNNMan#361
SpiNNakerManchester/sPyNNaker#1385

@coveralls
Copy link

coveralls commented Sep 20, 2023

Coverage Status

coverage: 42.293% (-0.2%) from 42.508% when pulling b02f10e on with_database into 9a83667 on master.

Another blank line for Sphinx
@Christian-B Christian-B merged commit 0f3b084 into master Sep 25, 2023
6 checks passed
@Christian-B Christian-B deleted the with_database branch September 25, 2023 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants