When lttng_live_server.py receives a trace path that doesn't exist
(perhaps because the user forgot to pass a --trace-path-prefix), it
gives:
Traceback (most recent call last):
File "lttng_live_server.py", line 1969, in <module>
trace_path_prefix,
File "lttng_live_server.py", line 1892, in _session_descriptors_from_path
traces.append(LttngTrace(path, metadata_sections, beacons))
File "lttng_live_server.py", line 1044, in __init__
assert os.path.isdir(trace_dir)
AssertionError
This is not very helpful, it hides details about the nature of the
problem. Remove the assert, and let the subsequent open fail, saying
why it failed. After the patch, it becomes:
Traceback (most recent call last):
File "lttng_live_server.py", line 1968, in <module>
trace_path_prefix,
File "lttng_live_server.py", line 1891, in _session_descriptors_from_path
traces.append(LttngTrace(path, metadata_sections, beacons))
File "lttng_live_server.py", line 1045, in __init__
self._create_metadata_stream(trace_dir, metadata_sections)
File "lttng_live_server.py", line 1099, in _create_metadata_stream
metadata_path, config_metadata_sections
File "lttng_live_server.py", line 974, in _split_metadata_sections
with open(metadata_file_path, "r") as metadata_file:
FileNotFoundError: [Errno 2] No such file or directory: 'live/split_metadata/metadata'
Remove an isfile assert for the same reason.
Change-Id: If4289515b2c27748dd90209049c623e02c940a03
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10899
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
def _build(self):
self._entries = [] # type: list[_LttngIndexEntryT]
- assert os.path.isfile(self._path)
with open(self._path, "rb") as f:
# Read header first
metadata_sections_json: Optional[tjson.ArrayVal],
beacons_json: Optional[tjson.ObjVal],
):
- assert os.path.isdir(trace_dir)
self._path = trace_dir
self._create_metadata_stream(trace_dir, metadata_sections_json)
self._create_data_streams(trace_dir, beacons_json)