diff options
Diffstat (limited to 'examples/script-example.py')
-rwxr-xr-x | examples/script-example.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/examples/script-example.py b/examples/script-example.py index 316a1d1..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) @@ -93,7 +99,16 @@ if __name__ == '__main__': client_a.add_node(node_b) client_b.add_node(node_b) client_c.add_node(node_b) - story.parse_script_file('example-script.rsb') + script_file = os.path.join( + os.path.dirname(__file__), + '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() |