Merge pull request #1523 from katlapinka/kasiat/promotion-api
Add API for setting promotion policy params
This commit is contained in:
commit
d692204c20
@ -188,6 +188,16 @@ class Cache:
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def set_promotion_policy(self, policy: PromotionPolicy) -> Output:
|
||||||
|
return casadm.set_param_promotion(self.cache_id, policy)
|
||||||
|
|
||||||
|
def set_params_nhit(self, promotion_params_nhit: PromotionParametersNhit) -> Output:
|
||||||
|
return casadm.set_param_promotion_nhit(
|
||||||
|
self.cache_id,
|
||||||
|
threshold=promotion_params_nhit.threshold.get_value(),
|
||||||
|
trigger=promotion_params_nhit.trigger
|
||||||
|
)
|
||||||
|
|
||||||
def get_cache_config(self) -> CacheConfig:
|
def get_cache_config(self) -> CacheConfig:
|
||||||
return CacheConfig(
|
return CacheConfig(
|
||||||
self.get_cache_line_size(),
|
self.get_cache_line_size(),
|
||||||
|
@ -217,7 +217,7 @@ class FlushParametersAcp:
|
|||||||
|
|
||||||
class SeqCutOffParameters:
|
class SeqCutOffParameters:
|
||||||
def __init__(
|
def __init__(
|
||||||
self, policy: CleaningPolicy = None, threshold: Size = None, promotion_count: int = None
|
self, policy: SeqCutOffPolicy = None, threshold: Size = None, promotion_count: int = None
|
||||||
):
|
):
|
||||||
self.policy = policy
|
self.policy = policy
|
||||||
self.threshold = threshold
|
self.threshold = threshold
|
||||||
|
@ -13,6 +13,7 @@ from api.cas.cache_config import (
|
|||||||
SeqCutOffPolicy,
|
SeqCutOffPolicy,
|
||||||
CleaningPolicy,
|
CleaningPolicy,
|
||||||
KernelParameters,
|
KernelParameters,
|
||||||
|
PromotionPolicy,
|
||||||
)
|
)
|
||||||
from api.cas.casadm_params import OutputFormat, StatsFilter
|
from api.cas.casadm_params import OutputFormat, StatsFilter
|
||||||
from api.cas.cli import *
|
from api.cas.cli import *
|
||||||
@ -177,6 +178,37 @@ def set_param_cleaning_acp(
|
|||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
def set_param_promotion(cache_id: int, policy: PromotionPolicy, shortcut: bool = False) -> Output:
|
||||||
|
output = TestRun.executor.run(
|
||||||
|
set_param_promotion_cmd(
|
||||||
|
cache_id=str(cache_id),
|
||||||
|
policy=policy.name,
|
||||||
|
shortcut=shortcut,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if output.exit_code != 0:
|
||||||
|
raise CmdException("Error while setting promotion policy.", output)
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
def set_param_promotion_nhit(
|
||||||
|
cache_id: int, threshold: int = None, trigger: int = None, shortcut: bool = False
|
||||||
|
) -> Output:
|
||||||
|
_threshold = str(threshold) if threshold is not None else None
|
||||||
|
_trigger = str(trigger) if trigger is not None else None
|
||||||
|
output = TestRun.executor.run(
|
||||||
|
set_param_promotion_nhit_cmd(
|
||||||
|
cache_id=str(cache_id),
|
||||||
|
threshold=_threshold,
|
||||||
|
trigger=_trigger,
|
||||||
|
shortcut=shortcut,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if output.exit_code != 0:
|
||||||
|
raise CmdException("Error while setting promotion policy.", output)
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
def get_param_cutoff(
|
def get_param_cutoff(
|
||||||
cache_id: int, core_id: int, output_format: OutputFormat = None, shortcut: bool = False
|
cache_id: int, core_id: int, output_format: OutputFormat = None, shortcut: bool = False
|
||||||
) -> Output:
|
) -> Output:
|
||||||
@ -234,6 +266,34 @@ def get_param_cleaning_acp(
|
|||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
def get_param_promotion(
|
||||||
|
cache_id: int, output_format: OutputFormat = None, shortcut: bool = False
|
||||||
|
) -> Output:
|
||||||
|
_output_format = output_format.name if output_format else None
|
||||||
|
output = TestRun.executor.run(
|
||||||
|
get_param_promotion_cmd(
|
||||||
|
cache_id=str(cache_id), output_format=_output_format, shortcut=shortcut
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if output.exit_code != 0:
|
||||||
|
raise CmdException("Getting promotion policy failed.", output)
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
def get_param_promotion_nhit(
|
||||||
|
cache_id: int, output_format: OutputFormat = None, shortcut: bool = False
|
||||||
|
) -> Output:
|
||||||
|
_output_format = output_format.name if output_format else None
|
||||||
|
output = TestRun.executor.run(
|
||||||
|
get_param_promotion_nhit_cmd(
|
||||||
|
cache_id=str(cache_id), output_format=_output_format, shortcut=shortcut
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if output.exit_code != 0:
|
||||||
|
raise CmdException("Getting promotion policy nhit params failed.", output)
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
def set_cache_mode(
|
def set_cache_mode(
|
||||||
cache_mode: CacheMode, cache_id: int, flush: bool = None, shortcut: bool = False
|
cache_mode: CacheMode, cache_id: int, flush: bool = None, shortcut: bool = False
|
||||||
) -> Output:
|
) -> Output:
|
||||||
|
Loading…
Reference in New Issue
Block a user