Skip to content

Always Create a New Gene Normalizer Instance#24

Merged
bencap merged 1 commit intomavedb-mainfrom
feature/bencap/23/gene-normalizer-connection-often-closed
Oct 16, 2024
Merged

Always Create a New Gene Normalizer Instance#24
bencap merged 1 commit intomavedb-mainfrom
feature/bencap/23/gene-normalizer-connection-often-closed

Conversation

@bencap
Copy link
Copy Markdown
Collaborator

@bencap bencap commented Oct 14, 2024

This is to avoid instances where the database connection has been prematurely closed. Since the gene normalizer instance uses an internal abstract database class and we don't expect this operation to occur too often, it is simpler to just close the existing database connection ourselves and respawn the instance in cases where it already exists.

@bencap bencap added type: bug Something isn't working app: mapper Task implementation touches the mapper labels Oct 14, 2024
@bencap bencap requested a review from sallybg October 14, 2024 17:43
@bencap bencap linked an issue Oct 14, 2024 that may be closed by this pull request

:return: singleton instance of ``QueryHandler`` for Gene Normalizer
"""
if not hasattr(cls, "instance"):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be if hasattr(cls, "instance"): ?

Copy link
Copy Markdown
Collaborator Author

@bencap bencap Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, yes it should.

This is to avoid instances where the database connection has been prematurely closed. Since the gene normalizer instance uses an internal abstract database class and we don't expect this operation to occur too often, it is simpler to just close the existing database connection ourselves and respawn the instance in cases where it already exists.
@bencap bencap force-pushed the feature/bencap/23/gene-normalizer-connection-often-closed branch from edf2c3a to 7dc6ed0 Compare October 14, 2024 22:00
Copy link
Copy Markdown
Collaborator

@sallybg sallybg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@bencap bencap merged commit 22ed17c into mavedb-main Oct 16, 2024
@bencap bencap deleted the feature/bencap/23/gene-normalizer-connection-often-closed branch October 16, 2024 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: mapper Task implementation touches the mapper type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gene Normalizer DB Connection is Constantly Closed

2 participants