You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to figure how to use rich.progress within and along with other context such as TaskGroup. But struggling to get it integrated and working, hoping someone can share some insight?
I have the below section of code (full code here) to download a list of file provided by source_list.
On a high level, it has a main function (_retrieve_recursive) with a context of TaskGroup, puts the source_list (and potential extra) into a queue, creates tasks, and call worker function (_download_query) to process the queue to download files.
Problem
My current problem is I cannot get a basic progress to correctly show the download progress, and was wondering what is the proper way to achieve it?
I tried wrapping the with Progress() as progress context before the group.create_task, and passing the progress object down to the _download_query function and update within the _download_query function. But no progress is showing up.
If I wrap the with Progress() as progress context before async with (session.get...), it gave me an error stating Only one live display may be active at once.
I tried creating a separate object completely with progress = Progress(...), and using that as a context for async with (session.get...), it seem to have created the progress and shows, but it shows incorrectly and some task doesn't show completion before the worker task ended, so it shows the progress bar stopped at below 100%.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I am trying to figure how to use
rich.progress
within and along with other context such as TaskGroup. But struggling to get it integrated and working, hoping someone can share some insight?I have the below section of code (full code here) to download a list of file provided by
source_list
.On a high level, it has a main function (
_retrieve_recursive
) with a context ofTaskGroup
, puts thesource_list
(and potential extra) into a queue, creates tasks, and call worker function (_download_query
) to process the queue to download files.Problem
My current problem is I cannot get a basic progress to correctly show the download progress, and was wondering what is the proper way to achieve it?
with Progress() as progress
context before thegroup.create_task
, and passing theprogress
object down to the_download_query
function and update within the_download_query
function. But no progress is showing up.with Progress() as progress
context beforeasync with (session.get...)
, it gave me an error statingOnly one live display may be active at once
.progress = Progress(...)
, and using that as a context forasync with (session.get...)
, it seem to have created the progress and shows, but it shows incorrectly and some task doesn't show completion before the worker task ended, so it shows the progress bar stopped at below 100%.Main Function
Worker Function
Beta Was this translation helpful? Give feedback.
All reactions