From fd701b8504c173ae844dc4c5409e1acca9a4a4ca Mon Sep 17 00:00:00 2001 From: yanghaitao Date: Sun, 28 Jun 2020 10:36:56 +0800 Subject: [PATCH] set monitor sampling interval through json file --- mindspore/ccsrc/dataset/core/config_manager.cc | 2 +- mindspore/dataset/core/configuration.py | 2 +- tests/ut/data/dataset/declient.cfg | 3 +-- tests/ut/python/dataset/test_config.py | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mindspore/ccsrc/dataset/core/config_manager.cc b/mindspore/ccsrc/dataset/core/config_manager.cc index 9ca7ecc91..9291a8f83 100644 --- a/mindspore/ccsrc/dataset/core/config_manager.cc +++ b/mindspore/ccsrc/dataset/core/config_manager.cc @@ -41,7 +41,7 @@ Status ConfigManager::FromJson(const nlohmann::json &j) { set_worker_connector_size(j.value("workerConnectorSize", worker_connector_size_)); set_op_connector_size(j.value("opConnectorSize", op_connector_size_)); set_seed(j.value("seed", seed_)); - set_monitor_sampling_interval(j.value("monitorSamplingInterval")); + set_monitor_sampling_interval(j.value("monitorSamplingInterval", monitor_sampling_interval_)); return Status::OK(); } diff --git a/mindspore/dataset/core/configuration.py b/mindspore/dataset/core/configuration.py index 99d83dbdf..5376c668c 100644 --- a/mindspore/dataset/core/configuration.py +++ b/mindspore/dataset/core/configuration.py @@ -186,7 +186,7 @@ class ConfigurationManager: >>> # "workerConnectorSize": 16, >>> # "opConnectorSize": 16, >>> # "seed": 5489, - >>> # "monitorSamplingInterval": 30 + >>> # "monitorSamplingInterval": 30 >>> # } """ self.config.load(file) diff --git a/tests/ut/data/dataset/declient.cfg b/tests/ut/data/dataset/declient.cfg index e09b24812..36ca5ec3d 100644 --- a/tests/ut/data/dataset/declient.cfg +++ b/tests/ut/data/dataset/declient.cfg @@ -5,6 +5,5 @@ "workerConnectorSize": 16, "opConnectorSize": 16, "seed": 5489, - "monitor_sampling_interval": 15 - + "monitorSamplingInterval": 15 } diff --git a/tests/ut/python/dataset/test_config.py b/tests/ut/python/dataset/test_config.py index 59be886c2..f8322a593 100644 --- a/tests/ut/python/dataset/test_config.py +++ b/tests/ut/python/dataset/test_config.py @@ -46,7 +46,7 @@ def test_basic(): # assert ds.config.get_worker_connector_size() == 16 assert ds.config.get_prefetch_size() == 16 assert ds.config.get_seed() == 5489 - # assert ds.config.get_monitor_sampling_interval() == 15 + assert ds.config.get_monitor_sampling_interval() == 15 # ds.config.set_rows_per_buffer(1) ds.config.set_num_parallel_workers(2) -- GitLab