Skip to content

Commit af5c99e

Browse files
authored
Merge pull request #978 from MolSSI/pydv2
[Pydantic v2] Update server and compute config to use pydantic v2
2 parents 5015d79 + d623a9a commit af5c99e

File tree

24 files changed

+198
-532
lines changed

24 files changed

+198
-532
lines changed

docs/requirements.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
sphinx<8.0
1+
sphinx
22
sphinx_design
33
sphinx-copybutton
44
pydata_sphinx_theme
5-
pydantic<2.0a0
6-
autodoc-pydantic<2.0a0
75
myst-nb
86
nglview
97
-e ../qcportal

docs/source/admin_guide/managers/index.rst

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,25 +128,15 @@ Configuration for different HPC schedulers
128128
HPC cluster schedulers vary in behavior, so you will need to adapt your ``qcfractal-manager-config.yml`` to the scheduler of the HPC cluster you intend to use.
129129
The configuration keys available for each ``type`` of record in the ``executors`` list are referenced here.
130130

131-
----
132131

133-
.. autopydantic_model:: qcfractalcompute.config.SlurmExecutorConfig
134-
:model-show-config-summary: false
135-
:model-show-field-summary: false
132+
.. autoclass:: qcfractalcompute.config.SlurmExecutorConfig
136133

137-
----
138134

139-
.. autopydantic_model:: qcfractalcompute.config.TorqueExecutorConfig
140-
:model-show-config-summary: false
141-
:model-show-field-summary: false
135+
.. autoclass:: qcfractalcompute.config.TorqueExecutorConfig
142136

143-
----
144137

145-
.. autopydantic_model:: qcfractalcompute.config.LSFExecutorConfig
146-
:model-show-config-summary: false
147-
:model-show-field-summary: false
138+
.. autoclass:: qcfractalcompute.config.LSFExecutorConfig
148139

149-
----
150140

151141
.. _compute-manager-local:
152142

@@ -178,6 +168,4 @@ Using the ``local`` executor type is also recommended for running a compute mana
178168

179169
----
180170

181-
.. autopydantic_model:: qcfractalcompute.config.LocalExecutorConfig
182-
:model-show-config-summary: false
183-
:model-show-field-summary: false
171+
.. autoclass:: qcfractalcompute.config.LocalExecutorConfig

docs/source/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"sphinx.ext.napoleon",
5050
"sphinx.ext.extlinks",
5151
"sphinx_design",
52-
"sphinxcontrib.autodoc_pydantic",
52+
# "sphinxcontrib.autodoc_pydantic",
5353
"sphinx_copybutton",
5454
"myst_nb",
5555
]
@@ -65,8 +65,8 @@
6565
"show-inheritance": True,
6666
"member-order": "bysource",
6767
}
68-
autodoc_pydantic_model_show_json = False
69-
autodoc_pydantic_settings_show_json = False
68+
#autodoc_pydantic_model_show_json = False
69+
#autodoc_pydantic_settings_show_json = False
7070

7171
# Add any paths that contain templates here, relative to this directory.
7272
templates_path = [

qcarchivetesting/conda-envs/fulltest_server.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dependencies:
1313
- requests
1414
- pyyaml
1515
- pydantic
16+
- pydantic-settings
1617
- zstandard
1718
- apsw>=3.42
1819
- qcelemental<0.70a0

qcarchivetesting/conda-envs/fulltest_snowflake.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dependencies:
1313
- requests
1414
- pyyaml
1515
- pydantic
16+
- pydantic-settings
1617
- zstandard
1718
- apsw>=3.42
1819
- qcelemental<0.70a0

qcarchivetesting/conda-envs/fulltest_testing.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dependencies:
1313
- requests
1414
- pyyaml
1515
- pydantic
16+
- pydantic-settings
1617
- zstandard
1718
- apsw>=3.42
1819
- qcelemental<0.70a0

qcarchivetesting/conda-envs/fulltest_worker.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dependencies:
1111
- requests
1212
- pyyaml
1313
- pydantic
14+
- pydantic-settings
1415
- zstandard
1516
- apsw>=3.42
1617
- qcelemental<0.70a0

qcarchivetesting/qcarchivetesting/config_files/gha_fractal_compute.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ executors:
1717
max_workers: 1
1818
cores_per_worker: 2
1919
memory_per_worker: 2
20-
queue_tags:
20+
compute_tags:
2121
- '*'

qcarchivetesting/qcarchivetesting/testing_classes.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import logging
4-
from copy import deepcopy
54

65
from qcarchivetesting import geoip_path, geoip_filename, ip_tests_enabled
76
from qcfractal.config import DatabaseConfig
@@ -78,10 +77,8 @@ def __init__(self, db_path: str):
7877
assert self.harness.is_alive() and not self.harness.can_connect()
7978

8079
def get_new_harness(self, db_name: str) -> QCATestingPostgresHarness:
81-
harness_config = deepcopy(self.harness.config.dict())
82-
harness_config["database_name"] = db_name
83-
84-
new_harness = QCATestingPostgresHarness(DatabaseConfig(**harness_config))
80+
db_config = self.harness.config.model_copy(deep=True, update={"database_name": db_name})
81+
new_harness = QCATestingPostgresHarness(db_config)
8582
new_harness.create_database(create_tables=True)
8683
return new_harness
8784

@@ -170,7 +167,7 @@ def __init__(
170167
extra_config=qcf_config,
171168
)
172169

173-
self._original_config = self._qcf_config.copy(deep=True)
170+
self._original_config = self._qcf_config.model_copy(deep=True)
174171

175172
if create_users:
176173
self.create_users()
@@ -192,7 +189,7 @@ def reset(self):
192189
self._stop_job_runner()
193190
self._stop_compute()
194191
self._all_completed = set()
195-
self._qcf_config = self._original_config.copy(deep=True)
192+
self._qcf_config = self._original_config.model_copy(deep=True)
196193

197194
if self._api_thread is None:
198195
self.start_api(wait=True)

qcarchivetesting/qcarchivetesting/testing_fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def _generate_default_config(pg_harness, extra_config=None) -> FractalConfig:
2727
cfg_dict = {}
2828
cfg_dict["base_folder"] = pg_harness.config.base_folder
2929
cfg_dict["loglevel"] = "DEBUG"
30-
cfg_dict["database"] = pg_harness.config.dict()
30+
cfg_dict["database"] = pg_harness.config.model_dump()
3131
cfg_dict["database"]["pool_size"] = 0
3232
cfg_dict["log_access"] = True
3333

0 commit comments

Comments
 (0)