Skip to content

Commit

Permalink
Add ForwardModelStepWarning class
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-eq committed Sep 19, 2024
1 parent a9c5eb2 commit 3cbdc7d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/getting_started/howto/plugin_system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ Notice that by using :code:`installable_forward_model_steps`, validation can be
where the methods ``validate_pre_experiment`` or ``validate_pre_realization_run`` can
throw ``ForwardModelStepValidationError`` to indicate that the configuration of the
forward model step is invalid (which ert then handles gracefully and presents nicely
to the user).
to the user). If you want to show a warning in cases where the configuration cannot be
validated pre-experiment, you can use the ``ForwardModelStepWarning.warn(...)`` method.

To provide documentation for a forward model step given with
``installable_jobs``, use the :code:`job_documentation` name. If you are the
Expand Down
2 changes: 2 additions & 0 deletions src/ert/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
ForwardModelStepJSON,
ForwardModelStepPlugin,
ForwardModelStepValidationError,
ForwardModelStepWarning,
ForwardModelStepDocumentation,
)
from .data import MeasuredData
Expand All @@ -27,6 +28,7 @@
"ForwardModelStepJSON",
"ForwardModelStepPlugin",
"ForwardModelStepValidationError",
"ForwardModelStepWarning",
"JobState",
"JobStatus",
"LibresFacade",
Expand Down
2 changes: 2 additions & 0 deletions src/ert/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
ForwardModelStepJSON,
ForwardModelStepPlugin,
ForwardModelStepValidationError,
ForwardModelStepWarning,
)
from .gen_data_config import GenDataConfig
from .gen_kw_config import GenKwConfig, PriorDict, TransformFunction
Expand Down Expand Up @@ -62,6 +63,7 @@
"ForwardModelStepJSON",
"ForwardModelStepPlugin",
"ForwardModelStepValidationError",
"ForwardModelStepWarning",
"GenDataConfig",
"GenKwConfig",
"HookRuntime",
Expand Down
5 changes: 5 additions & 0 deletions src/ert/config/forward_model_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from typing_extensions import NotRequired, Unpack

from ert.config.parsing.config_errors import ConfigWarning
from ert.substitution_list import SubstitutionList

from .parsing import (
Expand All @@ -29,6 +30,10 @@ class ForwardModelStepValidationError(Exception):
"""


class ForwardModelStepWarning(ConfigWarning):
pass


class ForwardModelStepJSON(TypedDict):
"""
A dictionary containing information about how a forward model step should be run
Expand Down

0 comments on commit 3cbdc7d

Please sign in to comment.