Move osprofiler help message to the end of output

Follow the convention of how osprofiler result is displayed in console.
Refer to implementation from nova
See https://github.com/openstack/python-novaclient/blob/master/novaclient/shell.py#L873

Change-Id: I946d634413e13e1861631a171ae2a939dbb9faa5
Implements: blueprint osprofiler-support
This commit is contained in:
Yujun Zhang
2017-07-25 17:37:01 +08:00
parent 4c7b6071b7
commit f5f89f2ae0

View File

@@ -164,9 +164,7 @@ class VitrageShell(app.App):
# signature and will skip initialization of osprofiler on the
# server side.
profiler.init(self.options.profile)
trace_id = profiler.get().get_base_id()
print("To display trace use the command:\n\n"
" osprofiler trace show --html %s " % trace_id)
auth_plugin = loading.load_auth_from_argparse_arguments(
self.options)
session = loading.load_session_from_argparse_arguments(
@@ -242,7 +240,12 @@ def main(args=None):
try:
if args is None:
args = sys.argv[1:]
return VitrageShell().run(args)
result = VitrageShell().run(args)
if profiler and '--profile' in args:
trace_id = profiler.get().get_base_id()
print("To display trace use the command:\n\n"
" osprofiler trace show --html %s " % trace_id)
return result
except KeyboardInterrupt:
print('... terminating vitrage client', file=sys.stderr)
sys.exit(1)