diff --git a/audeer/core/utils.py b/audeer/core/utils.py index 4186c59..c6db4e3 100644 --- a/audeer/core/utils.py +++ b/audeer/core/utils.py @@ -541,6 +541,7 @@ def run_tasks( multiprocessing: bool = False, progress_bar: bool = False, task_description: str = None, + maximum_refresh_time: float = None, ) -> typing.Sequence[typing.Any]: r"""Run parallel tasks using multprocessing. @@ -562,6 +563,11 @@ def run_tasks( progress_bar: show a progress bar task_description: task description that will be displayed next to progress bar + maximum_refresh_time: refresh the progress bar + at least every ``maximum_refresh_time`` seconds, + using another thread. + If ``None``, + no refreshing is enforced Examples: >>> power = lambda x, n: x**n @@ -578,6 +584,7 @@ def run_tasks( params, total=len(params), desc=task_description, + maximum_refresh_time=maximum_refresh_time, disable=not progress_bar, ) as pbar: for index, param in enumerate(pbar): @@ -592,6 +599,7 @@ def run_tasks( with audeer_progress_bar( total=len(params), desc=task_description, + maximum_refresh_time=maximum_refresh_time, disable=not progress_bar, ) as pbar: futures = []