aboutsummaryrefslogtreecommitdiff
path: root/rumba/utils.py
diff options
context:
space:
mode:
authorMarco Capitani <m.capitani@nextworks.it>2017-11-15 15:50:55 +0100
committerMarco Capitani <m.capitani@nextworks.it>2017-11-15 15:50:55 +0100
commit0801eba70daacddd5692543dea013e85a82ef76b (patch)
tree3ee971d14f79e37520052d5ae517bcb5e0628b93 /rumba/utils.py
parent28a89b20caea996429515aba69d9332d690e8033 (diff)
downloadrumba-0801eba70daacddd5692543dea013e85a82ef76b.tar.gz
rumba-0801eba70daacddd5692543dea013e85a82ef76b.zip
utils: add swap_out after prompt in ExperimentManager
Diffstat (limited to 'rumba/utils.py')
-rw-r--r--rumba/utils.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/rumba/utils.py b/rumba/utils.py
index 5348b0a..2fc623c 100644
--- a/rumba/utils.py
+++ b/rumba/utils.py
@@ -8,7 +8,11 @@ logger = log.get_logger(__name__)
class ExperimentManager(object):
- def __init__(self, experiment, do_swap_out=True):
+ PROMPT = 1
+ AUTO = 2
+ NO = 3
+
+ def __init__(self, experiment, do_swap_out=AUTO):
assert isinstance(experiment, model.Experiment), \
'An experiment instance is required.'
self.experiment = experiment
@@ -18,7 +22,11 @@ class ExperimentManager(object):
pass
def __exit__(self, exc_type, exc_val, exc_tb):
- if self.do_swap_out:
+ if self.do_swap_out == self.PROMPT:
+ logger.info('Press ENTER to start swap out.')
+ input('')
+ if self.do_swap_out == self.PROMPT \
+ or self.do_swap_out == self.AUTO:
self.experiment.swap_out()
if exc_val is not None:
logger.error('Something went wrong. Got %s: %s',