From 64dbf1240db80447fb5f7cd0ee183dff3abfe509 Mon Sep 17 00:00:00 2001 From: David Dotson Date: Thu, 14 Apr 2022 16:53:34 -0700 Subject: [PATCH] FractalClient -> PortalClient --- openff/qcsubmit/results/results.py | 8 ++--- openff/qcsubmit/tests/conftest.py | 4 +-- openff/qcsubmit/tests/results/__init__.py | 8 ++--- openff/qcsubmit/tests/results/test_results.py | 10 +++--- openff/qcsubmit/tests/test_datasets.py | 2 +- openff/qcsubmit/tests/test_submissions.py | 34 +++++++++---------- 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/openff/qcsubmit/results/results.py b/openff/qcsubmit/results/results.py index bd7ec773..f7a4c57b 100644 --- a/openff/qcsubmit/results/results.py +++ b/openff/qcsubmit/results/results.py @@ -144,7 +144,7 @@ def from_datasets( @abc.abstractmethod def from_server( cls: T, - client: qcportal.FractalClient, + client: qcportal.PortalClient, datasets: Union[str, Iterable[str]], spec_name: str = "default", ) -> T: @@ -370,7 +370,7 @@ def from_datasets( @classmethod def from_server( cls, - client: qcportal.FractalClient, + client: qcportal.PortalClient, datasets: Union[str, Iterable[str]], spec_name: str = "default", ) -> "BasicResultCollection": @@ -481,7 +481,7 @@ def from_datasets( @classmethod def from_server( cls, - client: qcportal.FractalClient, + client: qcportal.PortalClient, datasets: Union[str, Iterable[str]], spec_name: str = "default", ) -> "OptimizationResultCollection": @@ -731,7 +731,7 @@ def from_datasets( @classmethod def from_server( cls, - client: qcportal.FractalClient, + client: qcportal.PortalClient, datasets: Union[str, Iterable[str]], spec_name: str = "default", ) -> "TorsionDriveResultCollection": diff --git a/openff/qcsubmit/tests/conftest.py b/openff/qcsubmit/tests/conftest.py index e2810db3..10e2436b 100644 --- a/openff/qcsubmit/tests/conftest.py +++ b/openff/qcsubmit/tests/conftest.py @@ -1,6 +1,6 @@ import pytest from openff.toolkit.topology import Molecule -from qcportal import FractalClient +from qcportal import PortalClient from openff.qcsubmit.results.caching import clear_results_caches from openff.qcsubmit.utils import get_data @@ -10,7 +10,7 @@ def public_client(): """Setup a new connection to the public qcarchive client.""" - return FractalClient() + return PortalClient() @pytest.fixture(scope="function", autouse=True) diff --git a/openff/qcsubmit/tests/results/__init__.py b/openff/qcsubmit/tests/results/__init__.py index 2a9134c3..d6e5a690 100644 --- a/openff/qcsubmit/tests/results/__init__.py +++ b/openff/qcsubmit/tests/results/__init__.py @@ -31,7 +31,7 @@ from openff.qcsubmit.results.results import _BaseResult -class _FractalClient(BaseModel): +class _PortalClient(BaseModel): address: str @@ -79,7 +79,7 @@ def mock_basic_result_collection(molecules, monkeypatch) -> BasicResultCollectio basis="sto-3g", molecule=entry.record_id, status=RecordStatusEnum.complete, - client=_FractalClient(address=address), + client=_PortalClient(address=address), ), molecules[address][int(entry.record_id) - 1] ) @@ -127,7 +127,7 @@ def mock_optimization_result_collection( final_molecule=ObjectId(entry.record_id), status=RecordStatusEnum.complete, energies=[numpy.random.random()], - client=_FractalClient(address=address), + client=_PortalClient(address=address), ), molecules[address][int(entry.record_id) - 1], ) @@ -180,7 +180,7 @@ def mock_torsion_drive_result_collection( ) ], status=RecordStatusEnum.complete, - client=_FractalClient(address=address), + client=_PortalClient(address=address), keywords=TDKeywords(dihedrals=[], grid_spacing=[]), final_energy_dict={}, optimization_history={}, diff --git a/openff/qcsubmit/tests/results/test_results.py b/openff/qcsubmit/tests/results/test_results.py index 945ecfd6..a3f6461f 100644 --- a/openff/qcsubmit/tests/results/test_results.py +++ b/openff/qcsubmit/tests/results/test_results.py @@ -7,7 +7,7 @@ from openff.toolkit.topology import Molecule from openff.toolkit.typing.engines.smirnoff import ForceField from pydantic import ValidationError -from qcportal import FractalClient +from qcportal import PortalClient from qcportal.models import Molecule as QCMolecule from qcportal.models import ( ObjectId, @@ -374,8 +374,8 @@ def mock_query_molecules(*args, **kwargs): return [qc_molecule] - monkeypatch.setattr(FractalClient, "query_procedures", mock_query_procedures) - monkeypatch.setattr(FractalClient, "query_molecules", mock_query_molecules) + monkeypatch.setattr(PortalClient, "query_procedures", mock_query_procedures) + monkeypatch.setattr(PortalClient, "query_molecules", mock_query_molecules) records_and_molecules = collection.to_records() assert len(records_and_molecules) == 1 @@ -436,8 +436,8 @@ def mock_query_results(*args, **kwargs): ) ] - monkeypatch.setattr(FractalClient, "_automodel_request", mock_automodel_request) - monkeypatch.setattr(FractalClient, "query_results", mock_query_results) + monkeypatch.setattr(PortalClient, "_automodel_request", mock_automodel_request) + monkeypatch.setattr(PortalClient, "query_results", mock_query_results) basic_collection = optimization_result_collection.to_basic_result_collection( "hessian" diff --git a/openff/qcsubmit/tests/test_datasets.py b/openff/qcsubmit/tests/test_datasets.py index 6e9bbc38..8f7c40cf 100644 --- a/openff/qcsubmit/tests/test_datasets.py +++ b/openff/qcsubmit/tests/test_datasets.py @@ -690,7 +690,7 @@ def test_dataset_update(dataset_data): """ import qcportal as ptl dataset_type, dataset_name, specs = dataset_data - client = ptl.FractalClient() + client = ptl.PortalClient() # set up the dataset dataset = dataset_type(dataset_name=dataset_name, dataset_tagline="XXXXXXXX", description="XXXXXXXX") assert bool(dataset.metadata.elements) is False diff --git a/openff/qcsubmit/tests/test_submissions.py b/openff/qcsubmit/tests/test_submissions.py index 3eaf4241..d2fe5e1a 100644 --- a/openff/qcsubmit/tests/test_submissions.py +++ b/openff/qcsubmit/tests/test_submissions.py @@ -7,7 +7,7 @@ import pytest from openff.toolkit.topology import Molecule from qcengine.testing import has_program -from qcportal import FractalClient +from qcportal import PortalClient from openff.qcsubmit import workflow_components from openff.qcsubmit.common_structures import Metadata, MoleculeAttributes, PCMSettings @@ -38,7 +38,7 @@ def test_basic_submissions_single_spec(fractal_compute_server, specification): """Test submitting a basic dataset to a snowflake server.""" - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) qc_spec, driver = specification @@ -120,7 +120,7 @@ def test_basic_submissions_single_spec(fractal_compute_server, specification): def test_basic_submissions_multiple_spec(fractal_compute_server): """Test submitting a basic dataset to a snowflake server with multiple qcspecs.""" - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) qc_specs = [{"method": "openff-1.0.0", "basis": "smirnoff", "program": "openmm", "spec_name": "openff"}, {"method": "gaff-2.11", "basis": "antechamber", "program": "openmm", "spec_name": "gaff"}] @@ -198,7 +198,7 @@ def test_basic_submissions_multiple_spec(fractal_compute_server): def test_basic_submissions_single_pcm_spec(fractal_compute_server): """Test submitting a basic dataset to a snowflake server with pcm water in the specification.""" - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) program = "psi4" if not has_program(program): @@ -285,7 +285,7 @@ def test_adding_specifications(fractal_compute_server): 2) Adding a spec with the same name as another but with different options 3) overwrite a spec which was added but never used. """ - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) mol = Molecule.from_smiles("CO") # make a dataset factory = OptimizationDatasetFactory() @@ -346,7 +346,7 @@ def test_adding_compute(fractal_compute_server, dataset_data): """ Test adding new compute to each of the dataset types using none psi4 programs. """ - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) mol = Molecule.from_smiles("CO") factory_type, dataset_type = dataset_data # make and clear out the qc specs @@ -458,7 +458,7 @@ def test_basic_submissions_wavefunction(fractal_compute_server): if not has_program("psi4"): pytest.skip("Program psi4 not found.") - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) molecules = Molecule.from_file(get_data("butane_conformers.pdb"), "pdb") factory = BasicDatasetFactory(driver="energy") @@ -529,7 +529,7 @@ def test_optimization_submissions_with_constraints(fractal_compute_server): """ Make sure that the constraints are added to the optimization and enforced. """ - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) ethane = Molecule.from_file(get_data("ethane.sdf"), "sdf") dataset = OptimizationDataset(dataset_name="Test optimizations with constraint", description="Test optimization dataset with constraints", dataset_tagline="Testing optimization datasets") # add just mm spec @@ -569,7 +569,7 @@ def test_optimization_submissions_with_constraints(fractal_compute_server): def test_optimization_submissions(fractal_compute_server, specification): """Test submitting an Optimization dataset to a snowflake server.""" - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) qc_spec, driver = specification program = qc_spec["program"] @@ -645,7 +645,7 @@ def test_optimization_submissions(fractal_compute_server, specification): def test_optimization_submissions_with_pcm(fractal_compute_server): """Test submitting an Optimization dataset to a snowflake server with PCM.""" - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) program = "psi4" if not has_program(program): @@ -725,7 +725,7 @@ def test_torsiondrive_scan_keywords(fractal_compute_server): Test running torsiondrives with unique keyword settings which overwrite the global grid spacing and scan range. """ - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) molecules = Molecule.from_smiles("CO") factory = TorsiondriveDatasetFactory() scan_enum = workflow_components.ScanEnumerator() @@ -763,7 +763,7 @@ def test_torsiondrive_constraints(fractal_compute_server): Make sure constraints are correctly passed to optimisations in torsiondrives. """ - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) molecule = Molecule.from_file(get_data("TRP.mol2")) dataset = TorsiondriveDataset(dataset_name="Torsiondrive constraints", dataset_tagline="Testing torsiondrive constraints", description="Testing torsiondrive constraints.") dataset.clear_qcspecs() @@ -803,7 +803,7 @@ def test_torsiondrive_submissions(fractal_compute_server, specification): Test submitting a torsiondrive dataset and computing it. """ - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) qc_spec, driver = specification program = qc_spec["program"] @@ -881,7 +881,7 @@ def test_ignore_errors_all_datasets(fractal_compute_server, factory_type, capsys """ For each dataset make sure that when the basis is not fully covered the dataset raises warning errors, and verbose information """ - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) # molecule containing boron molecule = Molecule.from_smiles("OB(O)C1=CC=CC=C1") scan_enum = workflow_components.ScanEnumerator() @@ -919,7 +919,7 @@ def test_index_not_changed(fractal_compute_server, factory_type): """ factory = factory_type() factory.clear_qcspecs() - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) # add only mm specs factory.add_qc_spec(method="openff-1.0.0", basis="smirnoff", program="openmm", spec_name="parsley", spec_description="standard parsley spec") @@ -959,7 +959,7 @@ def test_adding_dataset_entry_fail(fractal_compute_server, factory_type, capsys) Make sure that the new entries is not incremented if we can not add a molecule to the server due to a name clash. TODO add basic dataset into the testing if the api changes to return an error when adding the same index twice """ - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) molecule = Molecule.from_smiles("CO") molecule.generate_conformers(n_conformers=1) factory = factory_type() @@ -996,7 +996,7 @@ def test_expanding_compute(fractal_compute_server, factory_type): """ Make sure that if we expand the compute of a dataset tasks are generated. """ - client = FractalClient(fractal_compute_server) + client = PortalClient(fractal_compute_server) molecule = Molecule.from_smiles("CC") molecule.generate_conformers(n_conformers=1) factory = factory_type()