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

No users count send in hatch_complete #678

Closed
zeburek opened this issue Nov 9, 2017 · 1 comment
Closed

No users count send in hatch_complete #678

zeburek opened this issue Nov 9, 2017 · 1 comment

Comments

@zeburek
Copy link

zeburek commented Nov 9, 2017

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

[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

Environment settings (for bug reports)

  • OS: Ubuntu 16.04
  • Python version: 2.7.12
  • Locust version: 0.8.1

Steps to reproduce (for bug reports)

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

@akantak
Copy link

akantak commented Dec 6, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants