def update_config(overlay_dict): """Apply a partial config dict to the singleton config dict Values for top-level keys will be overwritten with those in overlay_dict No recursion will take place for sub-dicts; the entire sub-dict will be overwritten """ config.update(overlay_dict) new_config = config_schema.check_value(config) config.clear() config.update(new_config)
def reload_config(): """[Re]load the configuration * [Re-]reads the identified config file and replaces the contents of the singleton config dict with it * Any config variables in os.environ will be overlaid onto the dict [again] * Normalization and setting of defaults will occur [again] """ new_config = read_config_file(config_filename) _env_config(new_config) new_config = config_schema.check_value(new_config) config.clear() config.update(new_config)
def new_config(new_config): """ Temporarily change configuration dictionary. """ orig_config = config.copy() try: config.clear() config.update(new_config) initialize_logging(config) yield finally: config.clear() config.update(orig_config) initialize_logging(config)
def new_config(new_config): """ Temporarily change configuration dictionary. """ from .config import defaults config = dask.config.config orig_config = config.copy() try: config.clear() config.update(defaults.copy()) dask.config.update(config, new_config) initialize_logging(config) yield finally: config.clear() config.update(orig_config) initialize_logging(config)