scripts/rpc.py: pass named args to app.py
Also add docstrings to all app.py methods. Change-Id: Ib234014630e8b47c55f8d96bede509952fe653c5 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/411940 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
1b2cf0976a
commit
4a534344ee
@ -78,7 +78,8 @@ if __name__ == "__main__":
|
||||
# app
|
||||
@call_cmd
|
||||
def kill_instance(args):
|
||||
rpc.app.kill_instance(args.client, args)
|
||||
rpc.app.kill_instance(args.client,
|
||||
sig_name=args.sig_name)
|
||||
|
||||
p = subparsers.add_parser('kill_instance', help='Send signal to instance')
|
||||
p.add_argument('sig_name', help='signal will be sent to server.')
|
||||
@ -86,7 +87,13 @@ if __name__ == "__main__":
|
||||
|
||||
@call_cmd
|
||||
def context_switch_monitor(args):
|
||||
print_dict(rpc.app.context_switch_monitor(args.client, args))
|
||||
enabled = None
|
||||
if args.enable:
|
||||
enabled = True
|
||||
if args.disable:
|
||||
enabled = False
|
||||
print_dict(rpc.app.context_switch_monitor(args.client,
|
||||
enabled=enabled))
|
||||
|
||||
p = subparsers.add_parser('context_switch_monitor', help='Control whether the context switch monitor is enabled')
|
||||
p.add_argument('-e', '--enable', action='store_true', help='Enable context switch monitoring')
|
||||
|
@ -1,12 +1,23 @@
|
||||
def kill_instance(client, args):
|
||||
params = {'sig_name': args.sig_name}
|
||||
def kill_instance(client, sig_name):
|
||||
"""Send a signal to the SPDK process.
|
||||
|
||||
Args:
|
||||
sig_name: signal to send ("SIGINT", "SIGTERM", "SIGQUIT", "SIGHUP", or "SIGKILL")
|
||||
"""
|
||||
params = {'sig_name': sig_name}
|
||||
return client.call('kill_instance', params)
|
||||
|
||||
|
||||
def context_switch_monitor(client, args):
|
||||
def context_switch_monitor(client, enabled=None):
|
||||
"""Query or set state of context switch monitoring.
|
||||
|
||||
Args:
|
||||
enabled: True to enable monitoring; False to disable monitoring; None to query (optional)
|
||||
|
||||
Returns:
|
||||
Current context switch monitoring state (after applying enabled flag).
|
||||
"""
|
||||
params = {}
|
||||
if args.enable:
|
||||
params['enabled'] = True
|
||||
if args.disable:
|
||||
params['enabled'] = False
|
||||
if enabled is not None:
|
||||
params['enabled'] = enabled
|
||||
return client.call('context_switch_monitor', params)
|
||||
|
Loading…
Reference in New Issue
Block a user