aboutsummaryrefslogtreecommitdiff
path: root/rumba/model.py
diff options
context:
space:
mode:
authorvmaffione <v.maffione@gmail.com>2017-04-08 10:58:48 +0000
committervmaffione <v.maffione@gmail.com>2017-04-08 10:58:48 +0000
commitae113f8d19eb29a0edb50bf790275414125f78ca (patch)
tree26fc3690f4b3bc7c7a5635ee31f0297bb66ead19 /rumba/model.py
parent2666310aa2a25e5d66b669bde337711e7d22c904 (diff)
parent8d4ba82ac3a598992ee3d8fbe7ea14375b7c0801 (diff)
downloadrumba-ae113f8d19eb29a0edb50bf790275414125f78ca.tar.gz
rumba-ae113f8d19eb29a0edb50bf790275414125f78ca.zip
Merge branch 'vincenzo' into 'master'
rumba: simplify cooperation between prototype and testbed plugins See merge request !20
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)
+