Skip to content

Commit

Permalink
Get path to eclrun from environment
Browse files Browse the repository at this point in the history
  • Loading branch information
berland committed Oct 31, 2024
1 parent c056328 commit 2cafdf4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/ert/resources/forward_models/run_reservoirsimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from collections import namedtuple
from pathlib import Path
from random import random
from typing import List, Literal, Optional
from typing import List, Literal, Optional, Union

import resfo

Expand Down Expand Up @@ -146,13 +146,15 @@ def __init__(

self.bypass_flowrun: bool = False

_runner_abspath: Optional[str] = None
_runner_abspath: Optional[Union[str, Path]] = None
if simulator in ["eclipse", "e300"]:
_runner_abspath: Optional[str] = shutil.which("eclrun")
_eclrun_path: str = os.environ.get("ECLRUN_PATH", "")
_runner_abspath = shutil.which(Path(_eclrun_path) / "eclrun")
if _runner_abspath is None:
raise RuntimeError("eclrun not installed")
else:
_runner_abspath: Optional[str] = shutil.which("flowrun")
_flowrun_path: str = os.environ.get("FLOWRUN_PATH", "")
_runner_abspath = shutil.which(Path(_flowrun_path) / "flowrun")
if _runner_abspath is None:
_runner_abspath = shutil.which("flow")
if _runner_abspath is None:
Expand All @@ -163,7 +165,7 @@ def __init__(
"MPI runs not supported without a flowrun wrapper"
)
self.bypass_flowrun = True
self.runner_abspath: str = _runner_abspath
self.runner_abspath: str = str(_runner_abspath)

data_file = ecl_case_to_data_file(ecl_case)

Expand Down

0 comments on commit 2cafdf4

Please sign in to comment.