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

ConfigurationError: Misconfigured setting 'package_cache_clean_limit': -1 should be instance of <class 'float'> #1802

Open
ruzette opened this issue Jul 26, 2024 · 3 comments

Comments

@ruzette
Copy link
Contributor

ruzette commented Jul 26, 2024

rezconfig.py throws when disabling package_cache_clean_limit to -1 as noted in the the docs inside rezconfig file.

This is written in the docs:

# If > 0, spend up to this many seconds cleaning the cache every time the cache
# is updated. This is a way to keep the cache size under control without having
# to periodically run :option:`rez-pkg-cache --clean`. Set to -1 to disable.
package_cache_clean_limit = 0.5

Setting package_cache_clean_limit = -1 throws:

16:00:38 ERROR    ConfigurationError: Misconfigured setting 'package_cache_clean_limit': -1 should be instance of <class 'float'>

Environment

  • OS Rocky Linux 8.9
  • Rez version 2.113
  • Rez python version: 3.11

To Reproduce

  1. Set package_cache_clean_limit = -1 as described in the doc
  2. Run rez-config

Expected behavior
It will not throw the error: 16:00:38 ERROR ConfigurationError: Misconfigured setting 'package_cache_clean_limit': -1 should be instance of <class 'float'> and disable the package_cache_clean_limit

Actual behavior
It throws an error:
16:00:38 ERROR ConfigurationError: Misconfigured setting 'package_cache_clean_limit': -1 should be instance of <class 'float'>

Regression
If applicable, state the last known rez version where the bug did not occur (delete this section if N/A).

@beatreichenbach
Copy link

I assume this would be fixed by: #1674

As a workaround you can use:

package_cache_clean_limit = -1.0

@JeanChristopheMorinPerso
Copy link
Member

@beatreichenbach #1674 wouldn't help much. It's typed as float. See https://github.com/AcademySoftwareFoundation/rez/blob/main/src%2Frez%2Fconfig.py#L452. We could instead change to type to be "int or float".

@beatreichenbach
Copy link

I haven't read how the current schema validation works at all, but pydantic can definitely cast int to float:

from pydantic import BaseModel

class Schema(BaseModel):
    package_cache_clean_limit: float

Schema.model_validate({'package_cache_clean_limit': int(-1)})

Again, sorry if this does not apply. I'm just saying using pydantic as a schema validation tool would probably solve this issue, no?

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

No branches or pull requests

3 participants