Skip to content

Commit

Permalink
Expect ForwardModelStepPlugin for plugin fms
Browse files Browse the repository at this point in the history
  • Loading branch information
Yngve S. Kristiansen committed Jun 17, 2024
1 parent f29176b commit bf8059b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/ert/config/ert_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from .forward_model_step import (
ForwardModelStep,
ForwardModelStepJSON,
ForwardModelStepPlugin,
ForwardModelStepValidationError,
)
from .model_config import ModelConfig
Expand Down Expand Up @@ -133,17 +134,17 @@ def __post_init__(self) -> None:

@staticmethod
def with_plugins(
forward_model_step_classes: List[Type[ForwardModelStep]],
forward_model_step_classes: List[Type[ForwardModelStepPlugin]],
) -> Type["ErtConfig"]:
preinstalled_fm_steps: Dict[str, ForwardModelStep] = {}
preinstalled_fm_steps: Dict[str, ForwardModelStepPlugin] = {}
for fm_step_subclass in forward_model_step_classes:
fm_step = fm_step_subclass()
preinstalled_fm_steps[fm_step.name] = fm_step

class ErtConfigWithPlugins(ErtConfig):
PREINSTALLED_FORWARD_MODEL_STEPS: ClassVar[Dict[str, ForwardModelStep]] = (
preinstalled_fm_steps
)
PREINSTALLED_FORWARD_MODEL_STEPS: ClassVar[
Dict[str, ForwardModelStepPlugin]
] = preinstalled_fm_steps

assert issubclass(ErtConfigWithPlugins, ErtConfig)
return ErtConfigWithPlugins
Expand Down
6 changes: 4 additions & 2 deletions src/ert/shared/plugins/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

import pluggy

from ert.config.forward_model_step import ForwardModelStep
from ert.config.forward_model_step import (
ForwardModelStepPlugin,
)
from ert.shared.plugins.workflow_config import WorkflowConfigs

_PLUGIN_NAMESPACE = "ert"
Expand Down Expand Up @@ -85,7 +87,7 @@ def get_help_links(self) -> Dict[str, Any]:
@property
def forward_model_steps(
self,
) -> List[Type[ForwardModelStep]]:
) -> List[Type[ForwardModelStepPlugin]]:
fm_steps_listed = [
resp.data for resp in self.hook.installable_forward_model_steps()
]
Expand Down

0 comments on commit bf8059b

Please sign in to comment.