summaryrefslogtreecommitdiff
path: root/taskflow/examples/simple_linear_listening.py
diff options
context:
space:
mode:
authorIvan A. Melnikov <imelnikov@griddynamics.com>2013-08-26 18:40:10 +0400
committerIvan A. Melnikov <imelnikov@griddynamics.com>2013-08-27 12:54:23 +0400
commitcd04997bce05c0fa2e493c0497296a96e03071a6 (patch)
tree7a0f50ed8a788c331cca5f72944d1c2c0b8ec020 /taskflow/examples/simple_linear_listening.py
parent7a09c044e337a33ae8bb0539fb4c0e714bdee4ba (diff)
downloadtaskflow-cd04997bce05c0fa2e493c0497296a96e03071a6.tar.gz
Check examples when running tests
Add testcase that executes all examples from taskflow/examples directory. For examples with somewhat deterministic output the output is also checked. This commit also fixes couple of examples broken by recent decorators refactoring. Change-Id: I3e65eabde43e1dd26b442d8f7dd3f062bf80703d
Diffstat (limited to 'taskflow/examples/simple_linear_listening.py')
-rw-r--r--taskflow/examples/simple_linear_listening.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/taskflow/examples/simple_linear_listening.py b/taskflow/examples/simple_linear_listening.py
index c53cc62..533f424 100644
--- a/taskflow/examples/simple_linear_listening.py
+++ b/taskflow/examples/simple_linear_listening.py
@@ -8,19 +8,23 @@ my_dir_path = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(os.path.join(my_dir_path, os.pardir),
os.pardir))
+from taskflow import decorators
from taskflow.patterns import linear_flow as lf
+@decorators.task
def call_jim(context):
print("Calling jim.")
print("Context = %s" % (context))
+@decorators.task
def call_joe(context):
print("Calling joe.")
print("Context = %s" % (context))
+@decorators.task
def flow_watch(state, details):
flow = details['flow']
old_state = details['old_state']
@@ -29,6 +33,7 @@ def flow_watch(state, details):
print('Flow "%s": context=%s' % (flow.name, context))
+@decorators.task
def task_watch(state, details):
flow = details['flow']
runner = details['runner']
@@ -43,6 +48,7 @@ flow.add(call_joe)
flow.notifier.register('*', flow_watch)
flow.task_notifier.register('*', task_watch)
+
context = {
"joe_number": 444,
"jim_number": 555,