Merge "Pass through run timeout in engine run()"
This commit is contained in:
@@ -216,12 +216,18 @@ class ActionEngine(base.Engine):
|
|||||||
backend=self._backend,
|
backend=self._backend,
|
||||||
scope_fetcher=_scope_fetcher)
|
scope_fetcher=_scope_fetcher)
|
||||||
|
|
||||||
def run(self):
|
def run(self, timeout=None):
|
||||||
|
"""Runs the engine (or die trying).
|
||||||
|
|
||||||
|
:param timeout: timeout to wait for any atoms to complete (this timeout
|
||||||
|
will be used during the waiting period that occurs when
|
||||||
|
unfinished atoms are being waited on).
|
||||||
|
"""
|
||||||
with fasteners.try_lock(self._lock) as was_locked:
|
with fasteners.try_lock(self._lock) as was_locked:
|
||||||
if not was_locked:
|
if not was_locked:
|
||||||
raise exc.ExecutionFailure("Engine currently locked, please"
|
raise exc.ExecutionFailure("Engine currently locked, please"
|
||||||
" try again later")
|
" try again later")
|
||||||
for _state in self.run_iter():
|
for _state in self.run_iter(timeout=timeout):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def run_iter(self, timeout=None):
|
def run_iter(self, timeout=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user