SpiNNakerManchester / SpiNNFrontEndCommon

Common support code for user-facing front end systems.
Apache License 2.0
12 stars 11 forks source link

Use less transactions #1112

Closed Christian-B closed 1 year ago

Christian-B commented 1 year ago

This Pr is based on ideas from https://github.com/SpiNNakerManchester/SpiNNFrontEndCommon/pull/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:

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:

Must be Done at the same time as: https://github.com/SpiNNakerManchester/SpiNNMan/pull/361 https://github.com/SpiNNakerManchester/sPyNNaker/pull/1385

coveralls commented 1 year ago

Coverage Status

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