From 30a2cce59525f30a3cfbfac04d1580cbee11d874 Mon Sep 17 00:00:00 2001 From: Lixia Chen Date: Fri, 11 Sep 2020 13:58:58 -0400 Subject: [PATCH] Disable cache --- .../dataset/engine/cache/cache_admin.cc | 4 +++- mindspore/dataset/engine/cache_client.py | 6 +++-- mindspore/dataset/engine/validators.py | 22 ++++++++++++++++--- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/mindspore/ccsrc/minddata/dataset/engine/cache/cache_admin.cc b/mindspore/ccsrc/minddata/dataset/engine/cache/cache_admin.cc index 6de1e61bbe..18f5acd511 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/cache/cache_admin.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/cache/cache_admin.cc @@ -37,10 +37,12 @@ int main(int argc, char **argv) { warningMsg += "WARNING:\n"; warningMsg += "cache_admin and the cache server that it controls are currently only used for experimental research"; warningMsg += " purposes at this time.\n"; - warningMsg += "It is not intended for general availability yet as it may not be stable. Use it at your own risk.\n"; + warningMsg += "This command is currently disabled. Quitting.\n"; // A warning message until the code is mature enough. std::cerr << warningMsg << std::endl; + // temporary disable cache feature in the current release + return 0; if (argc == 1) { args.Help(); diff --git a/mindspore/dataset/engine/cache_client.py b/mindspore/dataset/engine/cache_client.py index 6139f9e083..d0e3ce1504 100644 --- a/mindspore/dataset/engine/cache_client.py +++ b/mindspore/dataset/engine/cache_client.py @@ -16,7 +16,7 @@ """ import copy -from mindspore._c_dataengine import CacheClient +# from mindspore._c_dataengine import CacheClient from ..core.validator_helpers import type_check, check_uint32, check_uint64 @@ -38,7 +38,9 @@ class DatasetCache: self.hostname = hostname self.port = port self.prefetch_size = prefetch_size - self.cache_client = CacheClient(session_id, size, spilling, hostname, port, prefetch_size) + # temporary disable cache feature in the current release + # self.cache_client = CacheClient(session_id, size, spilling, hostname, port, prefetch_size) + self.cache_client = None def GetStat(self): return self.cache_client.GetStat() diff --git a/mindspore/dataset/engine/validators.py b/mindspore/dataset/engine/validators.py index cbae377f47..c1978a6ee6 100644 --- a/mindspore/dataset/engine/validators.py +++ b/mindspore/dataset/engine/validators.py @@ -31,7 +31,7 @@ from ..core.validator_helpers import parse_user_args, type_check, type_check_lis from . import datasets from . import samplers -from . import cache_client +# from . import cache_client from .. import callback @@ -56,6 +56,9 @@ def check_imagefolderdataset(method): validate_dataset_param_value(nreq_param_dict, param_dict, dict) check_sampler_shuffle_shard_options(param_dict) + cache = param_dict.get('cache') + check_cache_option(cache) + return method(self, *args, **kwargs) return new_method @@ -136,6 +139,9 @@ def check_tfrecorddataset(method): check_sampler_shuffle_shard_options(param_dict) + cache = param_dict.get('cache') + check_cache_option(cache) + return method(self, *args, **kwargs) return new_method @@ -389,6 +395,9 @@ def check_random_dataset(method): check_sampler_shuffle_shard_options(param_dict) + cache = param_dict.get('cache') + check_cache_option(cache) + return method(self, *args, **kwargs) return new_method @@ -572,8 +581,7 @@ def check_map(method): if num_parallel_workers is not None: check_num_parallel_workers(num_parallel_workers) type_check(python_multiprocessing, (bool,), "python_multiprocessing") - if cache is not None: - type_check(cache, (cache_client.DatasetCache,), "cache") + check_cache_option(cache) if callbacks is not None: if isinstance(callbacks, (list, tuple)): @@ -1215,3 +1223,11 @@ def check_paddeddataset(method): return method(self, *args, **kwargs) return new_method + + +def check_cache_option(cache): + """Sanity check for cache parameter""" + if cache is not None: + # temporary disable cache feature in the current release + # type_check(cache, (cache_client.DatasetCache,), "cache") + raise ValueError("Caching is disabled in the current release")