Skip to content
Snippets Groups Projects
Commit b3b9a7e7 authored by Stefano Borini's avatar Stefano Borini
Browse files

Fixed BaseMCO and Dakota with appropriate events

parent ba140834
No related branches found
No related tags found
1 merge request!86Improve event handling
...@@ -30,6 +30,7 @@ class DummyDakotaOptimizer(BaseMCO): ...@@ -30,6 +30,7 @@ class DummyDakotaOptimizer(BaseMCO):
application = self.factory.plugin.application application = self.factory.plugin.application
self.started = True
for value in value_iterator: for value in value_iterator:
ps = subprocess.Popen( ps = subprocess.Popen(
[sys.argv[0], [sys.argv[0],
...@@ -45,3 +46,5 @@ class DummyDakotaOptimizer(BaseMCO): ...@@ -45,3 +46,5 @@ class DummyDakotaOptimizer(BaseMCO):
'input': tuple(value), 'input': tuple(value),
'output': tuple(out_data) 'output': tuple(out_data)
} }
self.finished = True
import abc import abc
from traits.api import ABCHasStrictTraits, Instance, Event from traits.api import ABCHasStrictTraits, Instance, Event, Dict, Str, Tuple
from force_bdss.mco.events import BaseMCOEvent
from .i_mco_factory import IMCOFactory from .i_mco_factory import IMCOFactory
...@@ -15,10 +14,12 @@ class BaseMCO(ABCHasStrictTraits): ...@@ -15,10 +14,12 @@ class BaseMCO(ABCHasStrictTraits):
factory = Instance(IMCOFactory) factory = Instance(IMCOFactory)
#: Triggered when an event occurs. #: Triggered when an event occurs.
event = Event(BaseMCOEvent) started = Event()
finished = Event()
# Event triggered when the mco wants to send new data to listeners # Event triggered when the mco wants to send new data to listeners
new_data = Event() new_data = Event(Dict(Str(), Tuple()))
def __init__(self, factory, *args, **kwargs): def __init__(self, factory, *args, **kwargs):
"""Initializes the MCO. """Initializes the MCO.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment