Skip to content

Commit

Permalink
FractalClient -> PortalClient
Browse files Browse the repository at this point in the history
  • Loading branch information
dotsdl committed Apr 14, 2022
1 parent c926347 commit 64dbf12
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
8 changes: 4 additions & 4 deletions openff/qcsubmit/results/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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":
Expand Down Expand Up @@ -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":
Expand Down Expand Up @@ -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":
Expand Down
4 changes: 2 additions & 2 deletions openff/qcsubmit/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions openff/qcsubmit/tests/results/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from openff.qcsubmit.results.results import _BaseResult


class _FractalClient(BaseModel):
class _PortalClient(BaseModel):

address: str

Expand Down Expand Up @@ -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]
)
Expand Down Expand Up @@ -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],
)
Expand Down Expand Up @@ -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={},
Expand Down
10 changes: 5 additions & 5 deletions openff/qcsubmit/tests/results/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion openff/qcsubmit/tests/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 17 additions & 17 deletions openff/qcsubmit/tests/test_submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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"}]
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 64dbf12

Please sign in to comment.