aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMithun Veluri <velurimithun38@gmail.com>2024-04-11 06:29:26 +0000
committerSeongJae Park <71698583+sj-aws@users.noreply.github.com>2024-04-11 09:35:59 -0700
commit0e657bbb415d962e1954d62c1f5a9f73ece0c715 (patch)
tree855470ca390b99290df21190bfe4cc31bdc3dc55
parent2e81623cdb1b4f7a99dce10c96337420374894e1 (diff)
downloaddamo-0e657bbb415d962e1954d62c1f5a9f73ece0c715.tar.gz
damo_tune: Ensure reset interval is specified for quota-goals
While tuning, if user provides 'damos_quota_goal' and not 'reset_interval_ms', throw an error. Signed-off-by: Mithun Veluri <velurimithun38@gmail.com>
-rw-r--r--damo_tune.py33
1 files changed, 24 insertions, 9 deletions
diff --git a/damo_tune.py b/damo_tune.py
index 5e069551..44c89961 100644
--- a/damo_tune.py
+++ b/damo_tune.py
@@ -7,15 +7,30 @@ Update DAMON input parameters.
import _damon
import _damon_args
-def evaluate_args_for_quota_goals(args):
- if args.damos_action:
- return True, None
+def evaluate_args_for_tune(args):
+ '''
+ Verify if 'damons_action' is present when any 'damos_*' is specified
+ '''
+ if not args.damos_action:
+ for key, value in args.__dict__.items():
+ if key.startswith('damos_') and len(value):
+ if key == 'damos_action': continue
+ return False, '\'damos_action\' not specified while using --damos_* option(s)'
+
+ '''
+ Verify if 'reset_interval_ms' is specified in args when setting quota goals
+ '''
+ if args.damos_quota_goal:
+ damos_quotas = args.damos_quotas
+
+ if not len(damos_quotas):
+ return False, '\'reset_interval_ms\' not specified when setting quota goals'
+
+ #reset_interval_ms is specified in --damos_quotas as 3rd arg
+ for quota in damos_quotas:
+ if len(quota) < 3:
+ return False, '\'reset_interval_ms\' not specified when setting quota goals'
- for key, value in args.__dict__.items():
- if key.startswith('damos_') and len(value):
- if key == 'damos_action': continue
- return False, 'no \'damos_action\' provided in arguments while using --damos_* option(s)'
-
return True, None
def main(args):
@@ -25,7 +40,7 @@ def main(args):
print('DAMON is not turned on')
exit(1)
- correct_args, err = evaluate_args_for_quota_goals(args)
+ correct_args, err = evaluate_args_for_tune(args)
if (correct_args is not True and err is not None):
print('Tune error: incorrect arguments: %s' % err)