Added start() to BaseObjectStore, so if needed, object store post fork functions can be called by app

This commit is contained in:
Kaivan Kamali
2022-09-23 15:31:28 -04:00
parent 6105688bef
commit 38b149b187
5 changed files with 14 additions and 3 deletions
+1
View File
@@ -743,6 +743,7 @@ class UniverseApplication(StructuredApp, GalaxyManagerApplication):
self.tool_shed_repository_cache = None
self.api_spec = None
self.legacy_mapper = None
self.application_stack.register_postfork_function(self.object_store.start)
log.info(f"Galaxy app startup finished {startup_timer}")
def _shutdown_queue_worker(self):
+8
View File
@@ -289,6 +289,14 @@ class BaseObjectStore(ObjectStore):
extra_dirs.update({e["type"]: e["path"] for e in config_dict.get("extra_dirs", [])})
self.extra_dirs = extra_dirs
def start(self):
"""
Call all postfork function(s) here. These functions spawn a thread,
but do not start it. We register start() with app, so app starts
the threads. Override this function in subclasses, if needed.
"""
return
def shutdown(self):
"""Close any connections for this ObjectStore."""
self.running = False
+3 -1
View File
@@ -279,9 +279,11 @@ class IRODSObjectStore(DiskObjectStore, CloudConfigMixin):
},
name="ConnectionPoolMonitorThread",
)
self.connection_pool_monitor_thread.start()
log.info("Connection pool monitor started")
def start(self):
self.start_connection_pool_monitor()
def _connection_pool_monitor(self, *args, **kwargs):
refresh_time = kwargs["refresh_time"]
connection_pool_monitor_interval = kwargs["connection_pool_monitor_interval"]
+1 -1
View File
@@ -864,7 +864,7 @@ def launch_server(app_factory, webapp_factory, prefix=DEFAULT_CONFIG_PREFIX, gal
server, port, thread = uvicorn_serve(asgi_app, host=host, port=port)
set_and_wait_for_http_target(prefix, host, port, url_prefix=url_prefix)
log.info(f"Embedded uvicorn web server for {name} started at {host}:{port}{url_prefix}")
log.debug(f"Embedded uvicorn web server for {name} started at {host}:{port}{url_prefix}")
return EmbeddedServerWrapper(app, server, name, host, port, thread=thread, prefix=url_prefix)
@@ -20,7 +20,7 @@ IRODS_OBJECT_STORE_PORT = int(os.environ.get("GALAXY_INTEGRATION_IRODS_OBJECT_ST
IRODS_OBJECT_STORE_TIMEOUT = int(os.environ.get("GALAXY_INTEGRATION_IRODS_OBJECT_STORE_TIMEOUT", 30))
IRODS_OBJECT_STORE_REFRESH_TIME = int(os.environ.get("GALAXY_INTEGRATION_IRODS_OBJECT_STORE_REFRESH_TIME", 300))
IRODS_OBJECT_STORE_CONNECTION_POOL_MONITOR_INTERVAL = int(
os.environ.get("GALAXY_INTEGRATION_IRODS_OBJECT_STORE_CONNECTION_POOL_MONITOR_INTERVAL", -1)
os.environ.get("GALAXY_INTEGRATION_IRODS_OBJECT_STORE_CONNECTION_POOL_MONITOR_INTERVAL", 600)
)
IRODS_OBJECT_STORE_USERNAME = os.environ.get("GALAXY_INTEGRATION_IRODS_OBJECT_STORE_USERNAME", "rods")
IRODS_OBJECT_STORE_PASSWORD = os.environ.get("GALAXY_INTEGRATION_IRODS_OBJECT_STORE_PASSWORD", "rods")