Closed jypeter closed 1 year ago
OK, I have run my script again, after calling craz(force=True)
above, and I'm now getting results when calling clist
! I guess something was wrong in my cache.
>>> res_m1 = clist(age='-1')
Filtered objects = cache content
>>> type(res_m1)
<class 'list'>
>>> len(res_m1)
624
I have just read the csync documentation. My test above had not created any new content in the file (I just imported CliMAF) and I had nothing to sync. But would csync(update=True)
could have updated/corrected my cache? It's too late to test that now
Note: it may be possible to improve the results of the cache related functions, as described in #226
I'm completely lost!
I got the results above (624 crs in the cache) when staying in the script (I executed python -i script.py
to stay in interactive mode after script execution) and playing with the cache
I ran the same script with different parameters, but my script does not use cache controlling functions and I got a smaller content, when I thought I would get something bigger. The cache should keep on growing, unless you reset it, right?
>>> len(clist())
Content of CliMAF cache
336
>>> csync()
>>> len(clist())
Content of CliMAF cache
336
I then exited my script and started a clean python where I just imported CliMAF. Now if I call clist
, I get nothing, just like at the beginning of this issue! Does clist() give you valid information only about the current script??? This would be counter-intuitive as a cache is supposed to be persistent, by definition
[jypmce@ciclad-ng PMIP4]$ python
Python 3.6.11 | packaged by conda-forge | (default, Aug 5 2020, 20:09:42)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from climaf.api import *
python => 3.6.11 | packaged by conda-forge | (default, Aug 5 2020, 20:09:42)
[GCC 7.5.0]
---
Required softwares to run CliMAF => you are using the following versions/installations:
ncl 6.6.2 => /modfs/modtools/miniconda3/envs/analyse_3.6_test/bin/ncl
cdo 1.9.6 => /opt/nco/1.9/bin/cdo
nco (ncks) 4.5.2 => /opt/nco-4.5.2/bin/ncks
ncdump such => /prodigfs/ipslfs/dods/jservon/miniconda/envs/cesmep_env/bin/ncdump
Check stamping requirements
nco (ncatted) found -> /opt/nco-4.5.2/bin/ncatted
convert found -> /usr/bin/convert
pdftk found -> /usr/bin/pdftk
exiv2 found -> /ciclad-home/jservon/Evaluation/CliMAF/climaf_installs/climaf_V2.0.0/bin/exiv2
---
CliMAF version = 2.0.0
CliMAF install => /ciclad-home/jservon/Evaluation/CliMAF/climaf_installs/climaf_V2.0.0
Cache directory set to : /data/jypmce/climafcache (use $CLIMAF_CACHE if set)
Cache directory for remote data set to : /data/jypmce/climafcache/remote_data (use $CLIMAF_REMOTE_CACHE if set)
Available macros read from ~/.climaf.macros are : []
>>> len(clist())
Content of CliMAF cache
0
>>> len(clist())
Content of CliMAF cache
0
>>> csync()
>>> len(clist())
Content of CliMAF cache
0
>>>
There is still some content in my cache directory
[jypmce@ciclad-ng latest]$ du -sh /data/jypmce/climafcache
1.8G /data/jypmce/climafcache
[jypmce@ciclad-ng latest]$ find /data/jypmce/climafcache -type f | wc -l
961
Now if I run the same script again, it runs much faster because it obviously uses cached results (success!), but clist
returns an empty list, which seems strange, because the cache has been successfully used... I think that maybe this is the time to use csync
for updating both:
csync()
returns immediately and the following clist
output is still emptycsync(update=True)
takes a long time to run and the following clist
output reports failed
>>> clist()
Content of CliMAF cache
[]
>>> csync()
>>> clist()
Content of CliMAF cache
[]
>>> csync(update=True)
>>> len(clist())
Content of CliMAF cache
1
>>> clist()
Content of CliMAF cache
['failed']
The content of the cache on disk seems to remain unchanged
[jypmce@ciclad-ng latest]$ du -sh /data/jypmce/climafcache
1.8G /data/jypmce/climafcache
[jypmce@ciclad-ng latest]$ find /data/jypmce/climafcache -type f | wc -l
961
I wanted to know a bit more about the cache, searched the documentation, and found the cache related functions in the Functions for managing/viewing results page
I have an existing cache directory, with some content, but the
clist
function returns nothing. Is there something wrong with what I'm doing, or clist ?There is also a potential inconsistency in what is returned:
clist()
returns an empty list (that should not be empty)clist(age='+1')
returns None. This is kind of consistent with the empty list, but it would be better to still be an empty listChecking the content of the cache by hand
Using clist to check the cache
Playing with craz
I have called
craz()
after doing the tests above. If I call it with no arguments, it just lists the content of the cache directory. That's not in the craz documentation, but why not. The size of my cache directory remains unchanged (4.6G). I have checked my scripts and I was not usingcprotect
If I use
craz(force=True)
, the cache is cleaned. I have checked my scripts and I was not usingcprotect