rethinkpriorities / squigglepy

Squiggle programming language for intuitive probabilistic estimation features in Python
MIT License
65 stars 8 forks source link

Thorny nondeterministic caching bug #64

Open peterhurford opened 8 months ago

peterhurford commented 8 months ago
FileNotFoundError                         Traceback (most recent call last)
File <timed exec>:2

File ~/.pyenv/versions/3.11.0/envs/dev/lib/python3.11/site-packages/squigglepy/bayes.py:243, in bayesnet(event_fn, n, find, conditional_on, reduce_fn, raw, memcache, memcache_load, memcache_save, reload_cache, dump_cache_file, load_cache_file, cache_file_primary, verbose, cores)
    241 for c in range(cores):
    242     _tick_tqdm(pbar, 1)
--> 243     with open("test-core-{}.sqcache".format(c), "rb") as infile:
    244         events += decoder.decode(infile.read())
    245     os.remove("test-core-{}.sqcache".format(c))

FileNotFoundError: [Errno 2] No such file or directory: 'test-core-3.sqcache'

It's a different cache file each time. Bug is nondeterministic (works ~50% of the time).