aboutsummaryrefslogtreecommitdiff
path: root/rumba/model.py
diff options
context:
space:
mode:
authorVincenzo Maffione <v.maffione@gmail.com>2017-04-07 19:40:12 +0200
committerVincenzo Maffione <v.maffione@gmail.com>2017-04-07 19:40:12 +0200
commitf1630941a0c47fdd025219340e5383cbaefcd85e (patch)
tree03da2fdb96d881e80905eb0557b24974c4e0e7fa /rumba/model.py
parent2666310aa2a25e5d66b669bde337711e7d22c904 (diff)
downloadrumba-f1630941a0c47fdd025219340e5383cbaefcd85e.tar.gz
rumba-f1630941a0c47fdd025219340e5383cbaefcd85e.zip
rumba: simplify cooperation between prototype and testbed plugins
Diffstat (limited to 'rumba/model.py')
-rw-r--r--rumba/model.py26
1 files changed, 19 insertions, 7 deletions
diff --git a/rumba/model.py b/rumba/model.py
index 25a1356..99bf5ed 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -37,8 +37,13 @@ class Testbed:
self.exp_name = exp_name
@abc.abstractmethod
- def create_experiment(self, experiment):
- raise Exception('create_experiment() not implemented')
+ def swap_in(self, experiment):
+ raise Exception('swap_in() not implemented')
+
+ @abc.abstractmethod
+ def swap_out(self, experiment):
+ print("swap_out(): nothing to do")
+
# Base class for DIFs
#
@@ -605,10 +610,17 @@ class Experiment:
self.compute_enrollments()
self.compute_ipcps()
- # Realize the experiment, using a testbed-specific setup
- def swap_in(self):
- self.testbed.create_experiment(self)
-
@abc.abstractmethod
+ def run_prototype(self):
+ raise Exception('run_prototype() method not implemented')
+
def run(self):
- raise Exception('run() method not implemented')
+ # 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)
+