def start(self, graph_id, done_callback):
"""
Execute a graph.
"""
self.logger.debug('Graph {}: Starting execution'.format(graph_id))
graph = self.get_graph(graph_id)
network = Network(graph)
executor = gevent.Greenlet(network.go)
# FIXME: should we delete the executor from self._executors on finish?
# this has an impact on the result returned from get_status(). Leaving
# it means that after completion it will be started:True, running:False
# until stop() is triggered, at which point it will be started:False,
# running:False
executor.link(lambda g: done_callback())
self._executors[graph_id] = (executor, network)
executor.start()
# if executor.is_running():
# raise ValueError('Graph {} is already started'.format(graph_id))
评论列表
文章目录