aboutsummaryrefslogtreecommitdiff
path: root/examples/jfed-rlite.py
diff options
context:
space:
mode:
authorMarco Capitani <m.capitani@nextworks.it>2017-11-13 12:18:55 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2017-11-13 15:48:27 +0000
commit510bb2116ea3e6c0d2559fe1b0c465f010d74bfb (patch)
tree4f1d56841da5e01398557b33e209b58317ab5227 /examples/jfed-rlite.py
parent9d15d1117c80ee9313d0dc391488efb9bb060a4a (diff)
downloadrumba-510bb2116ea3e6c0d2559fe1b0c465f010d74bfb.tar.gz
rumba-510bb2116ea3e6c0d2559fe1b0c465f010d74bfb.zip
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
Diffstat (limited to 'examples/jfed-rlite.py')
-rwxr-xr-xexamples/jfed-rlite.py5
1 files changed, 2 insertions, 3 deletions
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()