Purpose of this file is for the integration of Radical Pilot with AdaptiveMD workflow.


In [1]:
from adaptivemd import Project, File, Configuration
from adaptivemd.mongodb import MongoDBStorage
from adaptivemd.engine.openmm import OpenMMEngine
from adaptivemd.analysis.pyemma import PyEMMAAnalysis
from adaptivemd.rp.client import Client


/home/johnrobot/myenv/local/lib/python2.7/site-packages/radical/utils/atfork/stdlib_fixer.py:63: UserWarning: logging module already imported before fixup.
  warnings.warn('logging module already imported before fixup.')

In [3]:
#Project.set_dblocation("user:user@ds159013.mlab.com", 59013)
#Project.set_dblocation("user:user@two.radical-project.org", 32769)
print MongoDBStorage._db_url
project_name = 'rp_testing_modeller_1'


mongodb://localhost:27017/

In [3]:
Project.list()


Out[3]:
[u'rp_testing_3', u'rp_testing_modeller_1']

In [4]:
Project.delete(project_name)
#[Project.delete(p) for p in Project.list()]
Project.list()


Out[4]:
[u'rp_testing_3']

In [5]:
project = Project(project_name)
#old#project.initialize(resource)
#old#resource = LocalResource()
project.initialize()

In [6]:
#configs = [ Configuration("local-1", resource_name="local.localhost") ]
#
#configs.append( Configuration(name="titan.1",
#                       shared_path="/lustre/atlas/scratch/jrossyra/bip149/admd/",
#                       queues=["batch"],
#                       allocation="bip149",
#                       cores_per_node=16,
#                       resource_name="ornl.titan")
#             )
#
#configs.append( Configuration(name="titan.2",
#                       shared_path="/lustre/atlas/scratch/jrossyra/bip141/admd/",
#                       queues=["batch"],
#                       allocation="bip141",
#                       cores_per_node=16,
#                       resource_name="ornl.titan")
#              )
#'''
#configs.append( Configuration(name="rhea.1",
#                       shared_path="/lustre/atlas/scratch/jrossyra/bip149/admd/",
#                       queues=["batch"],
#                       allocation="bip149",
#                       cores_per_node=16,
#                       resource_name="ornl.rhea")
#              )
#
#configs.append( Configuration(name="rhea.2",
#                       shared_path="/lustre/atlas/scratch/jrossyra/bip141/admd/",
#                       queues=["batch"],
#                       allocation="bip141",
#                       cores_per_node=16,
#                       resource_name="ornl.rhea")
#              )
#'''
#[project.storage.save(c) for c in configs]


Out[6]:
[(store.configurations[Configuration] : 3 object(s),
  206822736530041365196398208727486824500L,
  206822736530041365196398208727486824500L),
 (store.configurations[Configuration] : 3 object(s),
  206822736530041365196398208727486824502L,
  206822736530041365196398208727486824502L),
 (store.configurations[Configuration] : 3 object(s),
  206822736530041365196398208727486824504L,
  206822736530041365196398208727486824504L)]

In [7]:
# sweet!
Project.list()


Out[7]:
[u'rp_testing_3', u'rp_testing_modeller_1']

In [8]:
# This is not necessary for executing with RP
#pdb_file = File('file://../files/alanine/alanine.pdb').named('initial_pdb').load()
#system_file = File('file://../files/alanine/system.xml').load()
#integrator_file = File('file://../files/alanine/integrator.xml').load()
pdb_file = File('file://../files/alanine/alanine.pdb').named('initial_pdb')
system_file = File('file://../files/alanine/system.xml')
integrator_file = File('file://../files/alanine/integrator.xml')

In [9]:
engine = OpenMMEngine(
    pdb_file=pdb_file,
    system_file=system_file,
    integrator_file=integrator_file,
    args='-r --report-interval 1 -p CPU'
).named('openmm')

engine.add_output_type('master', 'master.dcd', stride=10)
engine.add_output_type('protein', 'protein.dcd', stride=1, selection='protein')

modeller = PyEMMAAnalysis(
    engine=engine,
    outtype='protein',
    features={'add_inverse_distances': {'select_Backbone': None}}
).named('pyemma')

margs = dict(tica_stride=1, tica_lag=5, tica_dim=2,
    clust_stride=1, msm_states=10, msm_lag=5)

In [10]:
project.generators.add(engine)
project.generators.add(modeller)

In [11]:
# TODO have this return resource so it can be given directly
#      to the queueing function, and keep the option of using
#      the resource name as well
project.request_resource(2,10, destination='local.localhost')
#project.request_resource(2,30, destination='ornl.titan')


Out[11]:
<adaptivemd.resource.Resource at 0x7f6ee119e6d0>

In [12]:
trajectories = project.new_trajectory(engine['pdb_file'], 100, engine, 4)
project.queue(trajectories, resource_name="local.localhost")
print trajectories


[Trajectory('alanine.pdb' >> 00000000[0..100]), Trajectory('alanine.pdb' >> 00000001[0..100]), Trajectory('alanine.pdb' >> 00000002[0..100]), Trajectory('alanine.pdb' >> 00000003[0..100])]

In [13]:
client = Client('mongodb://user:user@two.radical-project.org:32769/', project_name)
#import os
#os.environ['RADICAL_PILOT_DBURL'] = 'mongodb://rp:rp@ds015335.mlab.com:15335/rp'
#os.system('export RP_ENABLE_OLD_DEFINES=True')
client.start()


Resource local.localhost
new session: [rp.session.vivek-HP-Pavilion-m6-Notebook-PC.vivek.017407.0020]   \
database   : [mongodb://rp:rp@ds015335.mlab.com:15335/rp]                     ok
create pilot manager                                                          ok
submit 1 pilot(s)
        .                                                                     ok
create unit manager
Exception AttributeError: "'Cursor' object has no attribute '_Cursor__id'" in <bound method Cursor.__del__ of <pymongo.cursor.Cursor object at 0x7f6f0847c990>> ignored
                                                           ok
add 1 pilot(s)                                                                ok
[{'action': 'Link', 'source': u'pilot:///alanine.pdb', 'target': u'unit:///initial.pdb'}, {'action': 'Link', 'source': u'pilot:///system.xml', 'target': u'unit:///system.xml'}, {'action': 'Link', 'source': u'pilot:///integrator.xml', 'target': u'unit:///integrator.xml'}, {'action': 'Link', 'source': u'pilot:///openmmrun.py', 'target': u'unit:///openmmrun.py'}]
[{'action': 'Link', 'source': u'pilot:///alanine.pdb', 'target': u'unit:///initial.pdb'}, {'action': 'Link', 'source': u'pilot:///system.xml', 'target': u'unit:///system.xml'}, {'action': 'Link', 'source': u'pilot:///integrator.xml', 'target': u'unit:///integrator.xml'}, {'action': 'Link', 'source': u'pilot:///openmmrun.py', 'target': u'unit:///openmmrun.py'}]
[{'action': 'Link', 'source': u'pilot:///alanine.pdb', 'target': u'unit:///initial.pdb'}, {'action': 'Link', 'source': u'pilot:///system.xml', 'target': u'unit:///system.xml'}, {'action': 'Link', 'source': u'pilot:///integrator.xml', 'target': u'unit:///integrator.xml'}, {'action': 'Link', 'source': u'pilot:///openmmrun.py', 'target': u'unit:///openmmrun.py'}]
[{'action': 'Link', 'source': u'pilot:///alanine.pdb', 'target': u'unit:///initial.pdb'}, {'action': 'Link', 'source': u'pilot:///system.xml', 'target': u'unit:///system.xml'}, {'action': 'Link', 'source': u'pilot:///integrator.xml', 'target': u'unit:///integrator.xml'}, {'action': 'Link', 'source': u'pilot:///openmmrun.py', 'target': u'unit:///openmmrun.py'}]
submit 4 unit(s)
        ....                                                                  ok
2ccfb5ca-8d12-11e7-ba47-000000000098
2ccfb5ca-8d12-11e7-ba47-000000000078
2ccfb5ca-8d12-11e7-ba47-0000000000d8
2ccfb5ca-8d12-11e7-ba47-0000000000b8
[{'action': 'Link', 'source': u'pilot:///alanine.pdb', 'target': u'unit:///initial.pdb'}, {'action': 'Link', 'source': u'pilot:///system.xml', 'target': u'unit:///system.xml'}, {'action': 'Link', 'source': u'pilot:///integrator.xml', 'target': u'unit:///integrator.xml'}, {'action': 'Link', 'source': u'pilot:///openmmrun.py', 'target': u'unit:///openmmrun.py'}]
[{'action': 'Link', 'source': u'pilot:///alanine.pdb', 'target': u'unit:///initial.pdb'}, {'action': 'Link', 'source': u'pilot:///system.xml', 'target': u'unit:///system.xml'}, {'action': 'Link', 'source': u'pilot:///integrator.xml', 'target': u'unit:///integrator.xml'}, {'action': 'Link', 'source': u'pilot:///openmmrun.py', 'target': u'unit:///openmmrun.py'}]
[{'action': 'Link', 'source': u'pilot:///alanine.pdb', 'target': u'unit:///initial.pdb'}, {'action': 'Link', 'source': u'pilot:///system.xml', 'target': u'unit:///system.xml'}, {'action': 'Link', 'source': u'pilot:///integrator.xml', 'target': u'unit:///integrator.xml'}, {'action': 'Link', 'source': u'pilot:///openmmrun.py', 'target': u'unit:///openmmrun.py'}]
[{'action': 'Link', 'source': u'pilot:///alanine.pdb', 'target': u'unit:///input.pdb'}]
submit 4 unit(s)
        ....                                                                  ok
[{'action': 'Link', 'source': u'pilot:///alanine.pdb', 'target': u'unit:///input.pdb'}]
submit 1 unit(s)
        .                                                                     ok
[{'action': 'Link', 'source': u'pilot:///alanine.pdb', 'target': u'unit:///input.pdb'}]
submit 1 unit(s)
        .                                                                     ok
[{'action': 'Link', 'source': u'pilot:///alanine.pdb', 'target': u'unit:///input.pdb'}]
submit 1 unit(s)
        .                                                                     ok
[{'action': 'Link', 'source': u'pilot:///alanine.pdb', 'target': u'unit:///input.pdb'}]
submit 1 unit(s)
        .                                                                     ok
[{'action': 'Link', 'source': u'pilot:///alanine.pdb', 'target': u'unit:///input.pdb'}]
submit 1 unit(s)
        .                                                                     ok
2ccfb5ca-8d12-11e7-ba47-000000000164
2ccfb5ca-8d12-11e7-ba47-000000000144
2ccfb5ca-8d12-11e7-ba47-000000000124
Exception AttributeError: "'Cursor' object has no attribute '_Cursor__id'" in <bound method Cursor.__del__ of <pymongo.cursor.Cursor object at 0x7f6f0a941fd0>> ignored

In [14]:
mixedbag = project.new_trajectory(engine['pdb_file'], 100, engine, 3)
#mixedbag=[]
mtask = modeller.execute(trajectories, **margs)
mixedbag.append(mtask)
project.queue(mixedbag, resource_name='local.localhost')


supering from pythontask
making preposttask

In [16]:
project.trajectories.__len__()


Out[16]:
4

In [17]:
t=trajectories[0]

In [18]:
t.est_exec_time


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-18-9eb65fbdb068> in <module>()
----> 1 t.est_exec_time

AttributeError: 'Trajectory' object has no attribute 'est_exec_time'

In [18]:
client.stop()

In [16]:
mixedbag = project.new_trajectory(engine['pdb_file'], 100, engine, 3)
mtask = modeller.execute(list(project.trajectories), **margs)
mixedbag.append(mtask)
project.queue(mixedbag, resource_name='local.localhost')


supering from pythontask
making preposttask

In [13]:
f = lambda: len(project.trajectories) == 4
project.wait_until(f)

In [15]:
client.stop()

In [15]:
project.tasks.__len__()


Out[15]:
4

In [15]:
project.trajectories.__len__()


Out[15]:
0

In [13]:
ta=project.tasks.last

In [15]:
for ta in project.tasks:
    print ta.description[:55]
    print ta.est_exec_time


Task: TrajectoryGenerationTask(OpenMMEngine) [success]

1
Task: TrajectoryGenerationTask(OpenMMEngine) [success]

1
Task: TrajectoryGenerationTask(OpenMMEngine) [success]

1
Task: TrajectoryGenerationTask(OpenMMEngine) [success]

1
Task: TrajectoryGenerationTask(OpenMMEngine) [success]

1
Task: TrajectoryGenerationTask(OpenMMEngine) [success]

1
Task: TrajectoryGenerationTask(OpenMMEngine) [success]

1
Task: PythonTask(PyEMMAAnalysis) [cancelled]

Sources
-
5

In [ ]: