Skip to content

Commit 03ce4f5

Browse files
committed
add worker-based execution example notebook
1 parent 8dbb412 commit 03ce4f5

3 files changed

Lines changed: 93 additions & 6 deletions

File tree

environment.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ dependencies:
1414
- pytest-cov
1515
- pytest-xdist
1616
- python
17-
- openfe==1.11.0
1817
- openff-interchange-base != 0.5.1 # https://github.com/openforcefield/openff-interchange/issues/1450
18+
- openfe
19+
# tmp for dev build
20+
- zstandard
21+
- msgpack-python
1922
- pip:
20-
- git+https://github.com/OpenFreeEnergy/openfe_analysis@v0.5.0 # Use conda-forge v0.5 after new openfe release updates pins on openfe-analysis
21-
- git+https://github.com/OpenFreeEnergy/cinnabar@0.6.0 # Use conda-forge v0.6.0 after new openfe release updates pins on cinnabar
22-
- git+https://github.com/OpenFreeEnergy/kartograf@v2.0.0 # Use conda-forge v2.0 after new openfe release updates pins on kartogra
23-
- git+https://github.com/OpenFreeEnergy/konnektor@v0.4.0 # use conda-forge v0.4.0 after openfe conda-forge release
24-
- git+https://github.com/OpenFreeEnergy/Lomap@v3.3.0 # use conda-forge v3.3.0 after openfe conda-forge release
23+
- git+https://github.com/OpenFreeEnergy/openfe@epic/execution_improvements
24+
- git+https://github.com/OpenFreeEnergy/exorcist@main
25+
- git+https://github.com/OpenFreeEnergy/gufe@main
26+
27+

execution/alchemicalNetwork_mc1_small.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "dfffe446-14c0-4dea-92ea-0b9f862fdec6",
6+
"metadata": {},
7+
"source": [
8+
"# Worker-Based Execution"
9+
]
10+
},
11+
{
12+
"cell_type": "code",
13+
"execution_count": 1,
14+
"id": "b600d427-abe5-418b-b4d1-a7cb23d7edf0",
15+
"metadata": {},
16+
"outputs": [],
17+
"source": [
18+
"import openfe"
19+
]
20+
},
21+
{
22+
"cell_type": "markdown",
23+
"id": "0a2035c9-8e0f-454e-9189-be3e41ae57f6",
24+
"metadata": {},
25+
"source": [
26+
"load an AlchemicalNetwork to execute - this is a small example campaign with only two edges and pre-charged ligands"
27+
]
28+
},
29+
{
30+
"cell_type": "code",
31+
"execution_count": 2,
32+
"id": "6b72c4a4-310b-498d-afab-78950d5242bc",
33+
"metadata": {},
34+
"outputs": [
35+
{
36+
"ename": "FileNotFoundError",
37+
"evalue": "[Errno 2] No such file or directory: 'alchemicalNetwork_mc1_small.json'",
38+
"output_type": "error",
39+
"traceback": [
40+
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
41+
"\u001b[31mFileNotFoundError\u001b[39m Traceback (most recent call last)",
42+
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[2]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m alchemical_network = openfe.AlchemicalNetwork.from_json(\u001b[33m\"alchemicalNetwork_mc1_small.json\"\u001b[39m)\n",
43+
"\u001b[36mFile \u001b[39m\u001b[32m~/micromamba/envs/openfe-notebooks/lib/python3.13/site-packages/gufe/tokenization.py:750\u001b[39m, in \u001b[36mGufeTokenizable.from_json\u001b[39m\u001b[34m(cls, file, content)\u001b[39m\n\u001b[32m 746\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mcls\u001b[39m.from_dict(deserialized)\n\u001b[32m 748\u001b[39m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mgufe\u001b[39;00m\u001b[34;01m.\u001b[39;00m\u001b[34;01mutils\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m ensure_filelike\n\u001b[32m--> \u001b[39m\u001b[32m750\u001b[39m \u001b[30;43m\u001b[39;49m\u001b[30;43;01mwith\u001b[39;49;00m\u001b[30;43m \u001b[39;49m\u001b[30;43mensure_filelike\u001b[39;49m\u001b[30;43m(\u001b[39;49m\u001b[30;43mfile\u001b[39;49m\u001b[30;43m,\u001b[39;49m\u001b[30;43m \u001b[39;49m\u001b[30;43mmode\u001b[39;49m\u001b[30;43m=\u001b[39;49m\u001b[30;43m\"\u001b[39;49m\u001b[30;43mr\u001b[39;49m\u001b[30;43m\"\u001b[39;49m\u001b[30;43m)\u001b[39;49m\u001b[30;43m \u001b[39;49m\u001b[30;43;01mas\u001b[39;49;00m\u001b[30;43m \u001b[39;49m\u001b[30;43mf\u001b[39;49m\u001b[30;43m:\u001b[39;49m\n\u001b[32m 751\u001b[39m \u001b[30;43m \u001b[39;49m\u001b[30;43mdeserialized\u001b[39;49m\u001b[30;43m \u001b[39;49m\u001b[30;43m=\u001b[39;49m\u001b[30;43m \u001b[39;49m\u001b[30;43mjson\u001b[39;49m\u001b[30;43m.\u001b[39;49m\u001b[30;43mload\u001b[39;49m\u001b[30;43m(\u001b[39;49m\u001b[30;43mf\u001b[39;49m\u001b[30;43m,\u001b[39;49m\u001b[30;43m \u001b[39;49m\u001b[30;43mcls\u001b[39;49m\u001b[30;43m=\u001b[39;49m\u001b[30;43mJSON_HANDLER\u001b[39;49m\u001b[30;43m.\u001b[39;49m\u001b[30;43mdecoder\u001b[39;49m\u001b[30;43m)\u001b[39;49m\n\u001b[32m 753\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n",
44+
"\u001b[36mFile \u001b[39m\u001b[32m~/micromamba/envs/openfe-notebooks/lib/python3.13/site-packages/gufe/utils.py:212\u001b[39m, in \u001b[36mensure_filelike.__enter__\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 210\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34m__enter__\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[32m 211\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m.to_open \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m212\u001b[39m \u001b[38;5;28mself\u001b[39m.context = \u001b[30;43mopen\u001b[39;49m\u001b[30;43m(\u001b[39;49m\u001b[30;43mself\u001b[39;49m\u001b[30;43m.\u001b[39;49m\u001b[30;43mto_open\u001b[39;49m\u001b[30;43m,\u001b[39;49m\u001b[30;43m \u001b[39;49m\u001b[30;43mmode\u001b[39;49m\u001b[30;43m=\u001b[39;49m\u001b[30;43mself\u001b[39;49m\u001b[30;43m.\u001b[39;49m\u001b[30;43mmode\u001b[39;49m\u001b[30;43m)\u001b[39;49m\n\u001b[32m 214\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m.context\n",
45+
"\u001b[31mFileNotFoundError\u001b[39m: [Errno 2] No such file or directory: 'alchemicalNetwork_mc1_small.json'"
46+
]
47+
}
48+
],
49+
"source": [
50+
"alchemical_network = openfe.AlchemicalNetwork.from_json(\"alchemicalNetwork_mc1_small.json\")"
51+
]
52+
},
53+
{
54+
"cell_type": "code",
55+
"execution_count": null,
56+
"id": "4080f228-4603-432b-b64f-c632f2c8e52c",
57+
"metadata": {},
58+
"outputs": [],
59+
"source": []
60+
}
61+
],
62+
"metadata": {
63+
"kernelspec": {
64+
"display_name": "Python 3 (ipykernel)",
65+
"language": "python",
66+
"name": "python3"
67+
},
68+
"language_info": {
69+
"codemirror_mode": {
70+
"name": "ipython",
71+
"version": 3
72+
},
73+
"file_extension": ".py",
74+
"mimetype": "text/x-python",
75+
"name": "python",
76+
"nbconvert_exporter": "python",
77+
"pygments_lexer": "ipython3",
78+
"version": "3.13.15"
79+
}
80+
},
81+
"nbformat": 4,
82+
"nbformat_minor": 5
83+
}

0 commit comments

Comments
 (0)