Skip to content

Commit

Permalink
Use new plugin api
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindjahren committed Jul 24, 2024
1 parent 4951c74 commit 358267b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ classifiers = [
dynamic = ["version"]
dependencies = [
"resdata",
"ert>=10.2.0b8",
"ert>=10.2.0b13",
"importlib_metadata",
"importlib_resources",
"numpy",
Expand Down
11 changes: 4 additions & 7 deletions src/semeio/hook_implementations/forward_models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import importlib
from typing import Dict

import ert
import importlib_resources
from ert import hook_implementation, plugin_response

from semeio.forward_models import (
OTS,
Expand Down Expand Up @@ -47,8 +47,7 @@ def _get_forward_models_from_directory(directory: str) -> Dict[str, str]:
return {_remove_suffix(path.name, "_CONFIG"): str(path) for path in all_files}


@hook_implementation
@plugin_response(plugin_name="semeio")
@ert.plugin(name="semeio")
def installable_jobs():
return _get_forward_models_from_directory("forward_models/config")

Expand All @@ -62,8 +61,7 @@ def _get_module_variable_if_exists(module_name, variable_name, default=""):
return getattr(script_module, variable_name, default)


@hook_implementation
@plugin_response(plugin_name="semeio")
@ert.plugin(name="semeio")
def job_documentation(job_name):
forward_model_name = job_name
semeio_forward_models = set(installable_jobs().data.keys())
Expand Down Expand Up @@ -108,8 +106,7 @@ def job_documentation(job_name):
}


@hook_implementation
@plugin_response(plugin_name="semeio")
@ert.plugin(name="semeio")
def installable_forward_model_steps():
return [
Design2Params,
Expand Down
4 changes: 2 additions & 2 deletions src/semeio/workflows/ahm_analysis/ahmanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import warnings
from copy import deepcopy

import ert
import numpy as np
import pandas as pd
from ert import hook_implementation
from ert.analysis import ErtAnalysisError, SmootherSnapshot
from ert.storage import open_storage
from scipy.stats import ks_2samp
Expand Down Expand Up @@ -410,7 +410,7 @@ def _group_observations(facade, obs_keys, group_by):
return key_map


@hook_implementation
@ert.plugin(name="semeio")
def legacy_ertscript_workflow(config):
workflow = config.add_workflow(AhmAnalysisJob, "AHM_ANALYSIS")
workflow.description = DESCRIPTION
Expand Down
4 changes: 2 additions & 2 deletions src/semeio/workflows/csv_export2/csv_export2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys

import pandas as pd
from ert import ErtScript, hook_implementation
from ert import ErtScript, plugin
from fmu import ensemble

DESCRIPTION = """
Expand Down Expand Up @@ -141,7 +141,7 @@ def csv_export_parser():
return parser


@hook_implementation
@plugin(name="semeio")
def legacy_ertscript_workflow(config):
workflow = config.add_workflow(CsvExport2Job, "CSV_EXPORT2")
workflow.parser = csv_export_parser
Expand Down
4 changes: 2 additions & 2 deletions src/semeio/workflows/localisation/local_config_script.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ert import hook_implementation
import ert
from ert.config import ConfigValidationError
from resdata.grid import Grid

Expand Down Expand Up @@ -473,7 +473,7 @@ def validate(*_):
"""


@hook_implementation
@ert.plugin(name="semeio")
def legacy_ertscript_workflow(config):
workflow = config.add_workflow(LocalisationConfigJob, "LOCALISATION_JOB")
workflow.description = DESCRIPTION
Expand Down

0 comments on commit 358267b

Please sign in to comment.