Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear all singleton instances during shutdown #2781

Merged
merged 3 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion elyra/elyra_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,24 @@ def initialize_templates(self):
pass

async def stop_extension(self):
PipelineProcessorRegistry.clear_instance()
PipelineProcessorManager.clear_instance()
PipelineValidationManager.clear_instance()

if FileMetadataCache.initialized():
file_metadata_cache = FileMetadataCache.instance(parent=self)
if hasattr(file_metadata_cache, "observer") and file_metadata_cache.observer.is_alive():
file_metadata_cache.observer.stop() # terminate FileMetadataCache watchdog
FileMetadataCache.clear_instance()

if ComponentCache.initialized():
ComponentCache.instance(parent=self).cache_manager.stop() # terminate CacheUpdateManager
component_cache = ComponentCache.instance(parent=self)
component_cache.cache_manager.stop() # terminate CacheUpdateManager
if hasattr(component_cache, "observer") and component_cache.observer.is_alive():
component_cache.observer.stop() # terminate ComponentCache watchdog
ComponentCache.clear_instance()

SchemaManager.clear_instance()


launch_instance = ElyraApp.launch_instance
6 changes: 3 additions & 3 deletions elyra/tests/cli/test_pipeline_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
@pytest.fixture(autouse=True)
def destroy_component_cache():
"""
This fixture provides a workaround for a (yet unexplained)
issue that causes tests to fail that utilize the component
cache.
This fixture clears any ComponentCache instances that
may have been created during CLI processes so that
those instance doesn't side-affect later tests.
"""
yield
ComponentCache.clear_instance()
Expand Down