pybes3._cache_numba
Rare Help for Users
There is rare help for users in this page. pybes3._cache_numba.md
defines internal functions and never exposed to users.
cache_auto_clear(sources, caches, silent=True, force=False)
Automatically clear the Numba cache if the source files have changed.
Due to limitation of numba cache, modification of external files like geometry data will not trigger the cache clearing. This function is designed to trigger the cache clearing when those external files are modified.
This function compares the modification times of the source files with the modification times of the cached files. If any source file is newer than the cached files, the numba cache in cache directory will be cleared.
Note
There is no need to trace *.py
files, as numba will automatically
clear the cache when the source code is modified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sources
|
Union[Union[Path, str], list[Union[Path, str]]]
|
A glob pattern or a list of glob patterns to match the source files. |
required |
caches
|
Union[Union[Path, str], list[Union[Path, str]]]
|
A glob pattern or a list of glob patterns to match the cached files. |
required |
silent
|
bool
|
If True, suppresses the output messages. |
True
|
force
|
bool
|
If True, forces the cache clearing even if the source files are not newer. |
False
|
Returns:
Type | Description |
---|---|
list[str]
|
list[str]: A list of cache files that were removed. |
Source code in src/pybes3/_cache_numba.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
check_numba_cache()
Check the cache files and remove them if the source files are newer. This function should be called when the module is imported.
When environment variable PYBES3_NUMBA_CACHE_SILENT
is set to 1,
the function will print out removal messages.
Source code in src/pybes3/_cache_numba.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
clear_numba_cache()
Clear the cache files regardless of the source files.
When environment variable PYBES3_NUMBA_CACHE_SILENT
is set to 1,
the function will print out removal messages.
Source code in src/pybes3/_cache_numba.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|