forked from google/langfun
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lf.concurrent_map
: support TimeIt summary in progress bar.
This allows users to use `pg.timeit` to measure the execution time/statistics of code blocks in the thread func. Example: ```python def foo(x): with pg.timeit('foo'): time.sleep(1) with pg.timeit('bar'): time.sleep(0.5) return x for _, _, _ in lf.concurrent_map(foo, range(10), max_workers=2, show_progress=True): pass ``` The progress bar will print status like: ``` 10/10 [00:06<00:00, 1.35it/s, Succeeded=100.00% (10/10), Failed=0.00% (0/10), AvgDuration=1.50s, TimeIt=foo (1.0s, 10/10), bar (0.5s, 10/10)] ``` PiperOrigin-RevId: 679439662
- Loading branch information
Showing
7 changed files
with
122 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters