Skip to content

Commit 1278c0c

Browse files
committed
Remove WebvizErt and BaseService
and get_priors from dark storage endpoints (only used by webviz ert)
1 parent a12af2f commit 1278c0c

File tree

8 files changed

+2
-361
lines changed

8 files changed

+2
-361
lines changed

src/ert/__main__.py

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from ert.namespace import Namespace
3737
from ert.plugins import ErtRuntimePlugins, get_site_plugins, setup_site_logging
3838
from ert.run_models.multiple_data_assimilation import MultipleDataAssimilationConfig
39-
from ert.services import ErtServer, WebvizErt
39+
from ert.services import ErtServer
4040
from ert.shared.status.utils import get_ert_memory_usage
4141
from ert.shared.storage.command import add_parser_options as ert_api_add_parser_options
4242
from ert.storage import ErtStorageException, ErtStoragePermissionError
@@ -62,56 +62,6 @@ def run_ert_storage(args: Namespace, _: ErtRuntimePlugins | None = None) -> None
6262
server.wait()
6363

6464

65-
def run_webviz_ert(args: Namespace, _: ErtRuntimePlugins | None = None) -> None:
66-
try:
67-
import webviz_ert # type: ignore # noqa
68-
except ImportError as err:
69-
raise ValueError(
70-
"Running `ert vis` requires that webviz_ert is installed"
71-
) from err
72-
73-
kwargs: dict[str, Any] = {"verbose": args.verbose}
74-
ert_config = ErtConfig.with_plugins(get_site_plugins()).from_file(args.config)
75-
76-
os.chdir(ert_config.config_path)
77-
ens_path = ert_config.ens_path
78-
79-
# Changing current working directory means we need to
80-
# only use the base name of the config file path
81-
kwargs["ert_config"] = os.path.basename(args.config)
82-
kwargs["project"] = os.path.abspath(ens_path)
83-
try:
84-
with ErtServer.init_service(project=Path(ens_path).absolute()) as storage:
85-
storage.wait_until_ready()
86-
print(
87-
"""
88-
-----------------------------------------------------------
89-
90-
Starting up Webviz-ERT. This might take more than a minute.
91-
92-
-----------------------------------------------------------
93-
"""
94-
)
95-
webviz_kwargs = {
96-
"experimental_mode": args.experimental_mode,
97-
"verbose": args.verbose,
98-
"title": kwargs.get("ert_config", "ERT - Visualization tool"),
99-
"project": kwargs.get("project", os.getcwd()),
100-
}
101-
with WebvizErt.start_server(**webviz_kwargs) as webviz_ert_server:
102-
webviz_ert_server.wait()
103-
except PermissionError as pe:
104-
print(f"Error: {pe}", file=sys.stderr)
105-
print(
106-
"Cannot start or connect to storage service due to permission issues.",
107-
file=sys.stderr,
108-
)
109-
print(
110-
"This is most likely due to another user starting ERT using this storage",
111-
file=sys.stderr,
112-
)
113-
114-
11565
def strip_error_message_and_raise_exception(validated: ValidationStatus) -> None:
11666
error = validated.message()
11767
error = re.sub(r"\<[^>]*\>", " ", error)
@@ -303,19 +253,6 @@ def get_ert_parser(parser: ArgumentParser | None = None) -> ArgumentParser:
303253
ert_api_parser.set_defaults(func=run_ert_storage)
304254
ert_api_add_parser_options(ert_api_parser)
305255

306-
ert_vis_parser = subparsers.add_parser(
307-
"vis",
308-
description="Launch webviz-driven visualization tool.",
309-
)
310-
ert_vis_parser.set_defaults(func=run_webviz_ert)
311-
ert_vis_parser.add_argument("--name", "-n", type=str, default="Webviz-ERT")
312-
ert_vis_parser.add_argument(
313-
"--experimental-mode",
314-
action="store_true",
315-
help="Feature flag for enabling experimental plugins",
316-
)
317-
ert_api_add_parser_options(ert_vis_parser) # ert vis shares args with ert api
318-
319256
# test_run_parser
320257
test_run_description = f"Run '{TEST_RUN_MODE}' in cli"
321258
test_run_parser = subparsers.add_parser(

src/ert/dark_storage/endpoints/experiments.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from ert.config import SurfaceConfig
77
from ert.dark_storage import json_schema as js
88
from ert.dark_storage.common import get_storage
9-
from ert.shared.storage.extraction import create_priors
109
from ert.storage import Storage
1110

1211
router = APIRouter(tags=["experiment"])
@@ -26,7 +25,6 @@ def get_experiments(
2625
id=experiment.id,
2726
name=experiment.name,
2827
ensemble_ids=[ens.id for ens in experiment.ensembles],
29-
priors=create_priors(experiment),
3028
userdata={},
3129
parameters={
3230
group: [config.model_dump()]
@@ -62,7 +60,6 @@ def get_experiment_by_id(
6260
name=experiment.name,
6361
id=experiment.id,
6462
ensemble_ids=[ens.id for ens in experiment.ensembles],
65-
priors=create_priors(experiment),
6663
userdata={},
6764
parameters={
6865
group: [config.model_dump()]

src/ert/dark_storage/json_schema/experiment.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class ExperimentIn(_Experiment):
2222
class ExperimentOut(_Experiment):
2323
id: UUID
2424
ensemble_ids: list[UUID]
25-
priors: Mapping[str, dict[str, Any]]
2625
userdata: Mapping[str, Any]
2726
parameters: Mapping[str, list[dict[str, Any]]]
2827
responses: Mapping[str, list[dict[str, Any]]]

src/ert/services/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
from .ert_server import BaseServiceExit, ErtServer, ServerBootFail
2-
from .webviz_ert_service import WebvizErt
32

4-
__all__ = ["BaseServiceExit", "ErtServer", "ServerBootFail", "WebvizErt"]
3+
__all__ = ["BaseServiceExit", "ErtServer", "ServerBootFail"]

src/ert/services/_base_service.py

Lines changed: 0 additions & 226 deletions
This file was deleted.

src/ert/services/webviz_ert_service.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)