diff --git a/mlonmcu/cli/common.py b/mlonmcu/cli/common.py index 429cccdd8..963f58474 100644 --- a/mlonmcu/cli/common.py +++ b/mlonmcu/cli/common.py @@ -17,6 +17,7 @@ # limitations under the License. # import os +import sys import multiprocessing import logging from mlonmcu.target import SUPPORTED_TARGETS @@ -27,6 +28,10 @@ from mlonmcu.logging import get_logger, set_log_level from .helper.parse import extract_config +from mlonmcu.logging import get_logger + +logger = get_logger() + def handle_logging_flags(args): if hasattr(args, "verbose") and hasattr(args, "quiet"): @@ -186,7 +191,7 @@ def kickoff_runs(args, until, context): per_stage = bool(config["runs_per_stage"]) elif "runs_per_stage" in context.environment.vars: per_stage = bool(context.environment.vars["runs_per_stage"]) - session.process_runs( + success = session.process_runs( until=until, per_stage=per_stage, num_workers=args.parallel, @@ -194,3 +199,6 @@ def kickoff_runs(args, until, context): context=context, export=True, ) + if not success: + logger.error("At least one error occured!") + sys.exit(1) diff --git a/mlonmcu/context.py b/mlonmcu/context.py index d866ef154..5c954b447 100644 --- a/mlonmcu/context.py +++ b/mlonmcu/context.py @@ -40,7 +40,6 @@ logger = get_logger() - def lookup_environment() -> Environment: """Helper function to automatically find a suitable environment. diff --git a/mlonmcu/session/run.py b/mlonmcu/session/run.py index 9070c4637..022dfed68 100644 --- a/mlonmcu/session/run.py +++ b/mlonmcu/session/run.py @@ -622,6 +622,9 @@ def get_report(self): post["Config"] = self.get_all_configs(omit_paths=True, omit_defaults=True, omit_globals=True) post["Postprocesses"] = self.get_all_postprocess_names() post["Comment"] = self.comment if len(self.comment) > 0 else "-" + if self.failing: + post["Failing"] = True + self.export_stage(RunStage.RUN, optional=self.export_optional) metrics = Metrics() diff --git a/mlonmcu/session/session.py b/mlonmcu/session/session.py index ed76ea637..e3dbe06c2 100644 --- a/mlonmcu/session/session.py +++ b/mlonmcu/session/session.py @@ -275,7 +275,7 @@ def _used_stages(runs, until): results = _join_workers(workers) if num_failures == 0: logger.info("All runs completed successfuly!") - elif num_failures == 0: + elif num_failures == num_runs: logger.error("All runs have failed to complete!") else: num_success = num_runs - num_failures @@ -315,6 +315,8 @@ def _used_stages(runs, until): if print_report: logger.info("Report:\n" + str(report.df)) + return num_failures == 0 + def __repr__(self): return f"Session(idx={self.idx},status={self.status},runs={self.runs})"