2024-07-31 LW/JW running evaluator on NRP meeting note
Participants
@Lily Wang
@Jeffrey Wagner
Discussion topics
Item | Notes |
---|---|
Give LW Dockerhub creds | LW needs to make an account at hub.docker.com (ideally using openff gmail)
JW needs to add LW to https://app.docker.com/admin/orgs/openforcefield/members
|
|
|
Run evaluator client and server locally |
JW attempt:
mamba create -n evaluator openff-evaluator Running natively on mac failed Trying to run in docker: using instructions from here: https://github.com/openforcefield/openff-qcsubmit/issues/264 (emulating 64 with the --platform bit)
Then outside container: docker cp test.py <container_hash>:/tmp
docker cp tutorial02.py <container_hash>:/tmp
docker cp ~/oe_license.txt <container_hash>:/tmp
docker cp ~/filtered_data_set.json <container_hash>:/tmp Then in container:
micromamba create -n evaluator -c conda-forge openff-evaluator -c openeye openeye-toolkits
filtered_data_set.json:
|
Run evaluator w/ server in separate process | server.py: from openff.evaluator.backends.dask import DaskLocalCluster
from openff.evaluator.server import EvaluatorServer
with DaskLocalCluster() as calculation_backend:
evaluator_server = EvaluatorServer(calculation_backend)
evaluator_server.start()
client.py import pathlib
from openff.evaluator.datasets import PhysicalPropertyDataSet
data_set_path = "filtered_data_set.json"
if not pathlib.Path(data_set_path).exists():
from openff.evaluator.utils import get_data_filename
data_set_path = get_data_filename("tutorials/tutorial01/filtered_data_set.json")
data_set = PhysicalPropertyDataSet.from_json(data_set_path)
from openff.evaluator.forcefield import SmirnoffForceFieldSource
force_field_path = "openff-1.0.0.offxml"
force_field_source = SmirnoffForceFieldSource.from_path(force_field_path)
from openff.evaluator.properties import Density, EnthalpyOfVaporization
density_schema = Density.default_simulation_schema(n_molecules=256)
for schema in density_schema.workflow_schema.protocol_schemas:
# equilibration_simulation is a Protocol
if "simulation" in schema.id:
schema.inputs[".steps_per_iteration"] = 10
schema.inputs[".output_frequency"] = 10
# conditional_group is a group of protocols
if "conditional" in schema.id:
for protocol_name, protocol in schema.protocol_schemas.items():
if "simulation" in protocol_name:
protocol.inputs[".steps_per_iteration"] = 10
protocol.inputs[".output_frequency"] = 10
from openff.evaluator.client import RequestOptions
# Create an options object which defines how the data set should be estimated.
estimation_options = RequestOptions()
# Specify that we only wish to use molecular simulation to estimate the data set.
estimation_options.calculation_layers = ["SimulationLayer"]
# Add our custom schemas, specifying that the should be used by the 'SimulationLayer'
estimation_options.add_schema("SimulationLayer", "Density", density_schema)
from openff.evaluator.client import EvaluatorClient
evaluator_client = EvaluatorClient()
request, exception = evaluator_client.request_estimate(
property_set=data_set,
force_field_source=force_field_source,
options=estimation_options,
)
assert exception is None
results, exception = request.results(synchronous=True, polling_interval=30)
assert exception is None
print(len(results.queued_properties))
print(len(results.estimated_properties))
print(len(results.unsuccessful_properties))
print(len(results.exceptions))
print(results.estimated_properties.json("estimated_data_set.json", format=True)) |
Run evaluator client locally and server in docker |
Getting a real connection on port 8000 (if I change the client port to 8001 I get “connection refused”) but it’s failing at the (evaluator) jeffreywagner@JW-MBP$ python client.py
Traceback (most recent call last):
File "/Users/jeffreywagner/projects/OpenForceField/2024_07_31_evaluator_on_nrp/client.py", line 49, in <module>
assert exception is None, exception
AssertionError: Traceback (most recent call last):
File "/Users/jeffreywagner/mambaforge/envs/evaluator/lib/python3.10/site-packages/openff/evaluator/client/client.py", line 811, in _send_calculations_to_server
length = unpack_int(header)[0]
TypeError: a bytes-like object is required, not 'NoneType'
I get this error whether or not the server is running
|
Run evaluator worker on NRP, installing software in base container |
|
Build evaluator worker docker image and deploy on DockerHub |
|