ert 16.0.9__py3-none-any.whl → 19.0.0rc2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. _ert/events.py +19 -2
  2. _ert/forward_model_runner/client.py +6 -2
  3. _ert/forward_model_runner/fm_dispatch.py +9 -6
  4. _ert/forward_model_runner/reporting/event.py +1 -0
  5. _ert/forward_model_runner/runner.py +1 -2
  6. _ert/utils.py +12 -0
  7. ert/__main__.py +58 -38
  8. ert/analysis/_enif_update.py +8 -4
  9. ert/analysis/_es_update.py +19 -6
  10. ert/analysis/_update_commons.py +16 -6
  11. ert/base_model_context.py +1 -1
  12. ert/cli/main.py +17 -12
  13. ert/cli/monitor.py +7 -0
  14. ert/config/__init__.py +17 -6
  15. ert/config/_create_observation_dataframes.py +118 -21
  16. ert/config/_get_num_cpu.py +1 -1
  17. ert/config/_observations.py +91 -2
  18. ert/config/_read_summary.py +74 -328
  19. ert/config/design_matrix.py +62 -23
  20. ert/config/distribution.py +1 -1
  21. ert/config/ensemble_config.py +9 -17
  22. ert/config/ert_config.py +155 -58
  23. ert/config/everest_control.py +234 -0
  24. ert/config/{everest_constraints_config.py → everest_response.py} +27 -15
  25. ert/config/field.py +99 -90
  26. ert/config/forward_model_step.py +122 -17
  27. ert/config/gen_data_config.py +5 -10
  28. ert/config/gen_kw_config.py +11 -41
  29. ert/config/known_response_types.py +14 -0
  30. ert/config/parameter_config.py +1 -33
  31. ert/config/parsing/_option_dict.py +10 -2
  32. ert/config/parsing/config_errors.py +1 -1
  33. ert/config/parsing/config_keywords.py +2 -1
  34. ert/config/parsing/config_schema.py +23 -11
  35. ert/config/parsing/config_schema_deprecations.py +3 -3
  36. ert/config/parsing/config_schema_item.py +26 -11
  37. ert/config/parsing/context_values.py +3 -3
  38. ert/config/parsing/file_context_token.py +1 -1
  39. ert/config/parsing/observations_parser.py +6 -2
  40. ert/config/parsing/queue_system.py +9 -0
  41. ert/config/parsing/schema_item_type.py +1 -0
  42. ert/config/queue_config.py +42 -50
  43. ert/config/response_config.py +0 -8
  44. ert/config/rft_config.py +275 -0
  45. ert/config/summary_config.py +3 -8
  46. ert/config/surface_config.py +73 -26
  47. ert/config/workflow_fixtures.py +2 -1
  48. ert/config/workflow_job.py +135 -54
  49. ert/dark_storage/client/__init__.py +2 -2
  50. ert/dark_storage/client/_session.py +4 -4
  51. ert/dark_storage/client/client.py +2 -2
  52. ert/dark_storage/common.py +12 -3
  53. ert/dark_storage/compute/misfits.py +11 -7
  54. ert/dark_storage/endpoints/compute/misfits.py +6 -4
  55. ert/dark_storage/endpoints/ensembles.py +4 -0
  56. ert/dark_storage/endpoints/experiment_server.py +30 -24
  57. ert/dark_storage/endpoints/experiments.py +2 -2
  58. ert/dark_storage/endpoints/observations.py +8 -6
  59. ert/dark_storage/endpoints/parameters.py +4 -12
  60. ert/dark_storage/endpoints/responses.py +24 -5
  61. ert/dark_storage/json_schema/ensemble.py +3 -0
  62. ert/dark_storage/json_schema/experiment.py +1 -1
  63. ert/data/_measured_data.py +6 -5
  64. ert/ensemble_evaluator/__init__.py +8 -1
  65. ert/ensemble_evaluator/config.py +2 -1
  66. ert/ensemble_evaluator/evaluator.py +81 -29
  67. ert/ensemble_evaluator/event.py +6 -0
  68. ert/ensemble_evaluator/snapshot.py +3 -1
  69. ert/ensemble_evaluator/state.py +1 -0
  70. ert/field_utils/__init__.py +8 -0
  71. ert/field_utils/field_utils.py +228 -15
  72. ert/field_utils/grdecl_io.py +1 -1
  73. ert/field_utils/roff_io.py +1 -1
  74. ert/gui/__init__.py +5 -2
  75. ert/gui/ertnotifier.py +1 -1
  76. ert/gui/ertwidgets/__init__.py +23 -16
  77. ert/gui/ertwidgets/analysismoduleedit.py +2 -2
  78. ert/gui/ertwidgets/checklist.py +1 -1
  79. ert/gui/ertwidgets/closabledialog.py +2 -0
  80. ert/gui/ertwidgets/copyablelabel.py +2 -0
  81. ert/gui/ertwidgets/create_experiment_dialog.py +3 -1
  82. ert/gui/ertwidgets/ensembleselector.py +2 -2
  83. ert/gui/ertwidgets/listeditbox.py +2 -0
  84. ert/gui/ertwidgets/models/__init__.py +2 -0
  85. ert/gui/ertwidgets/models/activerealizationsmodel.py +5 -1
  86. ert/gui/ertwidgets/models/path_model.py +1 -1
  87. ert/gui/ertwidgets/models/targetensemblemodel.py +5 -1
  88. ert/gui/ertwidgets/models/text_model.py +4 -1
  89. ert/gui/ertwidgets/pathchooser.py +0 -3
  90. ert/gui/ertwidgets/searchbox.py +17 -4
  91. ert/gui/ertwidgets/stringbox.py +2 -0
  92. ert/gui/{suggestor → ertwidgets/suggestor}/_suggestor_message.py +13 -4
  93. ert/gui/{suggestor → ertwidgets/suggestor}/suggestor.py +63 -30
  94. ert/gui/main.py +41 -13
  95. ert/gui/main_window.py +3 -7
  96. ert/gui/model/fm_step_list.py +3 -0
  97. ert/gui/model/real_list.py +1 -0
  98. ert/gui/model/snapshot.py +1 -0
  99. ert/gui/simulation/combobox_with_description.py +3 -0
  100. ert/gui/simulation/ensemble_experiment_panel.py +8 -2
  101. ert/gui/simulation/ensemble_information_filter_panel.py +7 -2
  102. ert/gui/simulation/ensemble_smoother_panel.py +8 -2
  103. ert/gui/simulation/evaluate_ensemble_panel.py +17 -7
  104. ert/gui/simulation/experiment_panel.py +18 -6
  105. ert/gui/simulation/manual_update_panel.py +35 -10
  106. ert/gui/simulation/multiple_data_assimilation_panel.py +13 -9
  107. ert/gui/simulation/run_dialog.py +47 -20
  108. ert/gui/simulation/single_test_run_panel.py +6 -3
  109. ert/gui/simulation/view/progress_widget.py +2 -0
  110. ert/gui/simulation/view/realization.py +5 -1
  111. ert/gui/simulation/view/update.py +2 -0
  112. ert/gui/summarypanel.py +20 -1
  113. ert/gui/tools/event_viewer/panel.py +3 -4
  114. ert/gui/tools/event_viewer/tool.py +2 -0
  115. ert/gui/tools/load_results/load_results_panel.py +1 -1
  116. ert/gui/tools/load_results/load_results_tool.py +2 -0
  117. ert/gui/tools/manage_experiments/export_dialog.py +136 -0
  118. ert/gui/tools/manage_experiments/manage_experiments_panel.py +2 -0
  119. ert/gui/tools/manage_experiments/storage_info_widget.py +121 -16
  120. ert/gui/tools/manage_experiments/storage_widget.py +4 -3
  121. ert/gui/tools/plot/customize/color_chooser.py +5 -2
  122. ert/gui/tools/plot/customize/customize_plot_dialog.py +2 -0
  123. ert/gui/tools/plot/customize/default_customization_view.py +4 -0
  124. ert/gui/tools/plot/customize/limits_customization_view.py +3 -0
  125. ert/gui/tools/plot/customize/statistics_customization_view.py +3 -0
  126. ert/gui/tools/plot/customize/style_chooser.py +2 -0
  127. ert/gui/tools/plot/customize/style_customization_view.py +3 -0
  128. ert/gui/tools/plot/data_type_keys_widget.py +2 -0
  129. ert/gui/tools/plot/data_type_proxy_model.py +3 -0
  130. ert/gui/tools/plot/plot_api.py +50 -28
  131. ert/gui/tools/plot/plot_ensemble_selection_widget.py +17 -10
  132. ert/gui/tools/plot/plot_widget.py +15 -2
  133. ert/gui/tools/plot/plot_window.py +41 -19
  134. ert/gui/tools/plot/plottery/plot_config.py +2 -0
  135. ert/gui/tools/plot/plottery/plot_context.py +14 -0
  136. ert/gui/tools/plot/plottery/plots/__init__.py +2 -0
  137. ert/gui/tools/plot/plottery/plots/cesp.py +3 -1
  138. ert/gui/tools/plot/plottery/plots/distribution.py +6 -1
  139. ert/gui/tools/plot/plottery/plots/ensemble.py +13 -5
  140. ert/gui/tools/plot/plottery/plots/gaussian_kde.py +12 -2
  141. ert/gui/tools/plot/plottery/plots/histogram.py +3 -1
  142. ert/gui/tools/plot/plottery/plots/misfits.py +436 -0
  143. ert/gui/tools/plot/plottery/plots/observations.py +18 -4
  144. ert/gui/tools/plot/plottery/plots/statistics.py +62 -20
  145. ert/gui/tools/plot/plottery/plots/std_dev.py +3 -1
  146. ert/gui/tools/plot/widgets/clearable_line_edit.py +9 -0
  147. ert/gui/tools/plot/widgets/filter_popup.py +2 -0
  148. ert/gui/tools/plot/widgets/filterable_kw_list_model.py +3 -0
  149. ert/gui/tools/plugins/plugin.py +1 -1
  150. ert/gui/tools/plugins/plugins_tool.py +2 -0
  151. ert/gui/tools/plugins/process_job_dialog.py +3 -0
  152. ert/gui/tools/workflows/workflow_dialog.py +2 -0
  153. ert/gui/tools/workflows/workflows_tool.py +2 -0
  154. ert/libres_facade.py +5 -7
  155. ert/logging/__init__.py +4 -1
  156. ert/mode_definitions.py +2 -0
  157. ert/plugins/__init__.py +4 -6
  158. ert/plugins/hook_implementations/workflows/csv_export.py +2 -3
  159. ert/plugins/hook_implementations/workflows/gen_data_rft_export.py +10 -2
  160. ert/plugins/hook_specifications/__init__.py +0 -10
  161. ert/plugins/hook_specifications/jobs.py +0 -9
  162. ert/plugins/plugin_manager.py +53 -124
  163. ert/resources/forward_models/run_reservoirsimulator.py +8 -4
  164. ert/resources/forward_models/template_render.py +10 -10
  165. ert/resources/shell_scripts/delete_directory.py +2 -2
  166. ert/run_models/__init__.py +24 -6
  167. ert/run_models/_create_run_path.py +133 -38
  168. ert/run_models/ensemble_experiment.py +10 -4
  169. ert/run_models/ensemble_information_filter.py +8 -1
  170. ert/run_models/ensemble_smoother.py +9 -3
  171. ert/run_models/evaluate_ensemble.py +8 -6
  172. ert/run_models/event.py +7 -3
  173. ert/run_models/everest_run_model.py +337 -113
  174. ert/run_models/initial_ensemble_run_model.py +25 -24
  175. ert/run_models/manual_update.py +6 -3
  176. ert/run_models/manual_update_enif.py +37 -0
  177. ert/run_models/model_factory.py +78 -18
  178. ert/run_models/multiple_data_assimilation.py +22 -11
  179. ert/run_models/run_model.py +72 -73
  180. ert/run_models/single_test_run.py +7 -4
  181. ert/run_models/update_run_model.py +4 -2
  182. ert/runpaths.py +5 -6
  183. ert/sample_prior.py +9 -4
  184. ert/scheduler/__init__.py +10 -5
  185. ert/scheduler/driver.py +40 -0
  186. ert/scheduler/event.py +3 -1
  187. ert/scheduler/job.py +23 -13
  188. ert/scheduler/lsf_driver.py +15 -5
  189. ert/scheduler/openpbs_driver.py +10 -4
  190. ert/scheduler/scheduler.py +5 -0
  191. ert/scheduler/slurm_driver.py +20 -5
  192. ert/services/__init__.py +2 -2
  193. ert/services/_base_service.py +37 -20
  194. ert/services/_storage_main.py +20 -18
  195. ert/services/ert_server.py +317 -0
  196. ert/shared/_doc_utils/__init__.py +4 -2
  197. ert/shared/_doc_utils/ert_jobs.py +1 -4
  198. ert/shared/net_utils.py +43 -18
  199. ert/shared/storage/connection.py +3 -3
  200. ert/shared/version.py +3 -3
  201. ert/storage/__init__.py +14 -1
  202. ert/storage/local_ensemble.py +44 -13
  203. ert/storage/local_experiment.py +54 -34
  204. ert/storage/local_storage.py +90 -58
  205. ert/storage/migration/to10.py +3 -2
  206. ert/storage/migration/to11.py +9 -10
  207. ert/storage/migration/to12.py +19 -20
  208. ert/storage/migration/to13.py +28 -27
  209. ert/storage/migration/to14.py +3 -3
  210. ert/storage/migration/to15.py +25 -0
  211. ert/storage/migration/to16.py +38 -0
  212. ert/storage/migration/to17.py +42 -0
  213. ert/storage/migration/to18.py +11 -0
  214. ert/storage/migration/to19.py +34 -0
  215. ert/storage/migration/to20.py +23 -0
  216. ert/storage/migration/to21.py +25 -0
  217. ert/storage/migration/to6.py +3 -2
  218. ert/storage/migration/to7.py +12 -13
  219. ert/storage/migration/to8.py +9 -11
  220. ert/storage/migration/to9.py +5 -4
  221. ert/storage/realization_storage_state.py +7 -7
  222. ert/substitutions.py +12 -28
  223. ert/validation/active_range.py +7 -7
  224. ert/validation/ensemble_realizations_argument.py +4 -2
  225. ert/validation/rangestring.py +16 -16
  226. ert/workflow_runner.py +6 -3
  227. {ert-16.0.9.dist-info → ert-19.0.0rc2.dist-info}/METADATA +21 -15
  228. ert-19.0.0rc2.dist-info/RECORD +524 -0
  229. {ert-16.0.9.dist-info → ert-19.0.0rc2.dist-info}/WHEEL +1 -1
  230. everest/api/everest_data_api.py +14 -1
  231. everest/assets/everest_logo.svg +406 -0
  232. everest/bin/config_branch_script.py +30 -14
  233. everest/bin/everconfigdump_script.py +2 -10
  234. everest/bin/everest_script.py +53 -33
  235. everest/bin/everlint_script.py +3 -5
  236. everest/bin/kill_script.py +7 -5
  237. everest/bin/main.py +11 -24
  238. everest/bin/monitor_script.py +64 -35
  239. everest/bin/utils.py +58 -43
  240. everest/bin/visualization_script.py +23 -13
  241. everest/config/__init__.py +4 -1
  242. everest/config/control_config.py +81 -6
  243. everest/config/control_variable_config.py +4 -3
  244. everest/config/everest_config.py +102 -79
  245. everest/config/forward_model_config.py +5 -3
  246. everest/config/install_data_config.py +7 -5
  247. everest/config/install_job_config.py +45 -3
  248. everest/config/install_template_config.py +3 -3
  249. everest/config/optimization_config.py +19 -6
  250. everest/config/output_constraint_config.py +8 -2
  251. everest/config/server_config.py +6 -55
  252. everest/config/simulator_config.py +62 -17
  253. everest/config/utils.py +25 -105
  254. everest/config/validation_utils.py +34 -15
  255. everest/config_file_loader.py +30 -21
  256. everest/detached/__init__.py +0 -6
  257. everest/detached/client.py +7 -52
  258. everest/detached/everserver.py +19 -45
  259. everest/everest_storage.py +24 -40
  260. everest/gui/everest_client.py +2 -3
  261. everest/gui/main_window.py +2 -2
  262. everest/optimizer/everest2ropt.py +68 -42
  263. everest/optimizer/opt_model_transforms.py +15 -20
  264. everest/optimizer/utils.py +0 -29
  265. everest/plugins/hook_specs.py +0 -24
  266. everest/strings.py +1 -6
  267. everest/util/__init__.py +3 -1
  268. ert/config/everest_objective_config.py +0 -95
  269. ert/config/ext_param_config.py +0 -107
  270. ert/gui/tools/export/__init__.py +0 -3
  271. ert/gui/tools/export/export_panel.py +0 -83
  272. ert/gui/tools/export/export_tool.py +0 -67
  273. ert/gui/tools/export/exporter.py +0 -36
  274. ert/plugins/hook_specifications/ecl_config.py +0 -29
  275. ert/services/storage_service.py +0 -127
  276. ert/summary_key_type.py +0 -234
  277. ert-16.0.9.dist-info/RECORD +0 -521
  278. everest/bin/everexport_script.py +0 -53
  279. everest/config/sampler_config.py +0 -103
  280. everest/simulator/__init__.py +0 -88
  281. everest/simulator/everest_to_ert.py +0 -252
  282. /ert/gui/{suggestor → ertwidgets/suggestor}/__init__.py +0 -0
  283. /ert/gui/{suggestor → ertwidgets/suggestor}/_colors.py +0 -0
  284. {ert-16.0.9.dist-info → ert-19.0.0rc2.dist-info}/entry_points.txt +0 -0
  285. {ert-16.0.9.dist-info → ert-19.0.0rc2.dist-info}/licenses/COPYING +0 -0
  286. {ert-16.0.9.dist-info → ert-19.0.0rc2.dist-info}/top_level.txt +0 -0
@@ -1,103 +0,0 @@
1
- import logging
2
- from textwrap import dedent
3
- from typing import Any, Self
4
-
5
- from pydantic import BaseModel, ConfigDict, Field, model_validator
6
-
7
- from everest.optimizer.utils import get_ropt_plugin_manager
8
- from everest.strings import EVEREST
9
-
10
-
11
- class SamplerConfig(BaseModel):
12
- backend: str | None = Field(
13
- default=None,
14
- description=dedent(
15
- """
16
- [Deprecated]
17
-
18
- The correct backend will be inferred by the method. If several backends
19
- have a method named `A`, pick a specific backend `B` by putting `B/A` in
20
- the `method` field.
21
- """
22
- ),
23
- )
24
- method: str = Field(
25
- default="norm",
26
- description=dedent(
27
- """
28
- The sampling method or distribution used by the sampler backend.
29
-
30
- The set of available methods depends on the sampler backend used. By
31
- default a plugin based on `scipy.stats` is used, implementing the
32
- following methods:
33
-
34
- - From Probability Distributions:
35
- - `norm`: Samples from a standard normal distribution (mean 0,
36
- standard deviation 1).
37
- - `truncnorm`: Samples from a truncated normal distribution
38
- (mean 0, std. dev. 1), truncated to the range `[-1, 1]`.
39
- - `uniform`: Samples from a uniform distribution in the range
40
- `[-1, 1]`.
41
-
42
- - From Quasi-Monte Carlo Sequences:
43
- - `sobol`: Uses Sobol' sequences.
44
- - `halton`: Uses Halton sequences.
45
- - `lhs`: Uses Latin Hypercube Sampling.
46
-
47
- Note: QMC samples are generated in the unit hypercube `[0, 1]^d`
48
- and then scaled to the hypercube `[-1, 1]^d`.
49
- """
50
- ),
51
- )
52
- options: dict[str, Any] | None = Field(
53
- default=None,
54
- description=dedent(
55
- """
56
- Specifies a dict of optional parameters for the sampler backend.
57
-
58
- This dict of values is passed unchanged to the selected method in
59
- the backend.
60
- """
61
- ),
62
- )
63
- shared: bool | None = Field(
64
- default=None,
65
- description=dedent(
66
- """
67
- Whether to share perturbations between realizations.
68
- """
69
- ),
70
- )
71
- model_config = ConfigDict(extra="forbid")
72
-
73
- @model_validator(mode="after")
74
- def validate_backend_and_method(self) -> Self:
75
- if self.backend is not None:
76
- message = (
77
- "sampler.backend is deprecated. "
78
- "The correct backend will be inferred by the method. "
79
- "If several backends have a method named A, you need to pick "
80
- "a specific backend B by putting B/A in sampler.method."
81
- )
82
- print(message)
83
- logging.getLogger(EVEREST).warning(message)
84
-
85
- # Update the default for backends that are not scipy:
86
- if (
87
- self.backend not in {None, "scipy"}
88
- and "method" not in self.model_fields_set
89
- ):
90
- self.method = "default"
91
-
92
- if self.backend is not None:
93
- self.method = f"{self.backend}/{self.method}"
94
-
95
- if (
96
- get_ropt_plugin_manager().get_plugin_name("sampler", f"{self.method}")
97
- is None
98
- ):
99
- raise ValueError(f"Sampler method '{self.method}' not found")
100
-
101
- self.backend = None
102
-
103
- return self
@@ -1,88 +0,0 @@
1
- JOB_SUCCESS = "Finished"
2
- JOB_WAITING = "Waiting"
3
- JOB_RUNNING = "Running"
4
- JOB_FAILURE = "Failed"
5
-
6
-
7
- DEFAULT_DATA_SUMMARY_KEYS = ["YEAR", "YEARS", "TCPU", "TCPUDAY", "MONTH", "DAY"]
8
-
9
-
10
- DEFAULT_FIELD_SUMMARY_KEYS = [
11
- "FOPR",
12
- "FOPT",
13
- "FOIR",
14
- "FOIT",
15
- "FWPR",
16
- "FWPT",
17
- "FWIR",
18
- "FWIT",
19
- "FGPR",
20
- "FGPT",
21
- "FGIR",
22
- "FGIT",
23
- "FVPR",
24
- "FVPT",
25
- "FVIR",
26
- "FVIT",
27
- "FWCT",
28
- "FGOR",
29
- "FOIP",
30
- "FOIPL",
31
- "FOIPG",
32
- "FWIP",
33
- "FGIP",
34
- "FGIPL",
35
- "FGIPG",
36
- "FPR",
37
- "FAQR",
38
- "FAQRG",
39
- "FAQT",
40
- "FAQTG",
41
- "FWGR",
42
- ]
43
-
44
-
45
- _DEFAULT_WELL_SUMMARY_KEYS = [
46
- "WOPR",
47
- "WOPT",
48
- "WOIR",
49
- "WOIT",
50
- "WWPR",
51
- "WWPT",
52
- "WWIR",
53
- "WWIT",
54
- "WGPR",
55
- "WGPT",
56
- "WGIR",
57
- "WGIT",
58
- "WVPR",
59
- "WVPT",
60
- "WVIR",
61
- "WVIT",
62
- "WWCT",
63
- "WGOR",
64
- "WWGR",
65
- "WBHP",
66
- "WTHP",
67
- "WPI",
68
- ]
69
-
70
- _EXCLUDED_TARGET_KEYS = "WGOR"
71
-
72
- _DEFAULT_WELL_TARGET_SUMMARY_KEYS = [
73
- well_key + "T"
74
- for well_key in _DEFAULT_WELL_SUMMARY_KEYS
75
- if well_key.endswith("R") and well_key not in _EXCLUDED_TARGET_KEYS
76
- ]
77
-
78
- DEFAULT_WELL_SUMMARY_KEYS = (
79
- _DEFAULT_WELL_SUMMARY_KEYS + _DEFAULT_WELL_TARGET_SUMMARY_KEYS
80
- )
81
-
82
-
83
- __all__ = [
84
- "JOB_FAILURE",
85
- "JOB_RUNNING",
86
- "JOB_SUCCESS",
87
- "JOB_WAITING",
88
- ]
@@ -1,252 +0,0 @@
1
- import itertools
2
- import os
3
- from pathlib import Path
4
- from typing import Any, cast
5
-
6
- import everest
7
- from ert.config import (
8
- EnsembleConfig,
9
- ExecutableWorkflow,
10
- ModelConfig,
11
- WorkflowJob,
12
- )
13
- from ert.config.ert_config import (
14
- _substitutions_from_dict,
15
- )
16
- from ert.config.parsing import ConfigDict, ConfigWarning, read_file
17
- from ert.config.parsing import ConfigKeys as ErtConfigKeys
18
- from ert.plugins import ErtPluginContext
19
- from everest.config import EverestConfig
20
- from everest.config.forward_model_config import SummaryResults
21
- from everest.config.install_job_config import InstallJobConfig
22
- from everest.config.simulator_config import SimulatorConfig
23
- from everest.strings import STORAGE_DIR
24
-
25
-
26
- def extract_summary_keys(ever_config: EverestConfig) -> list[str]:
27
- summary_fms = [
28
- fm
29
- for fm in ever_config.forward_model
30
- if fm.results is not None and fm.results.type == "summary"
31
- ]
32
-
33
- if not summary_fms:
34
- return []
35
-
36
- summary_fm = summary_fms[0]
37
- assert summary_fm.results is not None
38
-
39
- smry_results = cast(SummaryResults, summary_fm.results)
40
-
41
- requested_keys: list[str] = ["*"] if smry_results.keys == "*" else smry_results.keys
42
-
43
- data_keys = everest.simulator.DEFAULT_DATA_SUMMARY_KEYS
44
- field_keys = everest.simulator.DEFAULT_FIELD_SUMMARY_KEYS
45
- well_sum_keys = everest.simulator.DEFAULT_WELL_SUMMARY_KEYS
46
- deprecated_user_specified_keys = (
47
- [] if ever_config.export is None else ever_config.export.keywords
48
- )
49
-
50
- wells = (
51
- [
52
- variable.name
53
- for control in ever_config.controls
54
- for variable in control.variables
55
- if control.type == "well_control"
56
- ]
57
- if ever_config.wells is None
58
- else [w.name for w in ever_config.wells]
59
- )
60
-
61
- well_keys = [
62
- f"{sum_key}:{wname}"
63
- for (sum_key, wname) in itertools.product(well_sum_keys, wells)
64
- ]
65
-
66
- all_keys = data_keys + field_keys + well_keys + deprecated_user_specified_keys
67
-
68
- return list(set(all_keys + requested_keys))
69
-
70
-
71
- def _extract_environment(
72
- ever_config: EverestConfig, ert_config: dict[str, Any]
73
- ) -> None:
74
- default_runpath_file = os.path.join(ever_config.output_dir, ".res_runpath_list")
75
- default_ens_path = os.path.join(ever_config.output_dir, STORAGE_DIR)
76
-
77
- ert_config[ErtConfigKeys.ENSPATH] = default_ens_path
78
- ert_config[ErtConfigKeys.RUNPATH_FILE] = default_runpath_file
79
-
80
-
81
- def _extract_simulator(ever_config: EverestConfig, ert_config: dict[str, Any]) -> None:
82
- """
83
- Extracts simulation data from ever_config and injects it into ert_config.
84
- """
85
-
86
- ever_simulation = ever_config.simulator or SimulatorConfig()
87
-
88
- # Resubmit number (number of submission retries)
89
- ert_config[ErtConfigKeys.MAX_SUBMIT] = ever_simulation.resubmit_limit + 1
90
-
91
- # Maximum number of seconds (MAX_RUNTIME) a forward model is allowed to run
92
- max_runtime = ever_simulation.max_runtime
93
- if max_runtime is not None:
94
- ert_config[ErtConfigKeys.MAX_RUNTIME] = max_runtime or 0
95
-
96
- # Maximum amount of memory (REALIZATION_MEMORY) a forward model is allowed to use
97
- max_memory = ever_simulation.max_memory
98
- if max_memory is not None:
99
- ert_config[ErtConfigKeys.REALIZATION_MEMORY] = max_memory or 0
100
-
101
- # Number of cores reserved on queue nodes (NUM_CPU)
102
- num_fm_cpu = ever_simulation.cores_per_node
103
- if num_fm_cpu is not None:
104
- ert_config[ErtConfigKeys.NUM_CPU] = num_fm_cpu
105
-
106
-
107
- def _job_to_dict(job: dict[str, Any] | InstallJobConfig) -> dict[str, Any]:
108
- if isinstance(job, InstallJobConfig):
109
- return job.model_dump(exclude_none=True)
110
- return job
111
-
112
-
113
- def _extract_jobs(
114
- ever_config: EverestConfig, ert_config: dict[str, Any], path: str
115
- ) -> None:
116
- ever_jobs = [_job_to_dict(j) for j in ever_config.install_jobs]
117
- res_jobs = ert_config.get(ErtConfigKeys.INSTALL_JOB, [])
118
- for job in ever_jobs:
119
- if job.get("source") is not None:
120
- source_path = os.path.join(path, job["source"])
121
- new_job = (job["name"], (source_path, read_file(source_path)))
122
- res_jobs.append(new_job)
123
-
124
- ert_config[ErtConfigKeys.INSTALL_JOB] = res_jobs
125
-
126
-
127
- def _extract_workflow_jobs(
128
- ever_config: EverestConfig, ert_config: dict[str, Any], path: str
129
- ) -> None:
130
- workflow_jobs = [_job_to_dict(j) for j in (ever_config.install_workflow_jobs or [])]
131
-
132
- res_jobs = ert_config.get(ErtConfigKeys.LOAD_WORKFLOW_JOB, [])
133
- for job in workflow_jobs:
134
- if job.get("source") is not None:
135
- new_job = (os.path.join(path, job["source"]), job["name"])
136
- res_jobs.append(new_job)
137
-
138
- if res_jobs:
139
- ert_config[ErtConfigKeys.LOAD_WORKFLOW_JOB] = res_jobs
140
-
141
-
142
- def _extract_workflows(
143
- ever_config: EverestConfig, ert_config: dict[str, Any], path: str
144
- ) -> None:
145
- trigger2res = {
146
- "pre_simulation": "PRE_SIMULATION",
147
- "post_simulation": "POST_SIMULATION",
148
- }
149
-
150
- res_workflows = ert_config.get(ErtConfigKeys.LOAD_WORKFLOW, [])
151
- res_hooks = ert_config.get(ErtConfigKeys.HOOK_WORKFLOW, [])
152
-
153
- for ever_trigger, (workflow_file, jobs) in _get_workflow_files(ever_config).items():
154
- if jobs:
155
- res_trigger = trigger2res[ever_trigger]
156
- res_workflows.append((str(workflow_file), ever_trigger))
157
- res_hooks.append((ever_trigger, res_trigger))
158
-
159
- if res_workflows:
160
- ert_config[ErtConfigKeys.LOAD_WORKFLOW] = res_workflows
161
- ert_config[ErtConfigKeys.HOOK_WORKFLOW] = res_hooks
162
-
163
-
164
- def _extract_seed(ever_config: EverestConfig, ert_config: dict[str, Any]) -> None:
165
- random_seed = ever_config.environment.random_seed
166
-
167
- if random_seed:
168
- ert_config[ErtConfigKeys.RANDOM_SEED] = random_seed
169
-
170
-
171
- def get_substitutions(
172
- config_dict: ConfigDict, model_config: ModelConfig, runpath_file: Path, num_cpu: int
173
- ) -> dict[str, str]:
174
- substitutions = _substitutions_from_dict(config_dict)
175
- substitutions["<RUNPATH_FILE>"] = str(runpath_file)
176
- substitutions["<RUNPATH>"] = model_config.runpath_format_string
177
- substitutions["<ECL_BASE>"] = model_config.eclbase_format_string
178
- substitutions["<ECLBASE>"] = model_config.eclbase_format_string
179
- substitutions["<NUM_CPU>"] = str(num_cpu)
180
- return substitutions
181
-
182
-
183
- def get_workflow_jobs(ever_config: EverestConfig) -> dict[str, WorkflowJob]:
184
- workflow_jobs: dict[str, WorkflowJob] = {}
185
- for job in ever_config.install_workflow_jobs or []:
186
- if job.executable is not None:
187
- if job.name in workflow_jobs:
188
- ConfigWarning.warn(
189
- f"Duplicate workflow job with name {job.name!r}, "
190
- f"overriding it with {job.executable!r}.",
191
- job.name,
192
- )
193
- executable = Path(job.executable)
194
- if not executable.is_absolute():
195
- executable = ever_config.config_directory / executable
196
- workflow_jobs[job.name] = ExecutableWorkflow(
197
- name=job.name,
198
- min_args=None,
199
- max_args=None,
200
- arg_types=[],
201
- executable=str(executable),
202
- )
203
- return workflow_jobs
204
-
205
-
206
- def get_ensemble_config(
207
- config_dict: ConfigDict, everest_config: EverestConfig
208
- ) -> EnsembleConfig:
209
- ensemble_config = EnsembleConfig.from_dict(config_dict)
210
-
211
- return ensemble_config
212
-
213
-
214
- def _everest_to_ert_config_dict(ever_config: EverestConfig) -> ConfigDict:
215
- """
216
- Takes as input an Everest configuration and converts it
217
- to a corresponding ert config dict.
218
- """
219
- ert_config: dict[str, Any] = {}
220
-
221
- config_dir = ever_config.config_directory
222
- ert_config[ErtConfigKeys.DEFINE] = [
223
- ("<CONFIG_PATH>", config_dir),
224
- ("<CONFIG_FILE>", Path(ever_config.config_file).stem),
225
- ]
226
-
227
- # Extract simulator and simulation related configs
228
- _extract_simulator(ever_config, ert_config)
229
- _extract_environment(ever_config, ert_config)
230
- _extract_jobs(ever_config, ert_config, config_dir)
231
- _extract_workflow_jobs(ever_config, ert_config, config_dir)
232
- _extract_workflows(ever_config, ert_config, config_dir)
233
- _extract_seed(ever_config, ert_config)
234
-
235
- return ert_config
236
-
237
-
238
- def everest_to_ert_config_dict(everest_config: EverestConfig) -> ConfigDict:
239
- with ErtPluginContext():
240
- config_dict = _everest_to_ert_config_dict(everest_config)
241
- return config_dict
242
-
243
-
244
- def _get_workflow_files(ever_config: EverestConfig) -> dict[str, tuple[Path, str]]:
245
- data_storage = (Path(ever_config.output_dir) / ".internal_data").resolve()
246
- return {
247
- trigger: (
248
- data_storage / f"{trigger}.workflow",
249
- "\n".join(getattr(ever_config.workflows, trigger, [])),
250
- )
251
- for trigger in ("pre_simulation", "post_simulation")
252
- }
File without changes
File without changes