Skip to content

Commit

Permalink
fixup! Refactor persistence handling: Restructure path building by se…
Browse files Browse the repository at this point in the history
…parating folder and filename construction. This commit will drop the workflow id to allow overwriting and make the path homogenous constructable.

fix linting
  • Loading branch information
fabianliebig committed Nov 22, 2024
1 parent 2702e84 commit 7a3aaed
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions benchmarks/persistence/persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

from benchmarks import Benchmark, Result

MODULE_WILL_USE_AWS = os.getenv("BAYBE_PERFORMANCE_PERSISTENCE_PATH", None) is not None


class PathStrategy(Enum):
"""The way a path extension is constructed."""
Expand Down Expand Up @@ -116,7 +114,7 @@ class S3PersistenceHandler:
@_bucket_name.default
def _default_bucket_name(self) -> str:
"""Get the bucket name from the environment variables."""
if not MODULE_WILL_USE_AWS:
if "BAYBE_PERFORMANCE_PERSISTENCE_PATH" not in os.environ:
raise ValueError("No S3 bucket name provided.")
return os.getenv(
"BAYBE_PERFORMANCE_PERSISTENCE_PATH",
Expand Down Expand Up @@ -177,6 +175,7 @@ def persister_factory() -> PersistenceHandlingInterface:
Returns:
The persistence handler.
"""
MODULE_WILL_USE_AWS = "BAYBE_PERFORMANCE_PERSISTENCE_PATH" in os.environ
if MODULE_WILL_USE_AWS:
return S3PersistenceHandler()
return LocalFileSystemPersistenceHandler()
Expand Down

0 comments on commit 7a3aaed

Please sign in to comment.