def run_experiment(db, mod, iterations, seed, directory): # Wrap the execution in a try block so we can start a new thread # if something bad happens (most likely missing cacti or xst). try: database.set_instance(db) full = main_context.full while True: try: optimize(db, mod, iterations, seed, directory, full) except PendingException: if full and not main_context.full: print('Reverting to model') full = main_context.full except SwitchToFull: full = True except KeyboardInterrupt: return -1 except: traceback.print_exc() return db.ident
def setUp(self): self.db = sql.SQLDatabase('sqlite:///') self.assertTrue(self.db.connect()) database.set_instance(self.db) self.machine = MachineType(target=TargetType.ASIC)