mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-19 08:53:54 +08:00
Add testing closet to LogReader source (#33242)
* add testing closet to logreader source * check source availability * use internal_source_available
This commit is contained in:
@@ -7,10 +7,10 @@ from openpilot.tools.lib.url_file import URLFile
|
||||
DATA_ENDPOINT = os.getenv("DATA_ENDPOINT", "http://data-raw.comma.internal/")
|
||||
|
||||
|
||||
def internal_source_available():
|
||||
def internal_source_available(url=DATA_ENDPOINT):
|
||||
try:
|
||||
hostname = urlparse(DATA_ENDPOINT).hostname
|
||||
port = urlparse(DATA_ENDPOINT).port or 80
|
||||
hostname = urlparse(url).hostname
|
||||
port = urlparse(url).port or 80
|
||||
with socket.socket(socket.AF_INET,socket.SOCK_STREAM) as s:
|
||||
s.connect((hostname, port))
|
||||
return True
|
||||
|
||||
@@ -174,6 +174,12 @@ def comma_car_segments_source(sr: SegmentRange, mode=ReadMode.RLOG) -> LogPaths:
|
||||
return [get_comma_segments_url(sr.route_name, seg) for seg in sr.seg_idxs]
|
||||
|
||||
|
||||
def testing_closet_source(sr: SegmentRange, mode=ReadMode.RLOG) -> LogPaths:
|
||||
if not internal_source_available('http://testing.comma.life'):
|
||||
raise InternalUnavailableException
|
||||
return [f"http://testing.comma.life/download/{sr.route_name.replace('|', '/')}/{seg}/rlog" for seg in sr.seg_idxs]
|
||||
|
||||
|
||||
def direct_source(file_or_url: str) -> LogPaths:
|
||||
return [file_or_url]
|
||||
|
||||
@@ -195,7 +201,7 @@ def auto_source(sr: SegmentRange, mode=ReadMode.RLOG) -> LogPaths:
|
||||
if mode == ReadMode.SANITIZED:
|
||||
return comma_car_segments_source(sr, mode)
|
||||
|
||||
SOURCES: list[Source] = [internal_source, internal_source_zst, openpilotci_source, comma_api_source, comma_car_segments_source,]
|
||||
SOURCES: list[Source] = [internal_source, internal_source_zst, openpilotci_source, comma_api_source, comma_car_segments_source, testing_closet_source,]
|
||||
exceptions = {}
|
||||
|
||||
# for automatic fallback modes, auto_source needs to first check if rlogs exist for any source
|
||||
|
||||
Reference in New Issue
Block a user