From 510bb2116ea3e6c0d2559fe1b0c465f010d74bfb Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Mon, 13 Nov 2017 12:18:55 +0100 Subject: utils, examples: Add ExperimentManager CM Adds an ExperimentManager context manager for scripts: - No more ugly stack traces after execution if something goes wrong - No more ugly and easy to forget try-finally blocks --- examples/jfed-rlite.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'examples/jfed-rlite.py') diff --git a/examples/jfed-rlite.py b/examples/jfed-rlite.py index d80b56e..5cc087f 100755 --- a/examples/jfed-rlite.py +++ b/examples/jfed-rlite.py @@ -1,6 +1,7 @@ #!/usr/bin/env python from rumba.model import * +from rumba.utils import ExperimentManager import rumba.testbeds.jfed as jfed import rumba.prototypes.rlite as rlite @@ -46,9 +47,7 @@ tb = jfed.Testbed(exp_name = args.expname, exp = rlite.Experiment(tb, nodes = [a, b]) -try: +with ExperimentManager(exp): exp.swap_in() exp.install_prototype() exp.bootstrap_prototype() -finally: - exp.swap_out() -- cgit v1.2.3