Browse Source

Disable cache

tags/v1.0.0
Lixia Chen 5 years ago
parent
commit
30a2cce595
3 changed files with 26 additions and 6 deletions
  1. +3
    -1
      mindspore/ccsrc/minddata/dataset/engine/cache/cache_admin.cc
  2. +4
    -2
      mindspore/dataset/engine/cache_client.py
  3. +19
    -3
      mindspore/dataset/engine/validators.py

+ 3
- 1
mindspore/ccsrc/minddata/dataset/engine/cache/cache_admin.cc View File

@@ -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();


+ 4
- 2
mindspore/dataset/engine/cache_client.py View File

@@ -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()


+ 19
- 3
mindspore/dataset/engine/validators.py View File

@@ -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")

Loading…
Cancel
Save