diff --git a/smdebug/core/singleton_utils.py b/smdebug/core/singleton_utils.py index db7ee54aa..926d5adf3 100644 --- a/smdebug/core/singleton_utils.py +++ b/smdebug/core/singleton_utils.py @@ -7,6 +7,9 @@ hook = smd.hook() """ +# Standard Library +import atexit + # First Party from smdebug.core.logger import get_logger @@ -69,6 +72,8 @@ def set_hook(custom_hook: "BaseHook") -> None: global _ts_hook _ts_hook = custom_hook + atexit.register(del_hook) + def del_hook() -> None: """ Set the hook singleton to None. """