From 0801eba70daacddd5692543dea013e85a82ef76b Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Wed, 15 Nov 2017 15:50:55 +0100 Subject: utils: add swap_out after prompt in ExperimentManager --- rumba/utils.py | 12 ++++++++++-- 1 file 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', -- cgit v1.2.3