@dylanmcreynolds mentioned that the exceptions resulting from, say, a missing or otherwise un-openable external file do not show the direct cause of the problem. If logMessage could enable a way access the exception method on Python loggers, the full traceback could be logged. Here's an example of the detail provided in the chained exception. This particular error is due to a corrupted HDF5 file. The error from h5py (OSError: Unable to open file (bad object header version number)) is shown.
[E 200117 13:35:29 resource_health_check:38] Cannot read the data for {'spec': 'AD_HDF5', 'resource_path': '2019/12/12/781a1fff-1626-440f-aa2e_000000.h5', 'root': '/NSLS2/xf18id1/DATA/Andor', 'resource_kwargs': {'frame_per_point': 20}, 'path_semantics': 'posix', 'uid': 'ac35fdc8-c3a5-45b1-b412-5aef5a170c04', 'run_start': '88cfe974-f569-4270-9a87-828322a13ed2'}
Traceback (most recent call last):
File "/opt/conda_envs/resource-health-check/lib/python3.7/site-packages/event_model/__init__.py", line 565, in get_handler
**resource['resource_kwargs'])
File "/opt/conda_envs/resource-health-check/lib/python3.7/site-packages/area_detector_handlers/handlers.py", line 165, in __init__
filename=filename, key=hardcoded_key, frame_per_point=frame_per_point
File "/opt/conda_envs/resource-health-check/lib/python3.7/site-packages/area_detector_handlers/handlers.py", line 108, in __init__
self.open()
File "/opt/conda_envs/resource-health-check/lib/python3.7/site-packages/area_detector_handlers/handlers.py", line 125, in open
self._file = h5py.File(self._filename, "r")
File "/opt/conda_envs/resource-health-check/lib/python3.7/site-packages/h5py/_hl/files.py", line 408, in __init__
swmr=swmr)
File "/opt/conda_envs/resource-health-check/lib/python3.7/site-packages/h5py/_hl/files.py", line 173, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 88, in h5py.h5f.open
OSError: Unable to open file (bad object header version number)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "resource_health_check.py", line 33, in validate_resource
filler.get_handler(resource)
File "/opt/conda_envs/resource-health-check/lib/python3.7/site-packages/event_model/__init__.py", line 570, in get_handler
f"with Resource document {resource}.") from err
event_model.EventModelError: Error instantiating handler class <class 'area_detector_handlers.handlers.AreaDetectorHDF5Handler'> with Resource document {'spec': 'AD_HDF5', 'resource_path': '2019/12/12/781a1fff-1626-440f-aa2e_000000.h5', 'root': '/NSLS2/xf18id1/DATA/Andor', 'resource_kwargs': {'frame_per_point': 20}, 'path_semantics': 'posix', 'uid': 'ac35fdc8-c3a5-45b1-b412-5aef5a170c04', 'run_start': '88cfe974-f569-4270-9a87-828322a13ed2'}
@dylanmcreynolds mentioned that the exceptions resulting from, say, a missing or otherwise un-openable external file do not show the direct cause of the problem. If
logMessagecould enable a way access theexceptionmethod on Python loggers, the full traceback could be logged. Here's an example of the detail provided in the chained exception. This particular error is due to a corrupted HDF5 file. The error from h5py (OSError: Unable to open file (bad object header version number)) is shown.