From f3423208c4174ab429a0ee4567c13ac7937f43e6 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 | 1 + mindspore/dataset/core/configuration.py | 3 ++- tests/ut/data/dataset/declient.cfg | 4 ++-- tests/ut/python/dataset/test_config.py | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mindspore/ccsrc/dataset/core/config_manager.cc b/mindspore/ccsrc/dataset/core/config_manager.cc index a489b4a4ce8..9291a8f832d 100644 --- a/mindspore/ccsrc/dataset/core/config_manager.cc +++ b/mindspore/ccsrc/dataset/core/config_manager.cc @@ -41,6 +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", monitor_sampling_interval_)); return Status::OK(); } diff --git a/mindspore/dataset/core/configuration.py b/mindspore/dataset/core/configuration.py index d3175cd1819..5376c668c40 100644 --- a/mindspore/dataset/core/configuration.py +++ b/mindspore/dataset/core/configuration.py @@ -185,7 +185,8 @@ class ConfigurationManager: >>> # "numParallelWorkers": 4, >>> # "workerConnectorSize": 16, >>> # "opConnectorSize": 16, - >>> # "seed": 5489 + >>> # "seed": 5489, + >>> # "monitorSamplingInterval": 30 >>> # } """ self.config.load(file) diff --git a/tests/ut/data/dataset/declient.cfg b/tests/ut/data/dataset/declient.cfg index b657ead6d5f..36ca5ec3d96 100644 --- a/tests/ut/data/dataset/declient.cfg +++ b/tests/ut/data/dataset/declient.cfg @@ -4,6 +4,6 @@ "numParallelWorkers": 4, "workerConnectorSize": 16, "opConnectorSize": 16, - "seed": 5489 - + "seed": 5489, + "monitorSamplingInterval": 15 } diff --git a/tests/ut/python/dataset/test_config.py b/tests/ut/python/dataset/test_config.py index c4d665b3917..09da7635639 100644 --- a/tests/ut/python/dataset/test_config.py +++ b/tests/ut/python/dataset/test_config.py @@ -45,6 +45,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 # ds.config.set_rows_per_buffer(1) ds.config.set_num_parallel_workers(2)