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 22, 2024
1 parent cfaffbc commit 4c49e43
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 20 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 import plugin
from ert.plugins.plugin_manager import hook_implementation


@hook_implementation
@plugin_response(plugin_name="fmu_dataio")
@plugin(name="fmu_dataio")
def installable_workflow_jobs() -> dict:
return {}
9 changes: 3 additions & 6 deletions src/fmu/dataio/scripts/copy_preprocessed.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@
from pathlib import Path
from typing import TYPE_CHECKING, Final

from fmu.dataio import ExportPreprocessedData
from ert.plugins.plugin_manager import hook_implementation

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

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
8 changes: 2 additions & 6 deletions src/fmu/dataio/scripts/create_case_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,17 @@
from typing import TYPE_CHECKING, Final

import yaml
from ert.plugins.plugin_manager import hook_implementation

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

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 4c49e43

Please sign in to comment.