0

我正在尝试为分布式 locust 运行创建配置,我有一个包含已定义任务的 .py 脚本,并且我有简单的 taurus 配置只是为了使其工作:

execution:
  executor: locust
  master: true
  slaves: 1
  scenario: tns
  concurrency: 10
  ramp-up: 10s
  iterations: 100
  hold-for: 10s

scenarios:
  tns:
    script: /usr/src/app/scenarios/locust_scenarios/sample.py

reporting:
- module: final-stats
  dump-csv: test_result.csv
- module: console
- module: passfail
  criteria:
   - avg-rt>250ms for 30s, continue as failed
   - failures>5% for 5s, continue as failed
   - failures>50% for 10s, stop as failed

然后我启动蝗虫从节点:

python -m locust.main -f scenarios/locust_scenarios/sample.py --slave --master-host=localhost

并执行测试,这是日志

$ bzt -o modules.console.screen=gui locust_tests_execution_config.yaml
12:38:54 INFO: Taurus CLI Tool v1.12.0
12:38:54 INFO: Starting with configs: ['locust_tests_execution_config.yaml']
12:38:54 INFO: Configuring...
12:38:54 INFO: Artifacts dir: /Users/usr/Projects/load/2018-06-20_12-38-54.391229
12:38:54 WARNING: at path 'execution': 'execution' should be a list
12:38:54 INFO: Preparing...
12:38:54 WARNING: Module 'console' can be only used once, will merge all new instances into single
12:38:54 INFO: Starting...
12:38:54 INFO: Waiting for results...
12:38:55 WARNING: Please wait for graceful shutdown...
12:38:55 INFO: Shutting down...
12:38:56 INFO: Terminating process PID 54419 with signal Signals.SIGTERM (59 tries left)
12:38:57 INFO: Terminating process PID 54419 with signal Signals.SIGTERM (58 tries left)
12:38:57 ERROR: TypeError: must be str, not NoneType
  File "/Users/usr/.virtualenvs/stfw/lib/python3.6/site-packages/bzt/cli.py", line 250, in perform
    self.engine.run()
  File "/Users/usr/.virtualenvs/stfw/lib/python3.6/site-packages/bzt/engine.py", line 222, in run
    reraise(exc_info)
  File "/Users/usr/.virtualenvs/stfw/lib/python3.6/site-packages/bzt/six/py3.py", line 84, in reraise
    raise exc
  File "/Users/usr/.virtualenvs/stfw/lib/python3.6/site-packages/bzt/engine.py", line 204, in run
    self._wait()
  File "/Users/usr/.virtualenvs/stfw/lib/python3.6/site-packages/bzt/engine.py", line 243, in _wait
    while not self._check_modules_list():
  File "/Users/usr/.virtualenvs/stfw/lib/python3.6/site-packages/bzt/engine.py", line 230, in _check_modules_list
    finished = bool(module.check())
  File "/Users/usr/.virtualenvs/stfw/lib/python3.6/site-packages/bzt/modules/aggregator.py", line 635, in check
    for point in self.datapoints():
  File "/Users/usr/.virtualenvs/stfw/lib/python3.6/site-packages/bzt/modules/aggregator.py", line 401, in datapoints
    for datapoint in self._calculate_datapoints(final_pass):
  File "/Users/usr/.virtualenvs/stfw/lib/python3.6/site-packages/bzt/modules/aggregator.py", line 664, in _calculate_datapoints
    self._process_underlings(final_pass)
  File "/Users/usr/.virtualenvs/stfw/lib/python3.6/site-packages/bzt/modules/aggregator.py", line 649, in _process_underlings
    for data in underling.datapoints(final_pass):
  File "/Users/usr/.virtualenvs/stfw/lib/python3.6/site-packages/bzt/modules/aggregator.py", line 401, in datapoints
    for datapoint in self._calculate_datapoints(final_pass):
  File "/Users/usr/.virtualenvs/stfw/lib/python3.6/site-packages/bzt/modules/locustio.py", line 221, in _calculate_datapoints
    self.read_buffer += self.file.get_bytes(size=1024 * 1024, last_pass=final_pass)
12:38:57 INFO: Post-processing...
12:38:57 INFO: Test duration: 0:00:03
12:38:57 INFO: Test duration: 0:00:03
12:38:57 INFO: Artifacts dir: /Users/usr/Projects/load/2018-06-20_12-38-54.391229
12:38:57 WARNING: Done performing with code: 1

蝗虫日志显示蝗虫奴隶已连接并准备集群。

我应该怎么做才能让它运行?谢谢

4

1 回答 1

0

bzt 库中似乎存在缺陷,基于此线程: https ://groups.google.com/forum/#!searchin/codename-taurus/locust%7Csort:date/codename-taurus/woBeH1JeBFo/pHhoGUSoAwAJ

新版本中会有一个修复: https ://github.com/Blazemeter/taurus/pull/871

于 2018-06-21T04:26:00.700 回答