[Core] add clean up method for diffusion engine (#219)
Signed-off-by: zjy0516 <riverclouds.zhu@qq.com>
This commit is contained in:
1 parent
02b1b36c6d
commit
aa689e6af0
13 files changed
+309
-10
No files matched your search
@@ -20,7 +20,8 @@ class Scheduler:
|
||||
return cls._instance
|
||||
|
||||
def initialize(self, od_config: OmniDiffusionConfig):
|
||||
if hasattr(self, "context") and not self.context.closed:
|
||||
existing_context = getattr(self, "context", None)
|
||||
if existing_context is not None and not existing_context.closed:
|
||||
logger.warning("SyncSchedulerClient is already initialized. Re-initializing.")
|
||||
self.close()
|
||||
|
||||
@@ -65,6 +66,9 @@ class Scheduler:
|
||||
"""Closes the socket and terminates the context."""
|
||||
if hasattr(self, "context"):
|
||||
self.context.term()
|
||||
self.context = None
|
||||
self.mq = None
|
||||
self.result_mq = None
|
||||
|
||||
|
||||
# Singleton instance for easy access
|
||||
|
||||
Reference in new issue
Block a user