Skip to content

Commit 88cffa2

Browse files
authored
Fix L0_response_cache test (#8124)
1 parent ff4460d commit 88cffa2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

qa/L0_response_cache/ensemble_cache_test.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ def _update_config(self, config_file, config_pattern, config_to_add):
7979
config_data += config_to_add
8080
f.write(config_data)
8181

82+
def _add_instance_group_cpu(self, config_file):
83+
# Utility function to add instance group of kind CPU to the config file
84+
with open(config_file, "r") as f:
85+
config_data = f.read()
86+
if "instance_group" not in config_data:
87+
with open(config_file, "w") as f:
88+
config_data += "instance_group {\n kind: KIND_CPU\n}\n"
89+
f.write(config_data)
90+
8291
def _remove_config(self, config_file, config_to_remove):
8392
# Utility function to remove extra added config from the config files
8493
with open(config_file, "r") as f:
@@ -252,6 +261,8 @@ def test_ensemble_composing_model_cache_enabled(self):
252261
self._update_config(
253262
self.composing_config_file, RESPONSE_CACHE_PATTERN, RESPONSE_CACHE_CONFIG
254263
)
264+
# Currently, response cache is supported only for tensors on CPU.
265+
self._add_instance_group_cpu(self.composing_config_file)
255266
self._run_inference_and_validate(self.composing_model)
256267
ensemble_model_stats = self._get_model_statistics(self.ensemble_model)
257268
composing_model_stats = self._get_model_statistics(self.composing_model)

0 commit comments

Comments
 (0)