From 0b7e5bfab7d3ef9980d8c7db1eba290bde7497b7 Mon Sep 17 00:00:00 2001 From: Jeffrey Wagner Date: Fri, 14 Jun 2024 17:31:39 -0700 Subject: [PATCH 1/3] add verify named argument to to_records --- openff/qcsubmit/results/results.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/openff/qcsubmit/results/results.py b/openff/qcsubmit/results/results.py index cf2afc97..7da4d267 100644 --- a/openff/qcsubmit/results/results.py +++ b/openff/qcsubmit/results/results.py @@ -189,7 +189,7 @@ def _validate_record_types( ) @abc.abstractmethod - def to_records(self) -> List[Tuple[BaseRecord, Molecule]]: + def to_records(self, verify=True) -> List[Tuple[BaseRecord, Molecule]]: """Returns the native QCPortal record objects for each of the records referenced in this collection along with a corresponding OpenFF molecule object. """ @@ -371,7 +371,7 @@ def from_server( spec_name, ) - def to_records(self) -> List[Tuple[SinglepointRecord, Molecule]]: + def to_records(self, verify=True) -> List[Tuple[SinglepointRecord, Molecule]]: """Returns the native QCPortal record objects for each of the records referenced in this collection along with a corresponding OpenFF molecule object. @@ -381,7 +381,7 @@ def to_records(self) -> List[Tuple[SinglepointRecord, Molecule]]: records_and_molecules = [] for client_address, records in self.entries.items(): - client = PortalClient(client_address) + client = PortalClient(client_address, verify=verify) # TODO - batching/chunking (maybe in portal?) for record in records: @@ -522,7 +522,7 @@ def from_server( spec_name, ) - def to_records(self) -> List[Tuple[OptimizationRecord, Molecule]]: + def to_records(self, verify=True) -> List[Tuple[OptimizationRecord, Molecule]]: """Returns the native QCPortal record objects for each of the records referenced in this collection along with a corresponding OpenFF molecule object. @@ -533,7 +533,7 @@ def to_records(self) -> List[Tuple[OptimizationRecord, Molecule]]: records_and_molecules = [] for client_address, results in self.entries.items(): - client = PortalClient(client_address) + client = PortalClient(client_address, verify=verify) rec_ids = [result.record_id for result in results] # Do one big request to save time @@ -791,7 +791,7 @@ def from_server( spec_name, ) - def to_records(self) -> List[Tuple[TorsiondriveRecord, Molecule]]: + def to_records(self, verify=True) -> List[Tuple[TorsiondriveRecord, Molecule]]: """Returns the native QCPortal record objects for each of the records referenced in this collection along with a corresponding OpenFF molecule object. @@ -802,7 +802,7 @@ def to_records(self) -> List[Tuple[TorsiondriveRecord, Molecule]]: records_and_molecules = [] for client_address, records in self.entries.items(): - client = PortalClient(client_address) + client = PortalClient(client_address, verify=verify) # retrieve all torsiondrives at once, including their # minimum_optimizations From 8a190e6c3f7d32b74338a188ad104366c79bd1cc Mon Sep 17 00:00:00 2001 From: Jeffrey Wagner Date: Tue, 18 Jun 2024 19:11:53 -0700 Subject: [PATCH 2/3] switch to more general client_kwargs --- openff/qcsubmit/results/results.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/openff/qcsubmit/results/results.py b/openff/qcsubmit/results/results.py index 7da4d267..e1f13853 100644 --- a/openff/qcsubmit/results/results.py +++ b/openff/qcsubmit/results/results.py @@ -189,7 +189,7 @@ def _validate_record_types( ) @abc.abstractmethod - def to_records(self, verify=True) -> List[Tuple[BaseRecord, Molecule]]: + def to_records(self, client_kwargs: Optional[dict] = None) -> List[Tuple[BaseRecord, Molecule]]: """Returns the native QCPortal record objects for each of the records referenced in this collection along with a corresponding OpenFF molecule object. """ @@ -371,7 +371,7 @@ def from_server( spec_name, ) - def to_records(self, verify=True) -> List[Tuple[SinglepointRecord, Molecule]]: + def to_records(self, client_kwargs: Optional[dict] = None) -> List[Tuple[SinglepointRecord, Molecule]]: """Returns the native QCPortal record objects for each of the records referenced in this collection along with a corresponding OpenFF molecule object. @@ -379,9 +379,11 @@ def to_records(self, verify=True) -> List[Tuple[SinglepointRecord, Molecule]]: """ records_and_molecules = [] + if client_kwargs is None: + client_kwargs = dict() for client_address, records in self.entries.items(): - client = PortalClient(client_address, verify=verify) + client = PortalClient(client_address, **client_kwargs) # TODO - batching/chunking (maybe in portal?) for record in records: @@ -522,7 +524,7 @@ def from_server( spec_name, ) - def to_records(self, verify=True) -> List[Tuple[OptimizationRecord, Molecule]]: + def to_records(self, client_kwargs: Optional[dict] = None) -> List[Tuple[OptimizationRecord, Molecule]]: """Returns the native QCPortal record objects for each of the records referenced in this collection along with a corresponding OpenFF molecule object. @@ -531,9 +533,11 @@ def to_records(self, verify=True) -> List[Tuple[OptimizationRecord, Molecule]]: """ records_and_molecules = [] + if client_kwargs is None: + client_kwargs = dict() for client_address, results in self.entries.items(): - client = PortalClient(client_address, verify=verify) + client = PortalClient(client_address, **client_kwargs) rec_ids = [result.record_id for result in results] # Do one big request to save time @@ -791,7 +795,7 @@ def from_server( spec_name, ) - def to_records(self, verify=True) -> List[Tuple[TorsiondriveRecord, Molecule]]: + def to_records(self, client_kwargs: Optional[dict] = None) -> List[Tuple[TorsiondriveRecord, Molecule]]: """Returns the native QCPortal record objects for each of the records referenced in this collection along with a corresponding OpenFF molecule object. @@ -800,9 +804,11 @@ def to_records(self, verify=True) -> List[Tuple[TorsiondriveRecord, Molecule]]: """ records_and_molecules = [] + if client_kwargs is None: + client_kwargs = dict() for client_address, records in self.entries.items(): - client = PortalClient(client_address, verify=verify) + client = PortalClient(client_address, **client_kwargs) # retrieve all torsiondrives at once, including their # minimum_optimizations From e78edf31c33ffcf85e4c83ce6c471ababfd7cbf0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 19 Jun 2024 02:12:10 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- openff/qcsubmit/results/results.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/openff/qcsubmit/results/results.py b/openff/qcsubmit/results/results.py index e1f13853..31ea8767 100644 --- a/openff/qcsubmit/results/results.py +++ b/openff/qcsubmit/results/results.py @@ -189,7 +189,9 @@ def _validate_record_types( ) @abc.abstractmethod - def to_records(self, client_kwargs: Optional[dict] = None) -> List[Tuple[BaseRecord, Molecule]]: + def to_records( + self, client_kwargs: Optional[dict] = None + ) -> List[Tuple[BaseRecord, Molecule]]: """Returns the native QCPortal record objects for each of the records referenced in this collection along with a corresponding OpenFF molecule object. """ @@ -371,7 +373,9 @@ def from_server( spec_name, ) - def to_records(self, client_kwargs: Optional[dict] = None) -> List[Tuple[SinglepointRecord, Molecule]]: + def to_records( + self, client_kwargs: Optional[dict] = None + ) -> List[Tuple[SinglepointRecord, Molecule]]: """Returns the native QCPortal record objects for each of the records referenced in this collection along with a corresponding OpenFF molecule object. @@ -524,7 +528,9 @@ def from_server( spec_name, ) - def to_records(self, client_kwargs: Optional[dict] = None) -> List[Tuple[OptimizationRecord, Molecule]]: + def to_records( + self, client_kwargs: Optional[dict] = None + ) -> List[Tuple[OptimizationRecord, Molecule]]: """Returns the native QCPortal record objects for each of the records referenced in this collection along with a corresponding OpenFF molecule object. @@ -795,7 +801,9 @@ def from_server( spec_name, ) - def to_records(self, client_kwargs: Optional[dict] = None) -> List[Tuple[TorsiondriveRecord, Molecule]]: + def to_records( + self, client_kwargs: Optional[dict] = None + ) -> List[Tuple[TorsiondriveRecord, Molecule]]: """Returns the native QCPortal record objects for each of the records referenced in this collection along with a corresponding OpenFF molecule object.