• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Use tqdm progress bar with asyncio

Resolved: Use tqdm progress bar with asyncio

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I am trying to create a single progress bar that will be updated whenever an async task is done.
I have the following code
The above code generates a single progress bar as but it is not updated until all tasks are finished (it shows either 0% or 100% while there’s more than a single task)
I also tried using tqdm.asyncio.tqdm.gather
The above code generates multiple progress bars and as in the previous code block, it shows either 0% or 100%
My starting point was
Would appreciate your help on making it work with a single and dynamic progress bar

Answer:

If you call self.pbar.update(1) inside the run_scan scan method after creating concurrent tasks, each task will update the pbar for self. So your class should look like the following

If you have better answer, please add a comment about this, thank you!

progress-bar python python-3.x python-asyncio tqdm
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Shopware 400 Status Error “This value is too long. It should have 255 character or less.” When I Try Updating Database Table

01/04/2023

Resolved: Using AWK to count multiple patterns in a file

01/04/2023

Resolved: significance letter above bar graphic in wrong order

01/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.