Skip to content

Commit

Permalink
Adding clear cache test step (#339)
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Gaievski <[email protected]>
  • Loading branch information
martin-gaievski authored Mar 30, 2022
1 parent b276aa3 commit 66f3685
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion benchmarks/perf-tool/okpt/test/steps/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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}')
22 changes: 22 additions & 0 deletions benchmarks/perf-tool/okpt/test/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit 66f3685

Please sign in to comment.