run locusts at full speed with master and several slaves, make the most use of all cpus

This commit is contained in:
httprunner
2017-08-26 23:29:18 +08:00
parent f43fcfe6c2
commit 6bf3daae11
3 changed files with 40 additions and 4 deletions

View File

@@ -4,11 +4,12 @@ import logging
import os
import sys
from collections import OrderedDict
import PyUnitReport
from ate import __version__
from ate.task import create_task
import PyUnitReport
def main_ate():
""" API test: parse command line options and run commands.
@@ -88,7 +89,7 @@ def main_locust():
""" Performance test with locust: parse command line options and run commands.
"""
try:
from locust.main import main
from ate.locusts import main, run_locusts_at_full_speed
except ImportError:
print("Locust is not installed, exit.")
exit(1)
@@ -110,7 +111,11 @@ def main_locust():
testcase_file_path = sys.argv[testcase_index]
sys.argv[testcase_index] = parse_locustfile(testcase_file_path)
main()
if "--full-speed" in sys.argv:
run_locusts_at_full_speed(sys.argv)
else:
main()
def parse_locustfile(file_path):
""" parse testcase file and return locustfile path.