From 6a8703e54eb7b7b0d42a25dab17b8f95f6881138 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Fri, 10 Aug 2018 22:44:30 +0300 Subject: [PATCH] config: add core.interactive Fixes #989 Signed-off-by: Ruslan Kuprieiev --- dvc/config.py | 12 ++++++++++++ dvc/project.py | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/dvc/config.py b/dvc/config.py index 7791bcecc..18f5ddd61 100644 --- a/dvc/config.py +++ b/dvc/config.py @@ -36,6 +36,14 @@ def supported_cloud(cloud): return cloud in ['aws', 'gcp', 'local', ''] +def is_bool(val): + return val.lower() in ['true', 'false'] + + +def to_bool(val): + return val.lower() == 'true' + + class Config(object): CONFIG = 'config' CONFIG_LOCAL = 'config.local' @@ -44,6 +52,8 @@ class Config(object): SECTION_CORE_LOGLEVEL = 'loglevel' SECTION_CORE_LOGLEVEL_SCHEMA = And(Use(str.lower), supported_loglevel) SECTION_CORE_REMOTE = 'remote' + SECTION_CORE_INTERACTIVE_SCHEMA = And(str, is_bool, Use(to_bool)) + SECTION_CORE_INTERACTIVE = 'interactive' SECTION_CACHE = 'cache' SECTION_CACHE_DIR = 'dir' @@ -78,6 +88,8 @@ class Config(object): default='info'): And(str, Use(str.lower), SECTION_CORE_LOGLEVEL_SCHEMA), Optional(SECTION_CORE_REMOTE, default=''): And(str, Use(str.lower)), + Optional(SECTION_CORE_INTERACTIVE, + default=False): SECTION_CORE_INTERACTIVE_SCHEMA, # backward compatibility Optional(SECTION_CORE_CLOUD, default=''): SECTION_CORE_CLOUD_SCHEMA, diff --git a/dvc/project.py b/dvc/project.py index d7154d444..02d833df0 100644 --- a/dvc/project.py +++ b/dvc/project.py @@ -266,6 +266,11 @@ class Project(object): if node not in stages: raise NotDvcFileError(target) + if not interactive: + config = self.config + core = config._config[config.SECTION_CORE] + interactive = core.get(config.SECTION_CORE_INTERACTIVE, False) + if recursive: return self._reproduce_stages(G, stages,