Skip to content

Commit

Permalink
Allow -k 0 to ninja
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoeders committed Sep 27, 2024
1 parent a6c366c commit f2a90ed
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions scripts/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,23 @@ def __init__(self):
self.deps = None
self.flow_arguments = None
self.num_threads = None

def run_flow(self, flow, designs, *, flow_arguments="", check_tools=True, num_threads=1):
self.ignore_errors = False

def run_flow(
self,
flow,
designs,
*,
flow_arguments="",
check_tools=True,
num_threads=1,
ignore_errors=False,
):
"""Run one ore more designs with a given flow."""
self.designs = ensure_tuple(designs)
self.flow = flow
self.num_threads = num_threads
self.ignore_errors = ignore_errors
if check_tools:
success = external_tools.check_flow(self.flow)
if not success:
Expand Down Expand Up @@ -58,6 +69,8 @@ def __run_ninja(self):

# run the build.ninja file
cmd = ["ninja"]
if self.ignore_errors:
cmd += ["-k", "0"]
if self.num_threads:
cmd += ["-j", str(self.num_threads)]
proc = subprocess.Popen(cmd)
Expand Down Expand Up @@ -101,6 +114,11 @@ def parse_args(args):
type=int,
help="Number of jobs to run in parallel",
)
parser.add_argument(
"--ignore_errors",
action="store_true",
help="Ignore errors and continue running the flow (Pass -k 0 to ninja)",
)

# try to parse the arguments, and if none are provided, print the flow choices
try:
Expand Down Expand Up @@ -144,6 +162,7 @@ def parse_args(args):
flow_arguments=parsed_args.flow_arguments,
check_tools=not parsed_args.no_tool_checks,
num_threads=parsed_args.jobs,
ignore_errors=parsed_args.ignore_errors,
)
else:
ApplicationRunner().run_yaml(
Expand Down

0 comments on commit f2a90ed

Please sign in to comment.