Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option '--only-summary' for only printing stats at the end. #80

Merged
merged 1 commit into from
Nov 29, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ def parse_options():
default=False,
help="Print stats in the console"
)

# only print summary stats
parser.add_option(
'--only-summary',
action='store_true',
dest='only_summary',
default=False,
help='Only print the summary stats'
)

# List locust commands found in loaded locust files/source files
parser.add_option(
Expand Down Expand Up @@ -371,7 +380,7 @@ def main():
runners.locust_runner = SlaveLocustRunner(locust_classes, options.hatch_rate, options.num_clients, num_requests=options.num_requests, host=options.host, master_host=options.master_host)
main_greenlet = runners.locust_runner.greenlet

if options.print_stats or (options.no_web and not options.slave):
if not options.only_summary and (options.print_stats or (options.no_web and not options.slave)):
# spawn stats printing greenlet
gevent.spawn(stats_printer)

Expand All @@ -380,9 +389,11 @@ def shutdown(code=0):
Shut down locust by firing quitting event, printing stats and exiting
"""
logger.info("Shutting down, bye..")

events.quitting.fire()
print_stats(runners.locust_runner.request_stats)
print_percentile_stats(runners.locust_runner.request_stats)

print_error_report()
sys.exit(code)

Expand Down