| @@ -1293,7 +1293,8 @@ CacheServer::Builder::Builder() | |||||
| num_workers_(std::thread::hardware_concurrency() / 2), | num_workers_(std::thread::hardware_concurrency() / 2), | ||||
| port_(50052), | port_(50052), | ||||
| shared_memory_sz_in_gb_(kDefaultSharedMemorySize), | shared_memory_sz_in_gb_(kDefaultSharedMemorySize), | ||||
| memory_cap_ratio_(kDefaultMemoryCapRatio) { | |||||
| memory_cap_ratio_(kDefaultMemoryCapRatio), | |||||
| log_level_(1) { | |||||
| if (num_workers_ == 0) { | if (num_workers_ == 0) { | ||||
| num_workers_ = 1; | num_workers_ = 1; | ||||
| } | } | ||||
| @@ -80,6 +80,5 @@ Status CacheLookupNode::SamplerBuild(std::shared_ptr<SamplerRT> *const out) { | |||||
| *out = std::shared_ptr<SamplerRT>(lookup_op); | *out = std::shared_ptr<SamplerRT>(lookup_op); | ||||
| return Status::OK(); | return Status::OK(); | ||||
| } | } | ||||
| } // namespace dataset | } // namespace dataset | ||||
| } // namespace mindspore | } // namespace mindspore | ||||
| @@ -25,7 +25,6 @@ | |||||
| namespace mindspore { | namespace mindspore { | ||||
| namespace dataset { | namespace dataset { | ||||
| class CacheLookupNode : public DatasetNode, public SamplerObj { | class CacheLookupNode : public DatasetNode, public SamplerObj { | ||||
| public: | public: | ||||
| /// \brief Constructor | /// \brief Constructor | ||||
| @@ -65,6 +65,5 @@ Status CacheMergeNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||||
| // Downcast shared pointer then call visitor | // Downcast shared pointer then call visitor | ||||
| return p->VisitAfter(shared_from_base<CacheMergeNode>(), modified); | return p->VisitAfter(shared_from_base<CacheMergeNode>(), modified); | ||||
| } | } | ||||
| } // namespace dataset | } // namespace dataset | ||||
| } // namespace mindspore | } // namespace mindspore | ||||
| @@ -24,7 +24,6 @@ | |||||
| namespace mindspore { | namespace mindspore { | ||||
| namespace dataset { | namespace dataset { | ||||
| class CacheMergeNode : public DatasetNode { | class CacheMergeNode : public DatasetNode { | ||||
| public: | public: | ||||
| /// \brief Constructor | /// \brief Constructor | ||||
| @@ -72,6 +72,5 @@ Status CacheNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||||
| // Downcast shared pointer then call visitor | // Downcast shared pointer then call visitor | ||||
| return p->VisitAfter(shared_from_base<CacheNode>(), modified); | return p->VisitAfter(shared_from_base<CacheNode>(), modified); | ||||
| } | } | ||||
| } // namespace dataset | } // namespace dataset | ||||
| } // namespace mindspore | } // namespace mindspore | ||||
| @@ -24,7 +24,6 @@ | |||||
| namespace mindspore { | namespace mindspore { | ||||
| namespace dataset { | namespace dataset { | ||||
| class CacheNode : public DatasetNode { | class CacheNode : public DatasetNode { | ||||
| public: | public: | ||||
| /// \brief Constructor | /// \brief Constructor | ||||
| @@ -213,7 +213,7 @@ Status MindDataNode::Accept(IRNodePass *const p, bool *const modified) { | |||||
| } | } | ||||
| // Visitor accepting method for IRNodePass | // Visitor accepting method for IRNodePass | ||||
| Status MindDataNode::AcceptAfter(IRNodePass *p, bool *const modified) { | |||||
| Status MindDataNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||||
| // Downcast shared pointer then call visitor | // Downcast shared pointer then call visitor | ||||
| return p->VisitAfter(shared_from_base<MindDataNode>(), modified); | return p->VisitAfter(shared_from_base<MindDataNode>(), modified); | ||||
| } | } | ||||
| @@ -96,13 +96,13 @@ class MindDataNode : public MappableSourceNode { | |||||
| /// \param[in] p The node to visit | /// \param[in] p The node to visit | ||||
| /// \param[out] modified Indicator if the node was modified | /// \param[out] modified Indicator if the node was modified | ||||
| /// \return Status of the node visit | /// \return Status of the node visit | ||||
| Status Accept(IRNodePass *p, bool *const modified) override; | |||||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||||
| /// \brief Base-class override for accepting IRNodePass visitor | /// \brief Base-class override for accepting IRNodePass visitor | ||||
| /// \param[in] p The node to visit | /// \param[in] p The node to visit | ||||
| /// \param[out] modified Indicator if the node was modified | /// \param[out] modified Indicator if the node was modified | ||||
| /// \return Status of the node visit | /// \return Status of the node visit | ||||
| Status AcceptAfter(IRNodePass *p, bool *const modified) override; | |||||
| Status AcceptAfter(IRNodePass *const p, bool *const modified) override; | |||||
| private: | private: | ||||
| std::string dataset_file_; // search_for_pattern_ will be true in this mode | std::string dataset_file_; // search_for_pattern_ will be true in this mode | ||||
| @@ -148,13 +148,13 @@ Status RandomNode::SetupSamplerForCache(std::shared_ptr<SamplerObj> *sampler) { | |||||
| } | } | ||||
| // Visitor accepting method for IRNodePass | // Visitor accepting method for IRNodePass | ||||
| Status RandomNode::Accept(IRNodePass *p, bool *const modified) { | |||||
| Status RandomNode::Accept(IRNodePass *const p, bool *const modified) { | |||||
| // Downcast shared pointer then call visitor | // Downcast shared pointer then call visitor | ||||
| return p->Visit(shared_from_base<RandomNode>(), modified); | return p->Visit(shared_from_base<RandomNode>(), modified); | ||||
| } | } | ||||
| // Visitor accepting method for IRNodePass | // Visitor accepting method for IRNodePass | ||||
| Status RandomNode::AcceptAfter(IRNodePass *p, bool *const modified) { | |||||
| Status RandomNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||||
| // Downcast shared pointer then call visitor | // Downcast shared pointer then call visitor | ||||
| return p->VisitAfter(shared_from_base<RandomNode>(), modified); | return p->VisitAfter(shared_from_base<RandomNode>(), modified); | ||||
| } | } | ||||
| @@ -115,13 +115,13 @@ class RandomNode : public NonMappableSourceNode { | |||||
| /// \param[in] p The node to visit | /// \param[in] p The node to visit | ||||
| /// \param[out] modified Indicator if the node was modified | /// \param[out] modified Indicator if the node was modified | ||||
| /// \return Status of the node visit | /// \return Status of the node visit | ||||
| Status Accept(IRNodePass *p, bool *const modified) override; | |||||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||||
| /// \brief Base-class override for accepting IRNodePass visitor | /// \brief Base-class override for accepting IRNodePass visitor | ||||
| /// \param[in] p The node to visit | /// \param[in] p The node to visit | ||||
| /// \param[out] modified Indicator if the node was modified | /// \param[out] modified Indicator if the node was modified | ||||
| /// \return Status of the node visit | /// \return Status of the node visit | ||||
| Status AcceptAfter(IRNodePass *p, bool *const modified) override; | |||||
| Status AcceptAfter(IRNodePass *const p, bool *const modified) override; | |||||
| private: | private: | ||||
| /// \brief A quick inline for producing a random number between (and including) min/max | /// \brief A quick inline for producing a random number between (and including) min/max | ||||
| @@ -462,7 +462,7 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheRandomDataCApi) { | |||||
| schema->add_column("image", mindspore::DataType::kNumberTypeUInt8, {2}); | schema->add_column("image", mindspore::DataType::kNumberTypeUInt8, {2}); | ||||
| schema->add_column("label", mindspore::DataType::kNumberTypeUInt8, {1}); | schema->add_column("label", mindspore::DataType::kNumberTypeUInt8, {1}); | ||||
| std::shared_ptr<Dataset> ds = RandomData(4, schema, {}, some_cache); | |||||
| std::shared_ptr<Dataset> ds = RandomData(8, schema, {}, some_cache); | |||||
| EXPECT_NE(ds, nullptr); | EXPECT_NE(ds, nullptr); | ||||
| // Create a Repeat operation on ds | // Create a Repeat operation on ds | ||||
| @@ -485,7 +485,7 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheRandomDataCApi) { | |||||
| iter->GetNextRow(&row); | iter->GetNextRow(&row); | ||||
| } | } | ||||
| EXPECT_EQ(i, 8); | |||||
| EXPECT_EQ(i, 16); | |||||
| // Manually terminate the pipeline | // Manually terminate the pipeline | ||||
| iter->Stop(); | iter->Stop(); | ||||
| @@ -55,7 +55,9 @@ cmd="${CACHE_ADMIN} --start --spilldir /path_that_does_not_exist" | |||||
| CacheAdminCmd "${cmd}" 1 | CacheAdminCmd "${cmd}" 1 | ||||
| HandleRcExit $? 0 0 | HandleRcExit $? 0 0 | ||||
| # start cache server twice | |||||
| # stop cache server first to test start | |||||
| StopServer | |||||
| # start cache server | |||||
| StartServer | StartServer | ||||
| HandleRcExit $? 1 1 | HandleRcExit $? 1 1 | ||||
| # start the cache server again, however, this time we expect an error | # start the cache server again, however, this time we expect an error | ||||
| @@ -200,7 +202,7 @@ if [ "$EUID" -ne 0 ]; then | |||||
| fi | fi | ||||
| # illegal log level | # illegal log level | ||||
| cmd="${CACHE_ADMIN} --start -l 4" | |||||
| cmd="${CACHE_ADMIN} --start -l 5" | |||||
| CacheAdminCmd "${cmd}" 1 | CacheAdminCmd "${cmd}" 1 | ||||
| HandleRcExit $? 0 0 | HandleRcExit $? 0 0 | ||||
| cmd="${CACHE_ADMIN} --start -l -1" | cmd="${CACHE_ADMIN} --start -l -1" | ||||
| @@ -804,11 +804,11 @@ def test_cache_map_parameter_check(): | |||||
| with pytest.raises(ValueError) as err: | with pytest.raises(ValueError) as err: | ||||
| ds.DatasetCache(session_id=1, size=0, port=0) | ds.DatasetCache(session_id=1, size=0, port=0) | ||||
| assert "Input port is not within the required interval of (1025 to 65535)" in str(err.value) | |||||
| assert "Input port is not within the required interval of [1025, 65535]" in str(err.value) | |||||
| with pytest.raises(ValueError) as err: | with pytest.raises(ValueError) as err: | ||||
| ds.DatasetCache(session_id=1, size=0, port=65536) | ds.DatasetCache(session_id=1, size=0, port=65536) | ||||
| assert "Input port is not within the required interval of (1025 to 65535)" in str(err.value) | |||||
| assert "Input port is not within the required interval of [1025, 65535]" in str(err.value) | |||||
| with pytest.raises(TypeError) as err: | with pytest.raises(TypeError) as err: | ||||
| ds.ImageFolderDataset(dataset_dir=DATA_DIR, cache=True) | ds.ImageFolderDataset(dataset_dir=DATA_DIR, cache=True) | ||||