Skip to content

Commit

Permalink
Remove RunStatus as it is never setp
Browse files Browse the repository at this point in the history
  • Loading branch information
xjules committed Oct 18, 2023
1 parent cc6c38e commit 9f8a433
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 53 deletions.
2 changes: 0 additions & 2 deletions src/ert/job_queue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def root() -> str:
from .job_queue_node import JobQueueNode # noqa
from .job_status import JobStatus # noqa
from .queue import JobQueue # noqa
from .run_status import RunStatus # noqa
from .submit_status import SubmitStatus # noqa
from .thread_status import ThreadStatus # noqa
from .workflow_runner import WorkflowJobRunner, WorkflowRunner # noqa
Expand All @@ -114,7 +113,6 @@ def root() -> str:
"JobQueueNode",
"JobStatus",
"SubmitStatus",
"RunStatus",
"ThreadStatus",
"WorkflowJobRunner",
"WorkflowRunner",
Expand Down
6 changes: 0 additions & 6 deletions src/ert/job_queue/run_status.py

This file was deleted.

2 changes: 0 additions & 2 deletions src/ert/run_arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import TYPE_CHECKING, Optional

if TYPE_CHECKING:
from ert.job_queue import RunStatus
from ert.storage import EnsembleAccessor


Expand All @@ -20,4 +19,3 @@ class RunArg: # pylint: disable=too-many-instance-attributes
# Below here is legacy related to Everest
queue_index: Optional[int] = None
submitted: bool = False
run_status: Optional[RunStatus] = None
12 changes: 0 additions & 12 deletions src/ert/run_models/base_run_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
LegacyStep,
RealizationBuilder,
)
from ert.job_queue import RunStatus
from ert.libres_facade import LibresFacade
from ert.run_context import RunContext
from ert.storage import StorageAccessor
Expand Down Expand Up @@ -326,20 +325,9 @@ def run_ensemble_evaluator(
run_context.iteration,
).run_and_get_successful_realizations()

self.deactivate_failed_jobs(run_context)

run_context.sim_fs.sync()
return totalOk

@staticmethod
def deactivate_failed_jobs(run_context: RunContext) -> None:
for iens, run_arg in enumerate(run_context):
if run_context.is_active(iens) and run_arg.run_status in (
RunStatus.JOB_LOAD_FAILURE,
RunStatus.JOB_RUN_FAILURE,
):
run_context.deactivate_realization(iens)

def _build_ensemble(
self,
run_context: RunContext,
Expand Down
18 changes: 3 additions & 15 deletions src/ert/simulator/simulation_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numpy as np

from ert.config import HookRuntime
from ert.job_queue import Driver, JobQueue, JobQueueManager, RunStatus
from ert.job_queue import Driver, JobQueue, JobQueueManager
from ert.realization_state import RealizationState
from ert.run_context import RunContext
from ert.runpaths import Runpaths
Expand All @@ -26,7 +26,7 @@

def _run_forward_model(
ert: "EnKFMain", job_queue: "JobQueue", run_context: "RunContext"
) -> int:
) -> bool:
# run simplestep
for realization_nr in run_context.active_realizations:
run_context.sim_fs.update_realization_state(
Expand Down Expand Up @@ -70,21 +70,9 @@ def _run_forward_model(
jqm = JobQueueManager(job_queue, queue_evaluators)
jqm.execute_queue()

# deactivate failed realizations
totalOk = 0
for index, run_arg in enumerate(run_context):
if run_context.is_active(index):
if run_arg.run_status in (
RunStatus.JOB_LOAD_FAILURE,
RunStatus.JOB_RUN_FAILURE,
):
run_context.deactivate_realization(index)
else:
totalOk += 1

run_context.sim_fs.sync()

return totalOk
return True


class SimulationContext:
Expand Down
17 changes: 1 addition & 16 deletions tests/unit_tests/run_models/test_base_run_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@

import pytest

from ert.job_queue import RunStatus
from ert.run_models import BaseRunModel
from ert.run_models.run_arguments import (
EnsembleExperimentRunArguments,
)
from ert.run_models.run_arguments import EnsembleExperimentRunArguments


def test_base_run_model_supports_restart(minimum_case):
Expand Down Expand Up @@ -63,18 +60,6 @@ def test_failed_realizations(initials, completed, any_failed, failures):
assert brm.has_failed_realizations() == any_failed


@pytest.mark.usefixtures("use_tmpdir")
def test_run_ensemble_evaluator():
run_arg = MagicMock()
run_arg.run_status = RunStatus.JOB_LOAD_FAILURE
run_context = MagicMock()
run_context.__iter__.return_value = [run_arg]
run_context.is_active.return_value = True
BaseRunModel.deactivate_failed_jobs(run_context)

run_context.deactivate_realization.assert_called_with(0)


@pytest.mark.parametrize(
"run_path, number_of_iterations, start_iteration, active_mask, expected",
[
Expand Down

0 comments on commit 9f8a433

Please sign in to comment.