Honor explicitly selected custom storage backends
This commit is contained in:
parent
9c02d2ecf7
commit
87e4673ac6
2 changed files with 23 additions and 0 deletions
|
|
@ -202,6 +202,8 @@ def _initialize_tracing_database(
|
||||||
)
|
)
|
||||||
tracing_driver.configure_credentials_from_file(p)
|
tracing_driver.configure_credentials_from_file(p)
|
||||||
return tracing_driver
|
return tracing_driver
|
||||||
|
if selected is not None:
|
||||||
|
return selected
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Cannot find credentials files, defaulting to using ParallelTinyDbDriver"
|
"Cannot find credentials files, defaulting to using ParallelTinyDbDriver"
|
||||||
)
|
)
|
||||||
|
|
@ -227,6 +229,8 @@ def _initialize_large_file(
|
||||||
)
|
)
|
||||||
large_file.configure_credentials_from_file(p)
|
large_file.configure_credentials_from_file(p)
|
||||||
return large_file
|
return large_file
|
||||||
|
if selected is not None:
|
||||||
|
return selected
|
||||||
logger.warning("Cannot find credentials files, defaulting to using LargeFileLocal")
|
logger.warning("Cannot find credentials files, defaulting to using LargeFileLocal")
|
||||||
return LargeFileLocal
|
return LargeFileLocal
|
||||||
|
|
||||||
|
|
|
||||||
19
tests/test_configuration_regressions.py
Normal file
19
tests/test_configuration_regressions.py
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
from great_ai import ParallelTinyDbDriver, configure
|
||||||
|
from great_ai.context import get_context
|
||||||
|
from great_ai.large_file import LargeFileLocal
|
||||||
|
|
||||||
|
|
||||||
|
def test_explicit_custom_backends_are_preserved(isolated_context: None) -> None:
|
||||||
|
class CustomDatabase(ParallelTinyDbDriver):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class CustomStorage(LargeFileLocal):
|
||||||
|
pass
|
||||||
|
|
||||||
|
configure(
|
||||||
|
tracing_database_factory=CustomDatabase,
|
||||||
|
large_file_implementation=CustomStorage,
|
||||||
|
disable_se4ml_banner=True,
|
||||||
|
)
|
||||||
|
assert isinstance(get_context().tracing_database, CustomDatabase)
|
||||||
|
assert get_context().large_file_implementation is CustomStorage
|
||||||
Loading…
Reference in a new issue