ignore rest

pull/35744/head
Shane Smiskol 2 months ago
parent 260a204462
commit 81427fdbf0
  1. 6
      system/athena/athenad.py
  2. 22
      system/athena/tests/test_athenad.py
  3. 2
      system/qcomgpsd/qcomgpsd.py
  4. 2
      tools/camerastream/compressed_vipc.py
  5. 2
      tools/sim/lib/simulated_sensors.py

@ -426,7 +426,7 @@ def uploadFilesToUrls(files_data: list[UploadFileDict]) -> UploadFilesToUrlRespo
path=path, path=path,
url=file.url, url=file.url,
headers=file.headers, headers=file.headers,
created_at=int(time.time() * 1000), created_at=int(time.time() * 1000), # noqa: TID251
id=None, id=None,
allow_cellular=file.allow_cellular, allow_cellular=file.allow_cellular,
priority=file.priority, priority=file.priority,
@ -580,7 +580,7 @@ def takeSnapshot() -> str | dict[str, str] | None:
def get_logs_to_send_sorted() -> list[str]: def get_logs_to_send_sorted() -> list[str]:
# TODO: scan once then use inotify to detect file creation/deletion # TODO: scan once then use inotify to detect file creation/deletion
curr_time = int(time.time()) curr_time = int(time.time()) # noqa: TID251
logs = [] logs = []
for log_entry in os.listdir(Paths.swaglog_root()): for log_entry in os.listdir(Paths.swaglog_root()):
log_path = os.path.join(Paths.swaglog_root(), log_entry) log_path = os.path.join(Paths.swaglog_root(), log_entry)
@ -617,7 +617,7 @@ def log_handler(end_event: threading.Event) -> None:
log_entry = log_files.pop() # newest log file log_entry = log_files.pop() # newest log file
cloudlog.debug(f"athena.log_handler.forward_request {log_entry}") cloudlog.debug(f"athena.log_handler.forward_request {log_entry}")
try: try:
curr_time = int(time.time()) curr_time = int(time.time()) # noqa: TID251
log_path = os.path.join(Paths.swaglog_root(), log_entry) log_path = os.path.join(Paths.swaglog_root(), log_entry)
setxattr(log_path, LOG_ATTR_NAME, int.to_bytes(curr_time, 4, sys.byteorder)) setxattr(log_path, LOG_ATTR_NAME, int.to_bytes(curr_time, 4, sys.byteorder))
with open(log_path) as f: with open(log_path) as f:

@ -190,11 +190,11 @@ class TestAthenadMethods:
fn = self._create_file('qlog', data=os.urandom(10000 * 1024)) fn = self._create_file('qlog', data=os.urandom(10000 * 1024))
upload_fn = fn + ('.zst' if compress else '') upload_fn = fn + ('.zst' if compress else '')
item = athenad.UploadItem(path=upload_fn, url="http://localhost:1238", headers={}, created_at=int(time.time()*1000), id='') item = athenad.UploadItem(path=upload_fn, url="http://localhost:1238", headers={}, created_at=int(time.time()*1000), id='') # noqa: TID251
with pytest.raises(requests.exceptions.ConnectionError): with pytest.raises(requests.exceptions.ConnectionError):
athenad._do_upload(item) athenad._do_upload(item)
item = athenad.UploadItem(path=upload_fn, url=f"{host}/qlog.zst", headers={}, created_at=int(time.time()*1000), id='') item = athenad.UploadItem(path=upload_fn, url=f"{host}/qlog.zst", headers={}, created_at=int(time.time()*1000), id='') # noqa: TID251
resp = athenad._do_upload(item) resp = athenad._do_upload(item)
assert resp.status_code == 201 assert resp.status_code == 201
@ -226,7 +226,7 @@ class TestAthenadMethods:
@with_upload_handler @with_upload_handler
def test_upload_handler(self, host): def test_upload_handler(self, host):
fn = self._create_file('qlog.zst') fn = self._create_file('qlog.zst')
item = athenad.UploadItem(path=fn, url=f"{host}/qlog.zst", headers={}, created_at=int(time.time()*1000), id='', allow_cellular=True) item = athenad.UploadItem(path=fn, url=f"{host}/qlog.zst", headers={}, created_at=int(time.time()*1000), id='', allow_cellular=True) # noqa: TID251
athenad.upload_queue.put_nowait(item) athenad.upload_queue.put_nowait(item)
self._wait_for_upload() self._wait_for_upload()
@ -242,7 +242,7 @@ class TestAthenadMethods:
mock_put = mocker.patch('openpilot.system.athena.athenad.UPLOAD_SESS.put') mock_put = mocker.patch('openpilot.system.athena.athenad.UPLOAD_SESS.put')
mock_put.return_value.__enter__.return_value.status_code = status mock_put.return_value.__enter__.return_value.status_code = status
fn = self._create_file('qlog.zst') fn = self._create_file('qlog.zst')
item = athenad.UploadItem(path=fn, url=f"{host}/qlog.zst", headers={}, created_at=int(time.time()*1000), id='', allow_cellular=True) item = athenad.UploadItem(path=fn, url=f"{host}/qlog.zst", headers={}, created_at=int(time.time()*1000), id='', allow_cellular=True) # noqa: TID251
athenad.upload_queue.put_nowait(item) athenad.upload_queue.put_nowait(item)
self._wait_for_upload() self._wait_for_upload()
@ -257,7 +257,7 @@ class TestAthenadMethods:
def test_upload_handler_timeout(self): def test_upload_handler_timeout(self):
"""When an upload times out or fails to connect it should be placed back in the queue""" """When an upload times out or fails to connect it should be placed back in the queue"""
fn = self._create_file('qlog.zst') fn = self._create_file('qlog.zst')
item = athenad.UploadItem(path=fn, url="http://localhost:44444/qlog.zst", headers={}, created_at=int(time.time()*1000), id='', allow_cellular=True) item = athenad.UploadItem(path=fn, url="http://localhost:44444/qlog.zst", headers={}, created_at=int(time.time()*1000), id='', allow_cellular=True) # noqa: TID251
item_no_retry = replace(item, retry_count=MAX_RETRY_COUNT) item_no_retry = replace(item, retry_count=MAX_RETRY_COUNT)
athenad.upload_queue.put_nowait(item_no_retry) athenad.upload_queue.put_nowait(item_no_retry)
@ -278,7 +278,7 @@ class TestAthenadMethods:
@with_upload_handler @with_upload_handler
def test_cancel_upload(self): def test_cancel_upload(self):
item = athenad.UploadItem(path="qlog.zst", url="http://localhost:44444/qlog.zst", headers={}, item = athenad.UploadItem(path="qlog.zst", url="http://localhost:44444/qlog.zst", headers={},
created_at=int(time.time()*1000), id='id', allow_cellular=True) created_at=int(time.time()*1000), id='id', allow_cellular=True) # noqa: TID251
athenad.upload_queue.put_nowait(item) athenad.upload_queue.put_nowait(item)
dispatcher["cancelUpload"](item.id) dispatcher["cancelUpload"](item.id)
@ -312,7 +312,7 @@ class TestAthenadMethods:
@with_upload_handler @with_upload_handler
def test_list_upload_queue_current(self, host: str): def test_list_upload_queue_current(self, host: str):
fn = self._create_file('qlog.zst') fn = self._create_file('qlog.zst')
item = athenad.UploadItem(path=fn, url=f"{host}/qlog.zst", headers={}, created_at=int(time.time()*1000), id='', allow_cellular=True) item = athenad.UploadItem(path=fn, url=f"{host}/qlog.zst", headers={}, created_at=int(time.time()*1000), id='', allow_cellular=True) # noqa: TID251
athenad.upload_queue.put_nowait(item) athenad.upload_queue.put_nowait(item)
self._wait_for_upload() self._wait_for_upload()
@ -331,7 +331,7 @@ class TestAthenadMethods:
path=fp, path=fp,
url=f"http://localhost:44444/{fn}", url=f"http://localhost:44444/{fn}",
headers={}, headers={},
created_at=int(time.time()*1000), created_at=int(time.time()*1000), # noqa: TID251
id='', id='',
allow_cellular=True, allow_cellular=True,
priority=i priority=i
@ -343,7 +343,7 @@ class TestAthenadMethods:
def test_list_upload_queue(self): def test_list_upload_queue(self):
item = athenad.UploadItem(path="qlog.zst", url="http://localhost:44444/qlog.zst", headers={}, item = athenad.UploadItem(path="qlog.zst", url="http://localhost:44444/qlog.zst", headers={},
created_at=int(time.time()*1000), id='id', allow_cellular=True) created_at=int(time.time()*1000), id='id', allow_cellular=True) # noqa: TID251
athenad.upload_queue.put_nowait(item) athenad.upload_queue.put_nowait(item)
items = dispatcher["listUploadQueue"]() items = dispatcher["listUploadQueue"]()
@ -356,8 +356,8 @@ class TestAthenadMethods:
assert len(items) == 0 assert len(items) == 0
def test_upload_queue_persistence(self): def test_upload_queue_persistence(self):
item1 = athenad.UploadItem(path="_", url="_", headers={}, created_at=int(time.time()), id='id1') item1 = athenad.UploadItem(path="_", url="_", headers={}, created_at=int(time.time()), id='id1') # noqa: TID251
item2 = athenad.UploadItem(path="_", url="_", headers={}, created_at=int(time.time()), id='id2') item2 = athenad.UploadItem(path="_", url="_", headers={}, created_at=int(time.time()), id='id2') # noqa: TID251
athenad.upload_queue.put_nowait(item1) athenad.upload_queue.put_nowait(item1)
athenad.upload_queue.put_nowait(item2) athenad.upload_queue.put_nowait(item2)

@ -286,7 +286,7 @@ def main() -> NoReturn:
continue continue
if DEBUG: if DEBUG:
print(f"{time.time():.4f}: got log: {log_type} len {len(log_payload)}") print(f"{time.time():.4f}: got log: {log_type} len {len(log_payload)}") # noqa: TID251
if log_type == LOG_GNSS_OEMDRE_MEASUREMENT_REPORT: if log_type == LOG_GNSS_OEMDRE_MEASUREMENT_REPORT:
msg = messaging.new_message('qcomGnss', valid=True) msg = messaging.new_message('qcomGnss', valid=True)

@ -62,7 +62,7 @@ def decoder(addr, vipc_server, vst, nvidia, W, H, debug=False):
print("waiting for iframe") print("waiting for iframe")
continue continue
time_q.append(time.monotonic()) time_q.append(time.monotonic())
network_latency = (int(time.time()*1e9) - evta.unixTimestampNanos)/1e6 network_latency = (int(time.time()*1e9) - evta.unixTimestampNanos)/1e6 # noqa: TID251
frame_latency = ((evta.idx.timestampEof/1e9) - (evta.idx.timestampSof/1e9))*1000 frame_latency = ((evta.idx.timestampEof/1e9) - (evta.idx.timestampSof/1e9))*1000
process_latency = ((evt.logMonoTime/1e9) - (evta.idx.timestampEof/1e9))*1000 process_latency = ((evt.logMonoTime/1e9) - (evta.idx.timestampEof/1e9))*1000

@ -53,7 +53,7 @@ class SimulatedSensors:
for _ in range(10): for _ in range(10):
dat = messaging.new_message('gpsLocationExternal', valid=True) dat = messaging.new_message('gpsLocationExternal', valid=True)
dat.gpsLocationExternal = { dat.gpsLocationExternal = {
"unixTimestampMillis": int(time.time() * 1000), "unixTimestampMillis": int(time.time() * 1000), # noqa: TID251
"flags": 1, # valid fix "flags": 1, # valid fix
"horizontalAccuracy": 1.0, "horizontalAccuracy": 1.0,
"verticalAccuracy": 1.0, "verticalAccuracy": 1.0,

Loading…
Cancel
Save