Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Erts newer plugin system #856

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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