Skip to content

Commit

Permalink
Switch to Erts newer plugin system
Browse files Browse the repository at this point in the history
Avoids DeprecationWarnings.
  • Loading branch information
berland committed Oct 21, 2024
1 parent cfaffbc commit 1482a80
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 18 deletions.
10 changes: 3 additions & 7 deletions src/fmu/dataio/hook_implementations/jobs.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
from __future__ import annotations

try:
from ert.shared.plugins.plugin_manager import hook_implementation
from ert.shared.plugins.plugin_response import plugin_response
except ModuleNotFoundError:
from ert_shared.plugins.plugin_manager import hook_implementation
from ert_shared.plugins.plugin_response import plugin_response
from ert.plugins.plugin_manager import hook_implementation
from ert import plugin


@hook_implementation
@plugin_response(plugin_name="fmu_dataio")
@plugin(name="fmu_dataio")
def installable_workflow_jobs() -> dict:
return {}
7 changes: 2 additions & 5 deletions src/fmu/dataio/scripts/copy_preprocessed.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,15 @@

from fmu.dataio import ExportPreprocessedData

try:
from ert.shared.plugins.plugin_manager import hook_implementation
except ModuleNotFoundError:
from ert_shared.plugins.plugin_manager import hook_implementation
from ert.plugins.plugin_manager import hook_implementation

try:
from ert.config import ErtScript
except ImportError:
from res.job_queue import ErtScript

if TYPE_CHECKING:
from ert.shared.plugins.workflow_config import WorkflowConfigs
from ert.plugins.workflow_config import WorkflowConfigs

logger: Final = logging.getLogger(__name__)

Expand Down
7 changes: 2 additions & 5 deletions src/fmu/dataio/scripts/create_case_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@

from fmu.dataio import CreateCaseMetadata

try:
from ert.shared.plugins.plugin_manager import hook_implementation
except ModuleNotFoundError:
from ert_shared.plugins.plugin_manager import hook_implementation
from ert.plugins.plugin_manager import hook_implementation

try:
from ert.config import ErtScript
except ImportError:
from res.job_queue import ErtScript

if TYPE_CHECKING:
from ert.shared.plugins.workflow_config import WorkflowConfigs
from ert.plugins.workflow_config import WorkflowConfigs

logger: Final = logging.getLogger(__name__)
logger.setLevel(logging.CRITICAL)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_integration/test_hook_implementations.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from ert.shared.plugins.plugin_manager import ErtPluginManager
from ert.plugins.plugin_manager import ErtPluginManager

import fmu.dataio.hook_implementations.jobs
from fmu.dataio.scripts import copy_preprocessed, create_case_metadata
Expand Down

0 comments on commit 1482a80

Please sign in to comment.