Skip to content

Commit

Permalink
🎨 accept n_jobs=-1
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasParistech committed Jun 5, 2024
1 parent 88d0513 commit f001fd7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dobble/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,4 @@ def main(masks_folder: str,
for card_idx, (symbols, scale_targets) in enumerate(zip(cards, scale_targets_per_card))]

multiprocess(generate_card, list_kwargs, tqdm_title="Generate Cards",
n_jobs=1 if DEBUG or DEBUG_FINAL else None)
n_jobs=1 if DEBUG or DEBUG_FINAL else -1)
2 changes: 2 additions & 0 deletions dobble/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def multiprocess(process_func: Callable[..., None],

if n_jobs is None:
n_jobs = math.floor(0.8 * cpu_count())
elif n_jobs < 0:
n_jobs = cpu_count()

n_jobs = min(n_jobs, cpu_count())

Expand Down

0 comments on commit f001fd7

Please sign in to comment.