-
Notifications
You must be signed in to change notification settings - Fork 0
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
Failure to recover RE.md from files on startup #300
Comments
Thanks @strempfer for showing this example! |
Was able to reproduce locally by trying to open an older PersistentDict directory. ls
beamline_id#22 conda_prefix#24 databroker_catalog#23 iconfig#21 instrument_name#27 login_id#26 pid#28 proposal_id#29 scan_id#25 versions#30
ipython In [1]: from bluesky.utils import PersistentDict
In [2]: %xmode Verbose
Exception reporting mode: Verbose
In [3]: pd = PersistentDict(".")
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[3], line 1
----> 1 pd = PersistentDict(".")
PersistentDict = <class 'bluesky.utils.PersistentDict'>
File ~/.conda/envs/bluesky_2024_2/lib/python3.11/site-packages/bluesky/utils/__init__.py:775, in PersistentDict.__init__(self=<PersistentDict {}>, directory='.')
773 self._func = zict.Func(self._dump, self._load, self._file)
774 self._cache = {}
--> 775 self.reload()
self = <PersistentDict {}>
777 # Similar to flush() or _do_update(), but without reference to self
778 # to avoid circular reference preventing collection.
779 # NOTE: This still doesn't guarantee call on delete or gc.collect()!
780 # Explicitly call flush() if immediate write to disk required.
781 def finalize(zfile, cache, dump):
File ~/.conda/envs/bluesky_2024_2/lib/python3.11/site-packages/bluesky/utils/__init__.py:841, in PersistentDict.reload(self=<PersistentDict {}>)
839 def reload(self):
840 """Force a reload from disk, overwriting current cache"""
--> 841 self._cache = dict(self._func.items())
self._cache = {}
self = <PersistentDict {}>
self._func = <Func: _dump<->_load <File: ., mode="a", 10 elements>>
File ~/.conda/envs/bluesky_2024_2/lib/python3.11/site-packages/zict/func.py:74, in <genexpr>(.0=<generator object ItemsView.__iter__>)
73 def items(self) -> Iterator[tuple[KT, VT]]: # type: ignore
---> 74 return ((k, self.load(v)) for k, v in self.d.items())
self.load = <function PersistentDict._load at 0x7f21045d8ae0>
self = <Func: _dump<->_load <File: ., mode="a", 10 elements>>
self.d = <File: ., mode="a", 10 elements>
File <frozen _collections_abc>:861, in __iter__(self=ItemsView(<File: ., mode="a", 10 elements>))
File ~/.conda/envs/bluesky_2024_2/lib/python3.11/site-packages/zict/file.py:82, in File.__getitem__(self=<File: ., mode="a", 10 elements>, key='versions#30')
80 raise KeyError(key)
81 fn = os.path.join(self.directory, _safe_key(key))
---> 82 with open(fn, "rb") as fh:
fn = './versions%2330'
83 if self.memmap:
84 return memoryview(mmap.mmap(fh.fileno(), 0, access=mmap.ACCESS_READ))
FileNotFoundError: [Errno 2] No such file or directory: './versions%2330' |
The exception is correct, no such file |
A workaround for the situation is described. The problem occurs for any file ending in |
Failures have been observed from this code block:
bluesky_training/bluesky/instrument/framework/initialize.py
Lines 50 to 61 in d2b5f4c
When observed, the directory exists. Is there a mismatch between what is found and what is expected? In all observed cases so far, the problem is resolved by removing the directory defined by
bluesky_training/bluesky/instrument/iconfig.yml
Line 46 in d2b5f4c
Needs more documentation, such as the exact exception traceback.
The text was updated successfully, but these errors were encountered: