Skip to content

Commit

Permalink
try to add progressbar
Browse files Browse the repository at this point in the history
  • Loading branch information
calum-chamberlain committed Jan 8, 2024
1 parent ae67f9a commit 0cfcab7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rt_eqcorrscan/database/database_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,15 @@ def _summarize_template(
return out


def _chunksize(n_tasks: int, max_workers: int = None) -> int:
def _chunksize(
n_tasks: int,
max_workers: int = None,
divisor: int = 100, # Used to give more up-to-date progress reports
) -> int:
max_workers = max_workers or cpu_count()
return n_tasks // (max_workers - 1)
chunksize = n_tasks // (max_workers - 1)
chunksize //= divisor
return chunksize


def _workers(executor) -> int:
Expand Down

0 comments on commit 0cfcab7

Please sign in to comment.