aboutsummaryrefslogtreecommitdiff
path: root/rumba/model.py
diff options
context:
space:
mode:
Diffstat (limited to 'rumba/model.py')
-rw-r--r--rumba/model.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/rumba/model.py b/rumba/model.py
index 99bf5ed..faf353c 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -615,12 +615,13 @@ class Experiment:
raise Exception('run_prototype() method not implemented')
def run(self):
- # Realize the experiment testbed (testbed-specific)
- self.testbed.swap_in(self)
-
- # Run the experiment using the prototype (prototype-specific)
- self.run_prototype()
-
- # Undo the testbed (testbed-specific)
- self.testbed.swap_out(self)
+ try:
+ # Realize the experiment testbed (testbed-specific)
+ self.testbed.swap_in(self)
+
+ # Run the experiment using the prototype (prototype-specific)
+ self.run_prototype()
+ finally:
+ # No matter what happens, undo the testbed (testbed-specific)
+ self.testbed.swap_out(self)