-
Notifications
You must be signed in to change notification settings - Fork 78
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
Use singleton-like Meta class to store global state #36
Conversation
We cannot conditionally initialize the database tables in the context classes because snorkel_postgres is only initialized after the imports. Because we won't support sqlite (see #35), just initialize the context based on using postgres.
This release is NOT backwards compatable with v0.1.4. Specifically, in order os.environ['SNORKELDB'] = 'postgres://localhost:5432/' + DBNAME
from fonduer import SnorkelSession
session = SnorkelSession() which had the side-effects of manipulating your database tables on import (or creating a from fonduer import Meta
session = Meta.init("postgres://localhost:5432/" + DBNAME).SnorkelSession() No side-effects occur until |
tests/e2e/test_e2e.py
Outdated
def test_e2e(caplog): | ||
"""Run an end-to-end test on 20 documents of the hardware domain.""" | ||
caplog.set_level(logging.INFO) | ||
PARALLEL = 2 | ||
max_docs = 12 | ||
|
||
session = SnorkelSession() | ||
session = Meta.init('postgres://localhost:5432/' + DB).SnorkelSession() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we update the name here (FonduerSession)?
tests/parser/test_parser.py
Outdated
@@ -29,6 +25,7 @@ def test_parse_structure(caplog): | |||
""" | |||
caplog.set_level(logging.INFO) | |||
logger = logging.getLogger(__name__) | |||
session = Meta.init('postgres://localhost:5432/' + ATTRIBUTE).SnorkelSession() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
tests/parser/test_parser.py
Outdated
@@ -77,7 +74,7 @@ def test_parse_document_md(caplog): | |||
This tests both the structural and visual parse of the document. | |||
""" | |||
logger = logging.getLogger(__name__) | |||
session = SnorkelSession() | |||
session = Meta.init('postgres://localhost:5432/' + ATTRIBUTE).SnorkelSession() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
tests/parser/test_parser.py
Outdated
@@ -126,7 +123,7 @@ def test_parse_document_diseases(caplog): | |||
""" | |||
caplog.set_level(logging.INFO) | |||
logger = logging.getLogger(__name__) | |||
session = SnorkelSession() | |||
session = Meta.init('postgres://localhost:5432/' + ATTRIBUTE).SnorkelSession() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
docs/index.rst
Outdated
dev/tests | ||
:maxdepth: 2 | ||
:caption: Developer Documentation | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the extra spaces
Closes #34.