Skip to content

Commit

Permalink
can replay: get logs in parallel (commaai#24960)
Browse files Browse the repository at this point in the history
* get can replay segs in parallel

* total not needed
  • Loading branch information
sshane authored and spektor56 committed Jul 1, 2022
1 parent cfff0da commit c4ff463
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tools/replay/can_replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
import os
import time
import threading
import multiprocessing
from tqdm import tqdm

os.environ['FILEREADER_CACHE'] = '1'

from common.basedir import BASEDIR
from common.realtime import config_realtime_process, Ratekeeper, DT_CTRL
from selfdrive.boardd.boardd import can_capnp_to_can_list
from tools.lib.logreader import LogReader
from tools.plotjuggler.juggle import load_segment
from panda import Panda

try:
Expand Down Expand Up @@ -94,11 +95,10 @@ def connect():
ROUTE = "77611a1fac303767/2020-03-24--09-50-38"
REPLAY_SEGS = list(range(10, 16)) # route has 82 segments available
CAN_MSGS = []
for i in tqdm(REPLAY_SEGS):
log_url = f"https://commadataci.blob.core.windows.net/openpilotci/{ROUTE}/{i}/rlog.bz2"
lr = LogReader(log_url)
CAN_MSGS += [can_capnp_to_can_list(m.can) for m in lr if m.which() == 'can']

logs = [f"https://commadataci.blob.core.windows.net/openpilotci/{ROUTE}/{i}/rlog.bz2" for i in REPLAY_SEGS]
with multiprocessing.Pool(24) as pool:
for lr in tqdm(pool.map(load_segment, logs)):
CAN_MSGS += [can_capnp_to_can_list(m.can) for m in lr if m.which() == 'can']

# set both to cycle ignition
IGN_ON = int(os.getenv("ON", "0"))
Expand Down

0 comments on commit c4ff463

Please sign in to comment.