diff --git a/benchmarks/perf-tool/okpt/test/steps/factory.py b/benchmarks/perf-tool/okpt/test/steps/factory.py index cb0789dec..2b7bcc68d 100644 --- a/benchmarks/perf-tool/okpt/test/steps/factory.py +++ b/benchmarks/perf-tool/okpt/test/steps/factory.py @@ -9,7 +9,7 @@ from okpt.test.steps.base import Step, StepConfig from okpt.test.steps.steps import CreateIndexStep, DisableRefreshStep, RefreshIndexStep, DeleteIndexStep, \ - TrainModelStep, DeleteModelStep, ForceMergeStep, IngestStep, QueryStep + TrainModelStep, DeleteModelStep, ForceMergeStep, ClearCacheStep, IngestStep, QueryStep def create_step(step_config: StepConfig) -> Step: @@ -31,5 +31,7 @@ def create_step(step_config: StepConfig) -> Step: return QueryStep(step_config) elif step_config.step_name == ForceMergeStep.label: return ForceMergeStep(step_config) + elif step_config.step_name == ClearCacheStep.label: + return ClearCacheStep(step_config) raise ConfigurationError(f'Invalid step {step_config.step_name}') diff --git a/benchmarks/perf-tool/okpt/test/steps/steps.py b/benchmarks/perf-tool/okpt/test/steps/steps.py index 7230bc1f4..b61781a6e 100644 --- a/benchmarks/perf-tool/okpt/test/steps/steps.py +++ b/benchmarks/perf-tool/okpt/test/steps/steps.py @@ -138,6 +138,28 @@ def _action(self): def _get_measures(self) -> List[str]: return ['took'] +class ClearCacheStep(OpenSearchStep): + """See base class.""" + + label = 'clear_cache' + + def __init__(self, step_config: StepConfig): + super().__init__(step_config) + self.index_name = parse_string_param('index_name', step_config.config, + {}, None) + + def _action(self): + while True: + try: + self.opensearch.indices.clear_cache( + index=self.index_name) + return {} + except: + pass + + def _get_measures(self) -> List[str]: + return ['took'] + class TrainModelStep(OpenSearchStep): """See base class."""