aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMarco Capitani <m.capitani@nextworks.it>2018-03-26 15:48:13 +0200
committerMarco Capitani <m.capitani@nextworks.it>2018-03-26 16:37:43 +0200
commit81dfe735a72683b7dc87f329d9a25a1868fe74f1 (patch)
tree5b63062179758e6ae08264dc42483246e7ff381b /examples
parentf4eada17dffbeba60a95cf77e7f946af5b351556 (diff)
downloadrumba-81dfe735a72683b7dc87f329d9a25a1868fe74f1.tar.gz
rumba-81dfe735a72683b7dc87f329d9a25a1868fe74f1.zip
storyboard: add callback parameter to run_client(_of) method
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/script-example.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/script-example.py b/examples/script-example.py
index 5e14823..6cfaf42 100755
--- a/examples/script-example.py
+++ b/examples/script-example.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# An example script leveraging the storyboard scripting functionality
+from functools import partial
from rumba.storyboard import *
from rumba.model import *
@@ -83,6 +84,11 @@ server_c = Server(
s_id='server_c'
)
+typewriter = Client(
+ "touch test_file",
+ shutdown=""
+)
+
if __name__ == '__main__':
story = StoryBoard(30)
@@ -98,6 +104,11 @@ if __name__ == '__main__':
'example-script.rsb'
)
story.parse_script_file(script_file)
+ cb = partial(story.run_command, node_a, "ls -l test_file")
+ # This will return a file, because it will run after
+ # Triggering_event
+ action = partial(story.run_client, typewriter, 0.2, node=node_a, callback=cb)
+ story.add_event(Event(action, ev_time=12, ev_id='Triggering_event'))
log.flush_log()
with ExperimentManager(exp):
exp.swap_in()