tools: add --auto flag to replay and cabana for loading routes from auto source
Added the --auto flag to cabana and replay, allowing routes to be loaded from the most suitable source based on logreader.py's auto-sourcing logic.
Usage example for loading a specified route with auto-sourcing:
cabana --auto <route>
replay --auto <route>
could this instead be default behavior instead of behind a flag?
I agree, can we replace the C++ implementation of finding sources with this?
It's better to hide this feature behind a flag for now. While --auto offers a convenient option, it doesn’t replace the default route-loading behavior in replay&cabana.
The current auto-sourcing implementation has significant limitations. It only loads rlogs and fails to manage non-contiguous segments, which undermines its compatibility with key replay and Cabana features. These require smooth transitions between rlog/qlog, HEVC/qcam, and reliable handling of segment gaps.
Additionally, the auto-sourcing process is inefficient. It validates every source file with file_exists, triggering excessive HTTP calls that slow down startup—often taking more than 10 seconds on my laptop. I've also encountered frequent DNS errors, even when using a VPN.
The --auto flag should be removed once these issues and limitations are resolved.
Using /a handles missing rlogs in the middle of segments btw
Getting
File "/home/batman/openpilot/tools/cabana/../lib/logreader.py", line 240, in auto_source
raise LogsUnavailable("auto_source could not find any valid source, exceptions for sources:\n - " +
LogsUnavailable: auto_source could not find any valid source, exceptions for sources:
- internal_source: Exception('unable to get max_segment_number. ensure you have access to this route or the route is public.')
- internal_source_zst: Exception('unable to get max_segment_number. ensure you have access to this route or the route is public.')
- openpilotci_source: Exception('unable to get max_segment_number. ensure you have access to this route or the route is public.')
- openpilotci_source_zst: Exception('unable to get max_segment_number. ensure you have access to this route or the route is public.')
- comma_api_source: UnauthorizedError('Unauthorized. Authenticate with tools/lib/auth.py')
- comma_car_segments_source: Exception('unable to get max_segment_number. ensure you have access to this route or the route is public.')
- testing_closet_source: Exception('Internal source not available')
but I'm authenticated
@sshane fixed. cabana use OPENPILOT_PREFIX to run multiple instances simultaneously. This was causing the path to auth.json to be prefixed, making it unreadable.
Tried it with a route from test_models:
batman@workstation-shane:~/openpilot$ cabana 0c94aa1e1296d7c6/2021-05-05--19-48-37/2 --auto
active services: can, carParams, driverEncodeIdx, roadEncodeIdx, wideRoadEncodeIdx
loading route
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::substr: __pos (which is 5) > this->size() (which is 4)
Aborted (core dumped)
This PR has had no activity for 9 days. It will be automatically closed in 2 days if there is no activity.
I tested the command cabana 0c94aa1e1296d7c6/2021-05-05--19-48-37/2 --auto and was able to run it successfully, with the messages displaying correctly in Cabana. However, it seems there’s still an underlying bug causing this issue.
This PR has had no activity for 9 days. It will be automatically closed in 2 days if there is no activity.
It works for me, can we merge?
This doesnt work for me, SegmentManager successfully loads the route, but cabana is stuck on "Loading segment data..." dialog
This PR has had no activity for 9 days. It will be automatically closed in 2 days if there is no activity.
This PR has been automatically closed due to inactivity. Feel free to re-open once activity resumes.
ty! this is a nice improvement