It is important that workflow_time
functions be used isntead of the regular time
within the decider.
The decider requires deterministic time
and sleep
related to the workflow execution.
botoflow.workflow_time.
time
() → integer¶Return the current time in seconds since the Epoch.
Fractions of a second will not be presented as in the time.time()
.
from botoflow import coroutine
from botoflow.workflow_time import time
...
@coroutine
def run_after(self, when):
if time() > when:
yield Activities.some_activity()
botoflow.workflow_time.
sleep
(seconds)¶Value that becomes ready after the specified delay. It acts like time.sleep() if used together with a yield.
from botoflow import coroutine
from botoflow.workflow_time import sleep
...
@coroutine
def sleeping(self, time_to_sleep):
yield sleep(time_to_sleep)
@coroutine
def manual_timeout(self, time_to_sleep):
# *for illustration purposes*, you should prefer using activity start_to_close timeout instead
activity_future = Activities.long_activity()
yield sleep(time_to_sleep)
return activity_future.done()
Future representing the timer
botoflow.core.future.Future
botoflow.workflow_time.
is_replaying
()¶Indicates if the workflow is currently replaying (True) or generating (False) new decisions.
This could be useful for filtering out logs for transitions that have
already completed. See: BotoflowFilter
.