markovmodel / adaptivemd

A python framework to run adaptive Markov state model (MSM) simulation on HPC resources
GNU Lesser General Public License v2.1
18 stars 7 forks source link

Events not working #46

Closed thempel closed 7 years ago

thempel commented 7 years ago

When using the tutorial ipython notebooks, importing Event and FunctionalEvent is not possible. I remember there was some change in the API, but can't find a reference.

thempel commented 7 years ago

Sorry, we must have been working with the old tutorial. Events are now directly created by calling project.add_event(strategy(...)). @jayveeabella, can you confirm that the tutorial works? I'm getting AttributeError: 'ExecutionPlan' object has no attribute '_finish_conditions'

thempel commented 7 years ago

Okay, tutorial notebook 3 (example adaptive) does not work. project.add_event(strategy(loops=2)) will produce the following error. This probably has an easy fix, since only ExecutionPlan._finish_conditions needs to be properly initialized in the __init__ section, if I'm not wrong. @jhprinz?

AttributeError                            Traceback (most recent call last)
<ipython-input-8-47fb6d790756> in <module>()
----> 1 project.add_event(strategy(loops=2))

/home/tim/mystorage/adaptive_MD_test/adaptivemd/adaptivemd/project.pyc in add_event(self, event)
    630         logger.info('Events added. Remaining %d' % len(self._events))
    631 
--> 632         self.trigger()
    633         return event
    634 

/home/tim/mystorage/adaptive_MD_test/adaptivemd/adaptivemd/project.pyc in trigger(self)
    648                 for event in list(self._events):
    649                     if event:
--> 650                         new_events = event.trigger(self)
    651 
    652                         if new_events:

/home/tim/mystorage/adaptive_MD_test/adaptivemd/adaptivemd/plan.pyc in trigger(self, scheduler)
     53     def trigger(self, scheduler):
     54         if self:
---> 55             self._update_conditions()
     56             while self._running and len(self._finish_conditions) == 0:
     57                 self(scheduler)

/home/tim/mystorage/adaptive_MD_test/adaptivemd/adaptivemd/plan.pyc in _update_conditions(self)
     36     def _update_conditions(self):
     37         self._finish_conditions = filter(
---> 38             lambda x: not x(), self._finish_conditions)
     39 
     40     def __call__(self, scheduler):

AttributeError: 'ExecutionPlan' object has no attribute '_finish_conditions'