close subproc env on shutdown

This commit is contained in:
Timothy Pogue
2022-09-28 03:06:05 +00:00
parent 647200e8a7
commit caa47a2f47
2 changed files with 22 additions and 1 deletions

View File

@@ -158,6 +158,13 @@ class IFreqaiModel(ABC):
self.model = None
self.dk = None
def _on_stop(self):
"""
Callback for Subclasses to override to include logic for shutting down resources
when SIGINT is sent.
"""
return
def shutdown(self):
"""
Cleans up threads on Shutdown, set stop event. Join threads to wait
@@ -166,6 +173,8 @@ class IFreqaiModel(ABC):
logger.info("Stopping FreqAI")
self._stop_event.set()
self._on_stop()
logger.info("Waiting on Training iteration")
for _thread in self._threads:
_thread.join()