Skip to content

Commit

Permalink
Add registry method to reset connection pool.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-slac committed Mar 2, 2021
1 parent 6de5d34 commit f7a6128
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions python/lsst/daf/butler/registry/_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,18 @@ def transaction(self, *, savepoint: bool = False) -> Iterator[None]:
self._managers.dimensions.clearCaches()
raise

def resetConnectionPool(self) -> None:
"""Reset SQLAlchemy connection pool for registry database.
This operation is useful when using registry with fork-based
multiprocessing. To use registry across fork boundary one has to make
sure that there are no currently active connections (no session or
transaction is in progress) and connection pool is reset using this
method. This method should be called by the child process immediately
after the fork.
"""
self._db._engine.dispose()

def registerOpaqueTable(self, tableName: str, spec: ddl.TableSpec) -> None:
"""Add an opaque (to the `Registry`) table for use by a `Datastore` or
other data repository client.
Expand Down

0 comments on commit f7a6128

Please sign in to comment.