Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

kraft/cmd: Add option to build on x CPUs #125

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions kraft/cmd/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ def kraft_build(ctx, verbose=False, workdir=None, fetch=True, prepare=True,

n_proc = None
if fast:
# This simply set the `-j` flag to -1 which signals to make to use all
# cores.
n_proc = -1
n_proc = int(fast)

if fetch:
app.fetch()
Expand Down Expand Up @@ -128,8 +126,11 @@ def kraft_build(ctx, verbose=False, workdir=None, fetch=True, prepare=True,
)
@click.option(
'--fast', '-j', 'fast',
help='Use all CPU cores to build the application.',
is_flag=True
help='Use more CPU cores to build the application.',
type=int,
is_flag=False,
flag_value=-1,
default=1
)
@click.option(
'--force', '-F', 'force_build',
Expand Down
7 changes: 5 additions & 2 deletions kraft/cmd/up.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,11 @@
)
@click.option(
'--fast', '-j', 'fast',
help='Use all CPU cores to build the application.',
is_flag=True
help='Use more CPU cores to build the application.',
type=int,
is_flag=False,
flag_value=-1,
default=1
)
@click.option(
'--with-makefile', '-M', 'create_makefile',
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
atpbar >= 1.0.0
cached_property >= 1.5.1
# Required pypi modules
click >= 7.0
click >= 8.1
click-log >= 0.3.2
colorama >= 0.4.3
cookiecutter >= 1.7.0
Expand Down