Skip to content

Commit e53ffd9

Browse files
authored
Merge pull request #785 from MolSSI/cleanup
Some small pre-3.12 cleanups
2 parents de33af2 + f48db30 commit e53ffd9

File tree

11 files changed

+27
-18
lines changed

11 files changed

+27
-18
lines changed

conda-build/qcportal/meta.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ requirements:
3232
- tqdm
3333
- pandas
3434
- pyjwt
35+
- packaging
3536

3637

3738
test:

qcarchivetesting/conda-envs/fulltest_qcportal.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ dependencies:
1515
- tabulate
1616
- tqdm
1717
- pandas
18-
- pyjwt
18+
- pyjwt
19+
- packaging

qcarchivetesting/conda-envs/fulltest_server.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies:
2020
- tqdm
2121
- pandas
2222
- pyjwt
23+
- packaging
2324

2425
# QCFractal dependencies
2526
- flask

qcarchivetesting/conda-envs/fulltest_snowflake.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dependencies:
99
- postgresql
1010

1111
# QCPortal dependencies
12+
# NOTE: msgpack-python in conda is msgpack in pypi (due to a rename around v0.5)
1213
- numpy
1314
- msgpack-python
1415
- requests
@@ -20,6 +21,7 @@ dependencies:
2021
- tqdm
2122
- pandas
2223
- pyjwt
24+
- packaging
2325

2426
# QCFractalCompute dependencies
2527
- parsl

qcarchivetesting/conda-envs/fulltest_worker.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies:
2020
- tqdm
2121
- pandas
2222
- pyjwt
23+
- packaging
2324

2425
# QCFractalCompute dependencies
2526
- parsl

qcarchivetesting/qcarchivetesting/helpers.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from qcelemental.models import Molecule
1515
from qcelemental.models.results import WavefunctionProperties
1616

17+
from qcfractal.components.serverinfo.socket import geoip2_found
1718
from qcportal.serialization import _json_decode
1819

1920
# Valid client encodings
@@ -26,7 +27,7 @@
2627
geoip_filename = "GeoLite2-City-Test.mmdb"
2728
ip_testdata_path = os.path.join(_my_path, "MaxMind-DB", "source-data", "GeoIP2-City-Test.json")
2829

29-
ip_tests_enabled = os.path.exists(geoip_path) and os.path.exists(ip_testdata_path)
30+
ip_tests_enabled = os.path.exists(geoip_path) and os.path.exists(ip_testdata_path) and geoip2_found
3031

3132
testconfig_path = os.path.join(_my_path, "config_files")
3233
migrationdata_path = os.path.join(_my_path, "migration_data")

qcfractal/qcfractal/test_periodics.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ def test_periodics_server_stats(snowflake: QCATestingSnowflake):
2727
sleep_time = snowflake._qcf_config.statistics_frequency
2828

2929
snowflake.start_job_runner()
30-
time.sleep(0.25)
30+
time.sleep(sleep_time / 2)
3131

3232
for i in range(5):
3333
time_0 = datetime.utcnow()
3434
time.sleep(sleep_time)
3535
time_1 = datetime.utcnow()
3636

37-
stats = storage_socket.serverinfo.query_server_stats(ServerStatsQueryFilters())
38-
assert len(stats) == i + 1
37+
filters = ServerStatsQueryFilters(before=time_1, after=time_0)
38+
stats = storage_socket.serverinfo.query_server_stats(filters)
39+
assert len(stats) == 1
3940
assert time_0 < stats[0]["timestamp"] < time_1
4041

4142

qcfractalcompute/qcfractalcompute/compute_manager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
import parsl.executors.high_throughput.interchange
1414
import tabulate
15+
from packaging.version import parse as parse_version
1516
from parsl.config import Config as ParslConfig
1617
from parsl.dataflow.dflow import DataFlowKernel
1718
from parsl.dataflow.futures import Future as ParslFuture
1819
from parsl.executors import HighThroughputExecutor, ThreadPoolExecutor
19-
from pkg_resources import parse_version
2020
from pydantic import BaseModel, Extra, Field
2121
from requests.exceptions import Timeout
2222

qcportal/pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ dependencies = [
3232
"tqdm",
3333
"pandas",
3434
"pyjwt",
35+
"packaging",
3536
]
3637

3738

qcportal/qcportal/client_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import pydantic
1818
import requests
1919
import yaml
20-
from pkg_resources import parse_version
20+
from packaging.version import parse as parse_version
2121

2222
from . import __version__
2323
from .exceptions import AuthenticationFailure

qcportal/qcportal/dataset_models.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -1190,20 +1190,20 @@ def compile_values(
11901190
11911191
Parameters
11921192
-----------
1193-
value_call
1194-
Function to call on each record to extract the desired value. Must return a scalar value or
1193+
value_call
1194+
Function to call on each record to extract the desired value. Must return a scalar value or
11951195
a sequence of values if 'unpack' is set to True.
11961196
11971197
value_names
1198-
Column name(s) for the extracted value(s). If a string is provided and multiple values are
1199-
returned by 'value_call', columns are named by appending an index to this string. If a list
1198+
Column name(s) for the extracted value(s). If a string is provided and multiple values are
1199+
returned by 'value_call', columns are named by appending an index to this string. If a list
12001200
of strings is provided, it must match the length of the sequence returned by 'value_call'.
12011201
Default is "value".
12021202
1203-
entry_names
1203+
entry_names
12041204
Entry names to filter records. If not provided, considers all entries.
12051205
1206-
specification_names
1206+
specification_names
12071207
Specification names to filter records. If not provided, considers all specifications.
12081208
12091209
unpack
@@ -1226,11 +1226,11 @@ def compile_values(
12261226
Notes
12271227
------
12281228
1. The DataFrame is structured such that the rows are entries and columns are specifications.
1229-
2. If 'unpack' is True, the function assumes 'value_call' returns a sequence of values that need
1229+
2. If 'unpack' is True, the function assumes 'value_call' returns a sequence of values that need
12301230
to be distributed across columns in the resulting DataFrame. 'value_call' should always return the
12311231
same number of values for each record if unpack is True.
12321232
"""
1233-
1233+
12341234
def _data_generator(unpack=False):
12351235
for entry_name, spec_name, record in self.iterate_records(
12361236
entry_names=entry_names,
@@ -1279,13 +1279,13 @@ def get_properties_df(self, properties_list: Sequence[str]) -> pd.DataFrame:
12791279
12801280
This function uses the provided list of property names to extract corresponding
12811281
values from each record's properties. It returns a DataFrame where rows represent
1282-
each record. Each column corresponds has a top level index as a specification,
1283-
and a second level index as the appropriate value name. Columns with all
1282+
each record. Each column corresponds has a top level index as a specification,
1283+
and a second level index as the appropriate value name. Columns with all
12841284
NaN values are dropped.
12851285
12861286
Parameters:
12871287
-----------
1288-
properties_list
1288+
properties_list
12891289
List of property names to retrieve from the records.
12901290
12911291
Returns:

0 commit comments

Comments
 (0)