Skip to content

Commit

Permalink
remove TC driver destructor, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sanni-t committed Apr 20, 2021
1 parent 7497725 commit 1fc9969
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
7 changes: 0 additions & 7 deletions api/src/opentrons/drivers/thermocycler/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,3 @@ async def enter_programming_mode(self):
await asyncio.sleep(0.05)
trigger_connection.close()
self.disconnect()

def __del__(self):
try:
if self._poller:
self._poller.close() # type: ignore
except Exception:
log.exception('Exception while cleaning up Thermocycler')
5 changes: 4 additions & 1 deletion api/src/opentrons/hardware_control/modules/thermocycler.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,4 +349,7 @@ async def prep_for_update(self):
return new_port or self.port

def cleanup(self) -> None:
self._driver.disconnect()
try:
self._driver.disconnect()
except Exception:
MODULE_LOG.exception('Exception while cleaning up Thermocycler')
4 changes: 2 additions & 2 deletions api/src/opentrons/hardware_control/thread_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ def __getattribute__(self, attr_name):

# Update self._cached_modules to delete all removed modules' entries and add
# newly attached modules. Removing references to stale instances
# is necessary to allow the garbage collector to delete those objects from
# memory and cleanly stop all the threads associated with them.
# is necessary in order to allow the garbage collector to delete
# those objects from memory and cleanly stop all associated threads.
cached_mods = {
module: cached_mods.get(module, wrap(module)) for module in attr}
object.__setattr__(self, '_cached_modules', cached_mods)
Expand Down

0 comments on commit 1fc9969

Please sign in to comment.