224 Involved a quick to an issue we found when multiple generate processes would be trying to create instrument. Because access to the database wasn't locked we had multiple processes running the line:
self.tickers = self.retrieve_column('tickers', "symbol")
At the same time, and this resulted in contention and errors setting up the database. The quick fix we applied to to surround the call with lock.acquire() and lock.release(). We're confident that this has resolved this problem although I believe there will be a more robust solution. Investigate, design and then implemented a solution that will ensure process safety in all classes, not just InstrumentFactory.
Design
I like the idea of placing the locks in methods in creatable which can call
self.establish_db_connection()
But I haven't investigated this fully and I don't know if there will be any issues around pickling.
Documentation Changes
The Runbook should be updated to indicate what the properties in shared_args of config.json mean so they can better understand our multithreading setup and how it impacts how they use the data generator
Test Evidence
Tests should pass and output should be as expected. Do a few runs with multiple generator and writer processes and make sure the files created look as they should
Issue Description
224 Involved a quick to an issue we found when multiple generate processes would be trying to create instrument. Because access to the database wasn't locked we had multiple processes running the line:
self.tickers = self.retrieve_column('tickers', "symbol")
At the same time, and this resulted in contention and errors setting up the database. The quick fix we applied to to surround the call with lock.acquire() and lock.release(). We're confident that this has resolved this problem although I believe there will be a more robust solution. Investigate, design and then implemented a solution that will ensure process safety in all classes, not just InstrumentFactory.Design
I like the idea of placing the locks in methods in creatable which can call
self.establish_db_connection()
But I haven't investigated this fully and I don't know if there will be any issues around pickling.Documentation Changes
The Runbook should be updated to indicate what the properties in shared_args of config.json mean so they can better understand our multithreading setup and how it impacts how they use the data generator
Test Evidence
Tests should pass and output should be as expected. Do a few runs with multiple generator and writer processes and make sure the files created look as they should