Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid possible UnboundLocalError for end_event #9028

Merged
merged 1 commit into from
Oct 23, 2024
Merged
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
5 changes: 3 additions & 2 deletions src/ert/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -124,6 +124,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
Expand All @@ -135,7 +136,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)
Loading