Skip to content
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

Bug: Custom StoreProtocol doesnt store #284

Closed
mpvanderschelling opened this issue Nov 5, 2024 · 0 comments
Closed

Bug: Custom StoreProtocol doesnt store #284

mpvanderschelling opened this issue Nov 5, 2024 · 0 comments

Comments

@mpvanderschelling
Copy link
Collaborator

The problem

When using a custom StoreProtocol, the store method is never run, only an instance of the StoreProtocol is created (in line 324)

_path = experimentdata_directory / path
if store_method is not None:
storage = store_method(object, _path)
return
# Check if object type is supported
object_type = type(object)
if object_type not in STORE_TYPE_MAPPING:
storage: StoreProtocol = PickleStore(object, _path)
logger.debug(f"Object type {object_type} is not natively supported. "
f"The default pickle storage method will be used.")
else:
storage: StoreProtocol = STORE_TYPE_MAPPING[object_type](object, _path)
# Store object
storage.store()
return storage.suffix

Solution

Don't return, but let storage.store() be executed whenever a StoreProtocol is instantiated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant