centreformicrosimulation / SimPaths

SimPaths is an open-source microsimulation framework for life course analysis, developed and maintained by CeMPA at the University of Essex
6 stars 16 forks source link

Only re-create Person, Household and BenefitUnit tables on first iteration #27

Closed andrewbaxter439 closed 10 months ago

andrewbaxter439 commented 10 months ago

This is another possible solution to #24 - works by not dropping/re-creating the tables on subsequent iterations (within each multirun). This goes in conjunction with https://github.com/jasmineRepo/JAS-mine-core/pull/41 which keeps the database url constant. Both of these are needed to solve the database conflict problems between parallel runs.

One minor thing was I experimented with was not running inputDatabaseInteraction() at all on iteration 2, as not needing to re-establish a new connection each time would be a bit more efficient (when I had effectively disabled most of the operations being done with that connection). However, it failed because these lines were necessary for the initialising of a new population for iteration 2: https://github.com/centreformicrosimulation/SimPaths/blob/2909099624042b85b1723d044ada3328bc6cc00b/src/main/java/simpaths/model/SimPathsModel.java#L2285-L2292

As a side query about this - can this initialisation of initialHoursWorkedWeekly from the PERSON table be done from the persistence database connection rather than establishing a new connection in inputDatabaseInteraction()?

Thanks for help/review of this @pbronka @justin-ven