diff --git a/src/ert/cli/main.py b/src/ert/cli/main.py index 0d10d412d44..fd305b896f0 100644 --- a/src/ert/cli/main.py +++ b/src/ert/cli/main.py @@ -13,7 +13,7 @@ from ert.cli.monitor import Monitor from ert.cli.workflow import execute_workflow from ert.config import ErtConfig, QueueSystem -from ert.ensemble_evaluator import EvaluatorServerConfig +from ert.ensemble_evaluator import EndEvent, EvaluatorServerConfig from ert.mode_definitions import ( ENSEMBLE_EXPERIMENT_MODE, ENSEMBLE_SMOOTHER_MODE, @@ -128,6 +128,7 @@ def run_cli(args: Namespace, plugin_manager: Optional[ErtPluginManager] = None) out = sys.stderr monitor = Monitor(out=out, color_always=args.color_always) thread.start() + end_event: Optional[EndEvent] = None try: end_event = monitor.monitor( status_queue, ert_config.analysis_config.log_path @@ -139,7 +140,7 @@ def run_cli(args: Namespace, plugin_manager: Optional[ErtPluginManager] = None) thread.join() storage.close() - if end_event.failed: + if end_event is not None and end_event.failed: # If monitor has not reported, give some info if the job failed msg = end_event.msg if args.disable_monitoring else "" raise ErtCliError(msg)