diff options
author | Mithun Veluri <velurimithun38@gmail.com> | 2024-04-08 11:30:40 +0000 |
---|---|---|
committer | SeongJae Park <71698583+sj-aws@users.noreply.github.com> | 2024-04-09 09:02:08 -0700 |
commit | 2e81623cdb1b4f7a99dce10c96337420374894e1 (patch) | |
tree | 8a7d4df0261021e14c3a5e808386d279b7b3896e | |
parent | 209a732c69f864459459c194c717a3e190258c9b (diff) | |
download | damo-2e81623cdb1b4f7a99dce10c96337420374894e1.tar.gz |
damo_tune: Evaluate args before committing kdamonds
- Check if user has provided any 'damos_action'. Without 'damos_action'
tune will ignore damos_quotas and damos_quota_goal.
- Throws error messages if no 'damos_action' is specified in tune cmd.
Signed-off-by: Mithun Veluri <velurimithun38@gmail.com>
-rw-r--r-- | damo_tune.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/damo_tune.py b/damo_tune.py index 5dd29e86..5e069551 100644 --- a/damo_tune.py +++ b/damo_tune.py @@ -7,6 +7,17 @@ Update DAMON input parameters. import _damon import _damon_args +def evaluate_args_for_quota_goals(args): + if args.damos_action: + return True, None + + 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): _damon.ensure_root_and_initialized(args) @@ -14,6 +25,12 @@ def main(args): print('DAMON is not turned on') exit(1) + correct_args, err = evaluate_args_for_quota_goals(args) + + if (correct_args is not True and err is not None): + print('Tune error: incorrect arguments: %s' % err) + exit(1) + kdamonds, err = _damon_args.commit_kdamonds(args, args.quota_goals_only) if err: print('tuning failed (%s)' % err) |