From f2a90edc8e31dd709666516ca00ef5f5b7794071 Mon Sep 17 00:00:00 2001 From: Jeff Goeders Date: Fri, 27 Sep 2024 08:53:08 -0600 Subject: [PATCH] Allow -k 0 to ninja --- scripts/run.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/scripts/run.py b/scripts/run.py index 3db71173..335800e8 100644 --- a/scripts/run.py +++ b/scripts/run.py @@ -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: @@ -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) @@ -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: @@ -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(