-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #757 from soerenreichardt/configurable-logging
Configure progress logging on GDS object
- Loading branch information
Showing
11 changed files
with
122 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
graphdatascience/tests/integration/test_progress_logging.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from neo4j import Driver | ||
from pandas import DataFrame | ||
|
||
from graphdatascience import ServerVersion | ||
from graphdatascience.query_runner.neo4j_query_runner import Neo4jQueryRunner | ||
from graphdatascience.query_runner.session_query_runner import SessionQueryRunner | ||
from graphdatascience.tests.unit.conftest import CollectingQueryRunner | ||
from graphdatascience.tests.unit.test_session_query_runner import FakeArrowClient | ||
|
||
|
||
def test_disabled_progress_logging(neo4j_driver: Driver): | ||
query_runner = Neo4jQueryRunner.create(neo4j_driver, show_progress=False) | ||
assert query_runner._resolve_show_progress(True) is False | ||
assert query_runner._resolve_show_progress(False) is False | ||
|
||
|
||
def test_enabled_progress_logging(neo4j_driver: Driver): | ||
query_runner = Neo4jQueryRunner.create(neo4j_driver, show_progress=True) | ||
assert query_runner._resolve_show_progress(True) is True | ||
assert query_runner._resolve_show_progress(False) is False | ||
|
||
|
||
def test_disabled_progress_logging_session(neo4j_driver: Driver): | ||
version = ServerVersion(2, 7, 0) | ||
db_query_runner = CollectingQueryRunner(version, result_mock=DataFrame([{"version": "v1"}])) | ||
gds_query_runner = CollectingQueryRunner(version) | ||
query_runner = SessionQueryRunner.create( | ||
gds_query_runner, | ||
db_query_runner, | ||
FakeArrowClient(), # type: ignore | ||
show_progress=False, | ||
) | ||
assert query_runner._resolve_show_progress(True) is False | ||
assert query_runner._resolve_show_progress(False) is False | ||
|
||
|
||
def test_enabled_progress_logging_session(neo4j_driver: Driver): | ||
version = ServerVersion(2, 7, 0) | ||
db_query_runner = CollectingQueryRunner(version, result_mock=DataFrame([{"version": "v1"}])) | ||
gds_query_runner = CollectingQueryRunner(version) | ||
query_runner = SessionQueryRunner.create( | ||
gds_query_runner, | ||
db_query_runner, | ||
FakeArrowClient(), # type: ignore | ||
show_progress=True, | ||
) | ||
assert query_runner._resolve_show_progress(True) is True | ||
assert query_runner._resolve_show_progress(False) is False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters