mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-27 18:03:54 +08:00
tools/logreader: add desc arg to run_across_segments() (#33226)
old-commit-hash: 9e648e428d
This commit is contained in:
@@ -293,11 +293,11 @@ are uploaded or auto fallback to qlogs with '/a' selector at the end of the rout
|
||||
def _run_on_segment(self, func, i):
|
||||
return func(self._get_lr(i))
|
||||
|
||||
def run_across_segments(self, num_processes, func):
|
||||
def run_across_segments(self, num_processes, func, desc=None):
|
||||
with multiprocessing.Pool(num_processes) as pool:
|
||||
ret = []
|
||||
num_segs = len(self.logreader_identifiers)
|
||||
for p in tqdm.tqdm(pool.imap(partial(self._run_on_segment, func), range(num_segs)), total=num_segs):
|
||||
for p in tqdm.tqdm(pool.imap(partial(self._run_on_segment, func), range(num_segs)), total=num_segs, desc=desc):
|
||||
ret.extend(p)
|
||||
return ret
|
||||
|
||||
|
||||
Reference in New Issue
Block a user