Skip to content

Commit

Permalink
Rename --num-procs-eval to --num-parallel-evals
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage committed Oct 9, 2024
1 parent 76308b1 commit 3a636a9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions nixpkgs_review/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ def common_flags() -> list[CommonFlag]:
help="Extra nixpkgs config to pass to `import <nixpkgs>`",
),
CommonFlag(
"--num-procs-eval",
"--num-parallel-evals",
type=int,
default=1,
help="Number of parallel `nix-env` processes to run simultaneously (warning, can imply heavy RAM usage)",
help="Number of parallel `nix-env`/`nix eval` processes to run simultaneously (warning, can imply heavy RAM usage)",
),
]

Expand Down
2 changes: 1 addition & 1 deletion nixpkgs_review/cli/pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def pr_command(args: argparse.Namespace) -> str:
build_graph=args.build_graph,
nixpkgs_config=nixpkgs_config,
extra_nixpkgs_config=args.extra_nixpkgs_config,
n_procs_eval=args.num_procs_eval,
num_parallel_evals=args.num_parallel_evals,
)
contexts.append((pr, builddir.path, review.build_pr(pr)))
except NixpkgsReviewError as e:
Expand Down
8 changes: 4 additions & 4 deletions nixpkgs_review/nix.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ def multi_system_eval(
attr_names_per_system: dict[System, set[str]],
allow: AllowedFeatures,
nix_path: str,
n_procs: int,
n_threads: int,
) -> dict[System, list[Attr]]:
results: dict[System, list[Attr]] = {}
with concurrent.futures.ThreadPoolExecutor(max_workers=n_procs) as executor:
with concurrent.futures.ThreadPoolExecutor(max_workers=n_threads) as executor:
future_to_system = {
executor.submit(
nix_eval,
Expand Down Expand Up @@ -305,7 +305,7 @@ def nix_build(
build_graph: str,
nix_path: str,
nixpkgs_config: Path,
n_procs_eval: int,
n_threads: int,
) -> dict[System, list[Attr]]:
if not attr_names_per_system:
info("Nothing to be built.")
Expand All @@ -315,7 +315,7 @@ def nix_build(
attr_names_per_system,
allow,
nix_path,
n_procs=n_procs_eval,
n_threads=n_threads,
)

filtered_per_system: dict[System, list[str]] = {}
Expand Down
16 changes: 8 additions & 8 deletions nixpkgs_review/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def __init__(
skip_packages_regex: list[Pattern[str]] = [],
checkout: CheckoutOption = CheckoutOption.MERGE,
sandbox: bool = False,
n_procs_eval: int = 1,
num_parallel_evals: int = 1,
) -> None:
self.builddir = builddir
self.build_args = build_args
Expand Down Expand Up @@ -141,7 +141,7 @@ def __init__(
self.build_graph = build_graph
self.nixpkgs_config = nixpkgs_config
self.extra_nixpkgs_config = extra_nixpkgs_config
self.n_procs_eval = n_procs_eval
self.num_parallel_evals = num_parallel_evals

def worktree_dir(self) -> str:
return str(self.builddir.worktree_dir)
Expand Down Expand Up @@ -186,7 +186,7 @@ def build_commit(
self.builddir.nix_path,
self.systems,
self.allow,
n_procs=self.n_procs_eval,
n_threads=self.num_parallel_evals,
)

if reviewed_commit is None:
Expand All @@ -199,7 +199,7 @@ def build_commit(
self.builddir.nix_path,
self.systems,
self.allow,
n_procs=self.n_procs_eval,
n_threads=self.num_parallel_evals,
check_meta=True,
)

Expand Down Expand Up @@ -253,7 +253,7 @@ def build(
self.build_graph,
self.builddir.nix_path,
self.nixpkgs_config,
self.n_procs_eval,
self.num_parallel_evals,
)

def build_pr(self, pr_number: int) -> dict[System, list[Attr]]:
Expand Down Expand Up @@ -447,11 +447,11 @@ def list_packages(
nix_path: str,
systems: set[System],
allow: AllowedFeatures,
n_procs: int,
n_threads: int,
check_meta: bool = False,
) -> dict[System, list[Package]]:
results: dict[System, list[Package]] = {}
with concurrent.futures.ThreadPoolExecutor(max_workers=n_procs) as executor:
with concurrent.futures.ThreadPoolExecutor(max_workers=n_threads) as executor:
future_to_system = {
executor.submit(
_list_packages_system,
Expand Down Expand Up @@ -644,7 +644,7 @@ def review_local_revision(
build_graph=args.build_graph,
nixpkgs_config=nixpkgs_config,
extra_nixpkgs_config=args.extra_nixpkgs_config,
n_procs_eval=args.num_procs_eval,
num_parallel_evals=args.num_procs_eval,
)
review.review_commit(builddir.path, args.branch, commit, staged, print_result)
return builddir.path

0 comments on commit 3a636a9

Please sign in to comment.