From 2cafdf456a8748b80d368506bdd693a01ebfbd98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Berland?= Date: Wed, 30 Oct 2024 13:02:57 +0100 Subject: [PATCH] Get path to eclrun from environment --- .../forward_models/run_reservoirsimulator.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ert/resources/forward_models/run_reservoirsimulator.py b/src/ert/resources/forward_models/run_reservoirsimulator.py index 608647df1ab..011554400f0 100755 --- a/src/ert/resources/forward_models/run_reservoirsimulator.py +++ b/src/ert/resources/forward_models/run_reservoirsimulator.py @@ -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 @@ -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: @@ -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)