We have seen this a couple times in the wild, where reading a stream with 0 events raises a ValueError deep inside databroker. See detail box for full traceback.
```
File /srv/conda/envs/notebook/lib/python3.9/site-packages/tiled/adapters/mapping.py:300, in (.0)
294 def _items_slice(self, start, stop, direction):
295 # A goal of this implementation is to avoid iterating over
296 # self._mapping.values() because self._mapping may be a OneShotCachedMap which
297 # only constructs its values at access time. With this in mind, we
298 # identify the key(s) of interest and then only access those values.
299 yield from (
--> 300 (key, self._mapping[key])
301 for key in self._keys_slice(start, stop, direction)
302 )
File /srv/conda/envs/notebook/lib/python3.9/site-packages/tiled/utils.py:126, in OneShotCachedMap.__getitem__(self, key)
123 v = self.__mapping[key]
124 if isinstance(v, _OneShotCachedMapWrapper):
125 # TODO handle exceptions?
--> 126 v = self.__mapping[key] = v.func()
127 return v
File /srv/conda/envs/notebook/lib/python3.9/site-packages/databroker/mongo_normalized.py:1482, in MongoAdapter._build_event_stream(self, run_start_uid, stream_name, is_complete)
1466 # We need each of the sub-dicts to have a consistent length. If
1467 # Events are still being added, we need to choose a consistent
1468 # cutoff. If not, we need to know the length anyway. Note that this
1469 # is not the same thing as the number of Event documents in the
1470 # stream because seq_num may be repeated, nonunique.
1471 cursor = self._event_collection.aggregate(
1472 [
1473 {"$match": {"descriptor": {"$in": event_descriptor_uids}}},
(...)
1480 ]
1481 )
-> 1482 (result,) = cursor
1483 cutoff_seq_num = (
1484 1 + result["highest_seq_num"]
1485 ) # `1 +` because we use a half-open interval
1486 object_names = event_descriptors[0]["object_keys"]
ValueError: not enough values to unpack (expected 1, got 0)
```
Here are list of uids from the NSLS-II PDF databroker that have this issue. (To be precise, they all have some issue and at least one---probably all--have this issue.)
We have seen this a couple times in the wild, where reading a stream with 0 events raises a
ValueError
deep inside databroker. See detail box for full traceback.Here are list of uids from the NSLS-II PDF databroker that have this issue. (To be precise, they all have some issue and at least one---probably all--have this issue.)