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

PyCUTEst v1.5.0 breaks existing cached problems #50

Closed
jfowkes opened this issue Feb 20, 2023 · 12 comments
Closed

PyCUTEst v1.5.0 breaks existing cached problems #50

jfowkes opened this issue Feb 20, 2023 · 12 comments
Labels
cache issue An issue with the PyCUTEst Cache

Comments

@jfowkes
Copy link
Owner

jfowkes commented Feb 20, 2023

Regrettably PyCUTEst v1.5.0 breaks existing cached problems (we had to fix a memory leak).

When upgrading to PyCUTEst v1.5.0, please clear out your cache by deleting the $PYCUTEST_CACHE/pycutest_cache_holder directory:

rm -r $PYCUTEST_CACHE/pycutest_cache_holder/

Failure to do so will result in errors of the form:

>>> pycutest.import_problem('ROSENBR')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jari/Code/pycutest/pycutest/build_interface.py", line 345, in import_problem
    return CUTEstProblem(importlib.import_module('%s.%s' % (CACHE_SUBFOLDER, problemDir)),
  File "/home/jari/Code/pycutest/pycutest/problem_class.py", line 52, in __new__
    module.info = module.setup() # setup CUTEst problem
AttributeError: module 'pycutest_cache_holder.ROSENBR' has no attribute 'setup'
@jfowkes
Copy link
Owner Author

jfowkes commented Feb 22, 2023

@ragonneau just a heads up for a cache breaking change in the upcoming v1.5.0 release.

@jfowkes jfowkes added the cache issue An issue with the PyCUTEst Cache label Feb 22, 2023
@ragonneau
Copy link
Contributor

Great thanks for the reminder!

@KenZhenLin
Copy link

Hi, I sometimes get this error as well, and I fix it by deleting the folder you mention.

If I do not get this error, does it mean everything works correctly?

Or, I would have to clear out my cache each time I need to run the same code, even if there is no error?

Thanks!

@lindonroberts
Copy link
Collaborator

You only need to delete the cache once, when you install the new version (since your previous cache files would have been compiled under an older PyCUTEst version and are incompatible with PyCUTEst>=1.5).

@KenZhenLin
Copy link

You only need to delete the cache once, when you install the new version (since your previous cache files would have been compiled under an older PyCUTEst version and are incompatible with PyCUTEst>=1.5).

Thanks for the fast response!

@KenZhenLin
Copy link

You only need to delete the cache once, when you install the new version (since your previous cache files would have been compiled under an older PyCUTEst version and are incompatible with PyCUTEst>=1.5).

Although I should have mentioned, if this is helpful information: I think the only version I installed is PyCUTEst 1.5.0, so I had no trouble initially. But then I got this error in one of my running programs, and I was able to fix it by deleting that folder.

@jfowkes
Copy link
Owner Author

jfowkes commented Mar 16, 2023

You only need to delete the cache once, when you install the new version (since your previous cache files would have been compiled under an older PyCUTEst version and are incompatible with PyCUTEst>=1.5).

Although I should have mentioned, if this is helpful information: I think the only version I installed is PyCUTEst 1.5.0, so I had no trouble initially. But then I got this error in one of my running programs, and I was able to fix it by deleting that folder.

Thank you, if this error re-occurs again please let us know and we will look into it.

@KenZhenLin
Copy link

Hi, while I was trying to fix this error, I deleted my custom cache directory for my running program, but then I recreated that directory shortly. The program seems still be able to finish. Do you know if PyCUTEst created a new folder for cache when my custom directory was not there? I would like to delete the cache folder PyCUTEst if possible. Is there a way to print out the path to it? Also is it possible to print out the path to the default cache folder if I do not specify a custom one? I'm using Linux. Thanks!

@jfowkes
Copy link
Owner Author

jfowkes commented Mar 27, 2023

@KenZhenLin PyCUTEst will automatically create a new cache subdirectory for each CUTEst problem when it is first imported, the location for this will be inside $PYCUTEST_CACHE if it has been set. For example, for problem ROSENBR, PyCUTEst will automatically create the directory

$PYCUTEST_CACHE/pycutest_cache_holder/ROSENBR/

If you do not specify a custom cache directory, then pycutest_cache_holder will be created in your current working directory. To locate all the cache directories you can simply search your system for directories with the name pycutest_cache_holder.

@KenZhenLin
Copy link

KenZhenLin commented Mar 27, 2023

@KenZhenLin PyCUTEst will automatically create a new cache subdirectory for each CUTEst problem when it is first imported, the location for this will be inside $PYCUTEST_CACHE if it has been set. For example, for problem ROSENBR, PyCUTEst will automatically create the directory

$PYCUTEST_CACHE/pycutest_cache_holder/ROSENBR/

If you do not specify a custom cache directory, then pycutest_cache_holder will be created in your current working directory. To locate all the cache directories you can simply search your system for directories with the name pycutest_cache_holder.

Thank you! I suppose if, by mistake, $PYCUTEST_CACHE has been set to a location that does not exist, PyCUTEst will stop running and give me an error message, instead of continuing doing something else silently?

@jfowkes
Copy link
Owner Author

jfowkes commented Mar 27, 2023

@KenZhenLin yes it should give an error that the location does not exist.

@jfowkes
Copy link
Owner Author

jfowkes commented Jan 24, 2024

Closing as outdated due to new major release.

@jfowkes jfowkes closed this as completed Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cache issue An issue with the PyCUTEst Cache
Projects
None yet
Development

No branches or pull requests

4 participants