Closed zeburek closed 6 years ago
No users count information sent in events.hatch_complete
events.hatch_complete
Adding new handler with 1 parameters will receive users_count information
[2017-11-09 14:16:35,676] inp1wst013/ERROR/stderr: File "/usr/local/lib/python2.7/dist-packages/gevent/greenlet.py", line 536, in run [2017-11-09 14:16:35,698] inp1wst013/ERROR/stderr: result = self._run(*self.args, **self.kwargs) [2017-11-09 14:16:35,698] inp1wst013/ERROR/stderr: File "/usr/local/lib/python2.7/dist-packages/locust/runners.py", line 205, in <lambda> [2017-11-09 14:16:35,707] inp1wst013/ERROR/stderr: self.hatching_greenlet = gevent.spawn(lambda: super(LocalLocustRunner, self).start_hatching(locust_count, hatch_rate, wait=wait)) [2017-11-09 14:16:35,707] inp1wst013/ERROR/stderr: File "/usr/local/lib/python2.7/dist-packages/locust/runners.py", line 175, in start_hatching [2017-11-09 14:16:35,707] inp1wst013/ERROR/stderr: self.spawn_locusts(locust_count, wait=wait) [2017-11-09 14:16:35,707] inp1wst013/ERROR/stderr: File "/usr/local/lib/python2.7/dist-packages/locust/runners.py", line 125, in spawn_locusts [2017-11-09 14:16:35,707] inp1wst013/ERROR/stderr: hatch() [2017-11-09 14:16:35,707] inp1wst013/ERROR/stderr: File "/usr/local/lib/python2.7/dist-packages/locust/runners.py", line 110, in hatch [2017-11-09 14:16:35,707] inp1wst013/ERROR/stderr: events.hatch_complete.fire(user_count=self.num_clients) [2017-11-09 14:16:35,707] inp1wst013/ERROR/stderr: File "/usr/local/lib/python2.7/dist-packages/locust/events.py", line 27, in fire [2017-11-09 14:16:35,707] inp1wst013/ERROR/stderr: handler(**kwargs) [2017-11-09 14:16:35,707] inp1wst013/ERROR/stderr: TypeError: set_users() takes exactly 1 argument (0 given) [2017-11-09 14:16:35,708] inp1wst013/ERROR/stderr: Thu Nov 9 14:16:35 2017
import time from locust import events users_count = [] def set_users(users, **kw): users_count.append({ "timestamp": time.time(), "users": users }) events.hatch_complete += set_users
Add this code to locustfile and try to run locust
in set_users function the argument should have name user_count instead of users, as it is called by locust always as key value parameter.
set_users
user_count
users
Description of issue / feature request
No users count information sent in
events.hatch_complete
Expected behavior
Adding new handler with 1 parameters will receive users_count information
Actual behavior
Environment settings (for bug reports)
Steps to reproduce (for bug reports)
Add this code to locustfile and try to run locust