Skip to content

Commit

Permalink
Merge pull request #47 from jhprinz/fixexecutionplan
Browse files Browse the repository at this point in the history
Fix `ExecutionPlan`
  • Loading branch information
thempel committed Apr 18, 2017
2 parents 6432b91 + 4b94d49 commit 35eda32
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 89 deletions.
1 change: 1 addition & 0 deletions adaptivemd/plan.py
Expand Up @@ -32,6 +32,7 @@ def __init__(self, generator):

self._generator = generator
self._running = True
self._finish_conditions = []

def _update_conditions(self):
self._finish_conditions = filter(
Expand Down
111 changes: 22 additions & 89 deletions examples/tutorial/3_example_adaptive.ipynb
Expand Up @@ -18,7 +18,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {
"collapsed": true
},
Expand All @@ -29,15 +29,14 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from adaptivemd import (\n",
" Project,\n",
" Event, FunctionalEvent,\n",
" File\n",
")\n",
"\n",
Expand All @@ -56,7 +55,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {
"collapsed": false
},
Expand Down Expand Up @@ -88,21 +87,11 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<StoredBundle for with 222 file(s) @ 0x11443ab50>\n",
"<StoredBundle for with 2 file(s) @ 0x11443ab10>\n",
"<StoredBundle for with 34 file(s) @ 0x11443aad0>\n"
]
}
],
"outputs": [],
"source": [
"print project.files\n",
"print project.generators\n",
Expand All @@ -118,7 +107,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {
"collapsed": false
},
Expand Down Expand Up @@ -165,7 +154,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {
"collapsed": false
},
Expand All @@ -174,8 +163,8 @@
"def strategy(loops=10, trajs_per_loop=4, length=100):\n",
" for loop in range(loops):\n",
" # submit some trajectory tasks\n",
" trajectories = project.new_ml_trajectory(length, trajs_per_loop)\n",
" tasks = map(engine.task_run_trajectory, trajectories)\n",
" trajectories = project.new_ml_trajectory(engine, length, trajs_per_loop)\n",
" tasks = map(engine.run, trajectories)\n",
" project.queue(tasks)\n",
" \n",
" # continue if ALL of the tasks are done (can be failed)\n",
Expand All @@ -198,22 +187,11 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"<adaptivemd.event.FunctionalEvent at 0x10d615050>"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"project.add_event(strategy(loops=2))"
]
Expand Down Expand Up @@ -243,7 +221,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {
"collapsed": true
},
Expand All @@ -259,16 +237,7 @@
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"# of files 74 : ##########################################################################\n",
"# of models 33 : #################################\n"
]
}
],
"outputs": [],
"source": [
"try:\n",
" while project._events:\n",
Expand All @@ -292,22 +261,11 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"<adaptivemd.event.FunctionalEvent at 0x10d633850>"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"project.add_event(strategy(loops=2))"
]
Expand All @@ -321,25 +279,11 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"file://{}/alanine.pdb : [0, 0, 0]\n",
"sandbox:///{}/00000005/ : [95, 92, 67, 92]\n",
"sandbox:///{}/00000007/ : [11]\n",
"sandbox:///{}/00000011/ : [55]\n",
"sandbox:///{}/00000000/ : [28, 89, 72]\n",
"sandbox:///{}/00000002/ : [106]\n",
"sandbox:///{}/00000004/ : [31, 25, 60]\n"
]
}
],
"outputs": [],
"source": [
"# find, which frames from which trajectories have been chosen\n",
"trajs = project.trajectories\n",
Expand Down Expand Up @@ -370,7 +314,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {
"collapsed": true
},
Expand All @@ -388,22 +332,11 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"<adaptivemd.event.FunctionalEvent at 0x107744c90>"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"project.add_event(strategy(loops=10, trajs_per_loop=2))\n",
"project.add_event(strategy2())"
Expand All @@ -418,7 +351,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {
"collapsed": false
},
Expand All @@ -436,7 +369,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": null,
"metadata": {
"collapsed": false
},
Expand Down

0 comments on commit 35eda32

Please sign in to comment.