Commit dcf89512 authored by Sebastien Petitdemange's avatar Sebastien Petitdemange Committed by Emmanuel Papillon
Browse files

acquisition chain: ensure to wait all stop command.

It's better to wait the end of all stop command.
Previously exit the joinall at the first exception seen.
parent bc28d902
......@@ -306,9 +306,11 @@ class AcquisitionChainIter(object):
def stop(self):
self._execute("stop", master_to_slave=True)
self._execute("stop", master_to_slave=True,wait_all_tasks=True)
preset_tasks = [gevent.spawn(preset.stop) for preset in self.__acquisition_chain._presets_list]
gevent.joinall(preset_tasks) # wait to call all stop on preset
gevent.joinall(preset_tasks, raise_error=True)
def next(self):
......@@ -331,7 +333,8 @@ class AcquisitionChainIter(object):
return self
def _execute(self, func_name,
master_to_slave=False, wait_between_levels=True):
master_to_slave=False, wait_between_levels=True,
tasks = list()
prev_level = None
......@@ -350,6 +353,11 @@ class AcquisitionChainIter(object):
prev_level = level
func = getattr(dev, func_name)
# ensure that all tasks are executed
# (i.e: don't raise the first exception on stop)
if wait_all_tasks:
gevent.joinall(tasks, raise_error=True)
class AcquisitionChain(object):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment