Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding clear cache test step #339

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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