Skip to content

Commit

Permalink
Use only one fm shell script list
Browse files Browse the repository at this point in the history
  • Loading branch information
yngve-sk committed Oct 15, 2024
1 parent 59d80e7 commit 5e356b7
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
10 changes: 10 additions & 0 deletions src/ert/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import os
import pathlib

all_shell_script_fm_steps = [
x.split(".py")[0]
for x in os.listdir(pathlib.Path(__file__).resolve().parent / "shell_scripts")
if not x.startswith("__")
]

__all__ = ["all_shell_script_fm_steps"]
8 changes: 6 additions & 2 deletions src/everest/bin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import colorama
from colorama import Fore

from ert.resources import all_shell_script_fm_steps
from ert.simulator.batch_simulator_context import Status
from everest.config import EverestConfig
from everest.detached import (
Expand All @@ -20,7 +21,6 @@
start_monitor,
)
from everest.export import export
from everest.jobs import shell_commands
from everest.simulator import JOB_FAILURE, JOB_RUNNING, JOB_SUCCESS
from everest.strings import EVEREST

Expand Down Expand Up @@ -269,7 +269,11 @@ def _get_jobs_status(progress):
def _filter_jobs(self, progress):
if not self._show_all_jobs:
progress = [
[job for job in progress_list if job["name"] not in shell_commands]
[
job
for job in progress_list
if job["name"] not in all_shell_script_fm_steps
]
for progress_list in progress
]
return progress
Expand Down
14 changes: 0 additions & 14 deletions src/everest/jobs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,3 @@ def fetch_script(script_name):


_inject_scripts()

# Note: Must be kept in sync with shell scripts on ERT-side
# (which is also not expected to change frequently/drastically)
shell_commands = (
"careful_copy_file",
"copy_directory",
"copy_file",
"delete_directory",
"delete_file",
"make_directory",
"make_symlink",
"move_file",
"symlink",
)
4 changes: 2 additions & 2 deletions src/everest/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ropt.plan import OptimizationPlanRunner
from seba_sqlite import SqliteStorage

import everest
from ert.resources import all_shell_script_fm_steps
from everest.config import EverestConfig
from everest.optimizer.everest2ropt import everest2ropt
from everest.plugins.site_config_env import PluginSiteConfigEnv
Expand Down Expand Up @@ -217,7 +217,7 @@ def extract(path_str, key):
for fms in progress_queue.steps:
if (
not self._display_all_jobs
and fms.name in everest.jobs.shell_commands
and fms.name in all_shell_script_fm_steps
):
continue
realization = extract(fms.std_out_file, "geo_realization")
Expand Down
12 changes: 6 additions & 6 deletions tests/everest/entry_points/test_everest_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import pytest

from ert.resources import all_shell_script_fm_steps
from everest.bin.everest_script import everest_entry
from everest.bin.kill_script import kill_entry
from everest.bin.monitor_script import monitor_entry
Expand All @@ -15,7 +16,6 @@
everserver_status,
update_everserver_status,
)
from everest.jobs import shell_commands
from everest.simulator import JOB_SUCCESS
from ieverest.bin.ieverest_script import ieverest_entry
from tests.everest.utils import capture_streams
Expand Down Expand Up @@ -43,7 +43,7 @@ def build_job(
"simulation": 0,
}

shell_cmd_jobs = [build_job(name=command) for command in shell_commands]
shell_cmd_jobs = [build_job(name=command) for command in all_shell_script_fm_steps]
all_jobs = [
*shell_cmd_jobs,
build_job(name="make_pancakes"),
Expand Down Expand Up @@ -315,7 +315,7 @@ def test_everest_entry_show_all_jobs(
# of forward model jobs
with capture_streams() as (out, _):
everest_entry([CONFIG_FILE_MINIMAL, "--show-all-jobs"])
for cmd in shell_commands:
for cmd in all_shell_script_fm_steps:
assert cmd in out.getvalue()


Expand Down Expand Up @@ -350,7 +350,7 @@ def test_everest_entry_no_show_all_jobs(
# in the list of forward model jobs
with capture_streams() as (out, _):
everest_entry([CONFIG_FILE_MINIMAL])
for cmd in shell_commands:
for cmd in all_shell_script_fm_steps:
assert cmd not in out.getvalue()

# Check the other jobs are still there
Expand Down Expand Up @@ -386,7 +386,7 @@ def test_monitor_entry_show_all_jobs(

with capture_streams() as (out, _):
monitor_entry([CONFIG_FILE_MINIMAL, "--show-all-jobs"])
for cmd in shell_commands:
for cmd in all_shell_script_fm_steps:
assert cmd in out.getvalue()


Expand Down Expand Up @@ -417,7 +417,7 @@ def test_monitor_entry_no_show_all_jobs(
# in the list of forward model jobs
with capture_streams() as (out, _):
monitor_entry([CONFIG_FILE_MINIMAL])
for cmd in shell_commands:
for cmd in all_shell_script_fm_steps:
assert cmd not in out.getvalue()

# Check the other jobs are still there
Expand Down
4 changes: 2 additions & 2 deletions tests/everest/test_shell_scripts.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from ert.resources import all_shell_script_fm_steps
from everest.config.everest_config import EverestConfig, get_system_installed_jobs
from everest.jobs import shell_commands
from tests.everest.utils import relpath


def test_everest_shell_commands_list():
# Check list of defined shell commands are part of the list of ert
# installed system jobs
system_installed_jobs = get_system_installed_jobs()
for command_name in shell_commands:
for command_name in all_shell_script_fm_steps:
assert command_name in system_installed_jobs


Expand Down

0 comments on commit 5e356b7

Please sign in to comment.