This function is called in a new subprocess and multiprocessing wants a top
level function.
'''
- session = DBConn().session()
+ session = DBConn().session(work_mem = 1000)
suite = Suite.get(suite_id, session)
architecture = Architecture.get(arch_id, session)
overridetype = OverrideType.get(overridetype_id, session)
This function is called in a new subprocess and multiprocessing wants a top
level function.
'''
- session = DBConn().session()
+ session = DBConn().session(work_mem = 1000)
suite = Suite.get(suite_id, session)
component = Component.get(component_id, session)
log_message = [suite.suite_name, 'source', component.component_name]
self.__setupmappers()
self.pid = os.getpid()
- def session(self):
+ def session(self, work_mem = 0):
+ '''
+ Returns a new session object. If a work_mem parameter is provided a new
+ transaction is started and the work_mem parameter is set for this
+ transaction. The work_mem parameter is measured in MB. A default value
+ will be used if the parameter is not set.
+ '''
# reinitialize DBConn in new processes
if self.pid != os.getpid():
clear_mappers()
self.__createconn()
- return self.db_smaker()
+ session = self.db_smaker()
+ if work_mem > 0:
+ session.execute("SET LOCAL work_mem TO '%d MB'" % work_mem)
+ return session
__all__.append('DBConn')