From: @tina_mengting_zhang Reviewed-by: @mikef,@robingrosman Signed-off-by: @nsycatags/v1.1.0
| @@ -217,7 +217,7 @@ Status CacheClient::CreateCache(uint32_t tree_crc, bool generate_id) { | |||||
| // That is allowed, however the crc better match! | // That is allowed, however the crc better match! | ||||
| if (server_connection_id_) { | if (server_connection_id_) { | ||||
| if (cinfo_.crc() != tree_crc) { | if (cinfo_.crc() != tree_crc) { | ||||
| RETURN_STATUS_UNEXPECTED("Attempt to re-use a cache for a different tree!"); | |||||
| RETURN_STATUS_UNEXPECTED("Cannot re-use a cache for a different tree!"); | |||||
| } | } | ||||
| // Check the state of the server. For non-mappable case where there is a build phase and a fetch phase, we should | // Check the state of the server. For non-mappable case where there is a build phase and a fetch phase, we should | ||||
| // skip the build phase. | // skip the build phase. | ||||
| @@ -20,7 +20,7 @@ namespace dataset { | |||||
| CacheClientGreeter::~CacheClientGreeter() { (void)ServiceStop(); } | CacheClientGreeter::~CacheClientGreeter() { (void)ServiceStop(); } | ||||
| CacheClientGreeter::CacheClientGreeter(const std::string &hostname, int32_t port, int32_t num_connections) | CacheClientGreeter::CacheClientGreeter(const std::string &hostname, int32_t port, int32_t num_connections) | ||||
| : num_connections_(num_connections), request_cnt_(0) { | |||||
| : num_connections_(num_connections), request_cnt_(0), port_(port) { | |||||
| grpc::ChannelArguments args; | grpc::ChannelArguments args; | ||||
| // We need to bump up the message size to unlimited. The default receiving | // We need to bump up the message size to unlimited. The default receiving | ||||
| // message limit is 4MB which is not big enough. | // message limit is 4MB which is not big enough. | ||||
| @@ -119,8 +119,8 @@ Status CacheClientGreeter::WorkerEntry() { | |||||
| auto error_code = rq->rc_.error_code(); | auto error_code = rq->rc_.error_code(); | ||||
| std::string err_msg; | std::string err_msg; | ||||
| if (error_code == grpc::StatusCode::UNAVAILABLE) { | if (error_code == grpc::StatusCode::UNAVAILABLE) { | ||||
| err_msg = | |||||
| "Cache server is unreachable. Make sure the server is running. GRPC Code" + std::to_string(error_code); | |||||
| err_msg = "Cache server with port " + std::to_string(port_) + | |||||
| " is unreachable. Make sure the server is running. GRPC Code" + std::to_string(error_code); | |||||
| } else { | } else { | ||||
| err_msg = rq->rc_.error_message() + ". GRPC Code " + std::to_string(error_code); | err_msg = rq->rc_.error_message() + ". GRPC Code " + std::to_string(error_code); | ||||
| } | } | ||||
| @@ -96,6 +96,7 @@ class CacheClientGreeter : public Service { | |||||
| mutable std::mutex mux_; | mutable std::mutex mux_; | ||||
| std::map<int64_t, std::unique_ptr<CacheClientRequestTag>> req_; | std::map<int64_t, std::unique_ptr<CacheClientRequestTag>> req_; | ||||
| SharedMemory mem_; | SharedMemory mem_; | ||||
| int32_t port_; | |||||
| }; | }; | ||||
| } // namespace dataset | } // namespace dataset | ||||
| } // namespace mindspore | } // namespace mindspore | ||||
| @@ -590,7 +590,7 @@ def test_cache_nomap_disallowed_share1(): | |||||
| with pytest.raises(RuntimeError) as e: | with pytest.raises(RuntimeError) as e: | ||||
| sum([1 for _ in ds2]) | sum([1 for _ in ds2]) | ||||
| assert "Attempt to re-use a cache for a different tree!" in str(e.value) | |||||
| assert "Cannot re-use a cache for a different tree!" in str(e.value) | |||||
| logger.info("test_cache_nomap_disallowed_share1 Ended.\n") | logger.info("test_cache_nomap_disallowed_share1 Ended.\n") | ||||
| @@ -1182,7 +1182,8 @@ def test_cache_nomap_server_stop(): | |||||
| num_iter = 0 | num_iter = 0 | ||||
| for _ in ds1.create_dict_iterator(): | for _ in ds1.create_dict_iterator(): | ||||
| num_iter += 1 | num_iter += 1 | ||||
| assert "Network error. Cache server is unreachable. Make sure the server is running." in str(e.value) | |||||
| assert "Network error. Cache server with port 50052 is unreachable. Make sure the server is running." in \ | |||||
| str(e.value) | |||||
| logger.info("test_cache_nomap_server_stop Ended.\n") | logger.info("test_cache_nomap_server_stop Ended.\n") | ||||