-
Notifications
You must be signed in to change notification settings - Fork 279
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: fix ParamFileStore for on-demand frontend imports #4926
base: main
Are you sure you want to change the base?
BUG: fix ParamFileStore for on-demand frontend imports #4926
Conversation
Setting to draft for now because I want to see if I can write a test with some pytest monkeypatching. Also note that the fix here is not backwards compatible -- IMO it's fine because I don't think many folks are using this functionality and it's not meant for long-term dataset storage anyway. |
"tt", | ||
"ctid", | ||
"class_name", | ||
"module_name", |
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.
this is the potentially backwards incompatible part: when using the on-disk store, this new field will be a new column in the csv. so if an on-disk store already exists, there will be an error due to the different number of columns and the user would need to remove the old on-disk store.
assuming tests pass this should be ready for review |
oh, those are real failures. will take another go at those pytest fixtures.... |
# first check that the relevant frontend is imported: | ||
# the output_type_registry is refreshed between sessions as | ||
# frontends are imported on-demand now. | ||
import importlib |
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.
Any reason not to put this import at the top level ? importlib should be "free" to import anyway.
import importlib | ||
|
||
module = ds_dict["module_name"] | ||
fe_api = ".".join(module.split(".")[0:3]) + ".api" |
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.
Not 100% sure this is equivalent (I don't know how many "." are expected), but I'm willing to bet there's a clearer way to express this change in file extension.
fe_api = ".".join(module.split(".")[0:3]) + ".api" | |
fe_api = module.rpartition(".")[0] + ".api" |
|
||
|
||
def test_on_disk_parameter_file_store( | ||
monkeypatch, store_parameter_files, set_parameter_file |
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.
Fixtures that are used as setup/teardown but don't need an accessible name should be declared with pytest.mark.usefixture
Currently, the
Dataset
pickling is broken between python sessions when using the yt config optionstore_parameter_files = true
. For example, given two scripts,create_a_pickle.py
andload_a_pickle.py
:The following fails on the attempt to load:
(I also ran into this problem when experimenting with some dask functionality...).
The issue comes how yt now imports frontends on demand (
output_type_registry
is reset between sessions).