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

Bugs in show_task_ratio and show_task_ratio_json #540

Closed
debugtalk opened this issue Feb 17, 2017 · 1 comment
Closed

Bugs in show_task_ratio and show_task_ratio_json #540

debugtalk opened this issue Feb 17, 2017 · 1 comment

Comments

@debugtalk
Copy link

locustfile:

from locust import HttpLocust, TaskSet, task

class WebsiteTasks(TaskSet):
    def on_start(self):
        pass

    @task(1)
    def index(self):
        self.client.get("/")

    @task(2)
    def about(self):
        self.client.get("/about/")

class WebsiteUser(HttpLocust):
    host = 'http://debugtalk.com'
    task_set = WebsiteTasks
    min_wait = 1000
    max_wait = 3000

when executing --show-task-ratio or --show-task-ratio-json, exceptions occured.

✗ locust -f test.py --show-task-ratio     

 Task ratio per locust class
--------------------------------------------------------------------------------
[2017-02-17 11:24:53,538] Leos-MacBook-Air.local/ERROR/stderr: Traceback (most recent call last):
[2017-02-17 11:24:53,538] Leos-MacBook-Air.local/ERROR/stderr: File "/Users/Leo/.virtualenvs/locust/bin/locust", line 11, in <module>
[2017-02-17 11:24:53,539] Leos-MacBook-Air.local/ERROR/stderr: 
[2017-02-17 11:24:53,539] Leos-MacBook-Air.local/ERROR/stderr: load_entry_point('locustio', 'console_scripts', 'locust')()
[2017-02-17 11:24:53,539] Leos-MacBook-Air.local/ERROR/stderr: 
[2017-02-17 11:24:53,539] Leos-MacBook-Air.local/ERROR/stderr: File "/Users/Leo/GitHub/locust/locust/main.py", line 384, in main
[2017-02-17 11:24:53,539] Leos-MacBook-Air.local/ERROR/stderr: 
[2017-02-17 11:24:53,539] Leos-MacBook-Air.local/ERROR/stderr: print_task_ratio(locust_classes)
[2017-02-17 11:24:53,539] Leos-MacBook-Air.local/ERROR/stderr: 
[2017-02-17 11:24:53,539] Leos-MacBook-Air.local/ERROR/stderr: File "/Users/Leo/GitHub/locust/locust/inspectlocust.py", line 8, in print_task_ratio
[2017-02-17 11:24:53,542] Leos-MacBook-Air.local/ERROR/stderr: 
[2017-02-17 11:24:53,542] Leos-MacBook-Air.local/ERROR/stderr: d = get_task_ratio_dict(locusts, total=total, parent_ratio=parent_ratio)
[2017-02-17 11:24:53,542] Leos-MacBook-Air.local/ERROR/stderr: 
[2017-02-17 11:24:53,542] Leos-MacBook-Air.local/ERROR/stderr: File "/Users/Leo/GitHub/locust/locust/inspectlocust.py", line 24, in get_task_ratio_dict
[2017-02-17 11:24:53,542] Leos-MacBook-Air.local/ERROR/stderr: 
[2017-02-17 11:24:53,542] Leos-MacBook-Air.local/ERROR/stderr: if hasattr(tasks[0], 'weight'):
[2017-02-17 11:24:53,542] Leos-MacBook-Air.local/ERROR/stderr: 
[2017-02-17 11:24:53,543] Leos-MacBook-Air.local/ERROR/stderr: TypeError
[2017-02-17 11:24:53,543] Leos-MacBook-Air.local/ERROR/stderr: :
[2017-02-17 11:24:53,543] Leos-MacBook-Air.local/ERROR/stderr: 'dict_values' object does not support indexing
[2017-02-17 11:24:53,543] Leos-MacBook-Air.local/ERROR/stderr:
✗ locust -f test.py --show-task-ratio-json
[2017-02-17 11:22:12,623] Leos-MacBook-Air.local/ERROR/stderr: Traceback (most recent call last):
[2017-02-17 11:22:12,623] Leos-MacBook-Air.local/ERROR/stderr: File "/Users/Leo/.virtualenvs/locust/bin/locust", line 11, in <module>
[2017-02-17 11:22:12,624] Leos-MacBook-Air.local/ERROR/stderr: 
[2017-02-17 11:22:12,624] Leos-MacBook-Air.local/ERROR/stderr: load_entry_point('locustio', 'console_scripts', 'locust')()
[2017-02-17 11:22:12,624] Leos-MacBook-Air.local/ERROR/stderr: 
[2017-02-17 11:22:12,624] Leos-MacBook-Air.local/ERROR/stderr: File "/Users/Leo/GitHub/locust/locust/main.py", line 392, in main
[2017-02-17 11:22:12,625] Leos-MacBook-Air.local/ERROR/stderr: 
[2017-02-17 11:22:12,625] Leos-MacBook-Air.local/ERROR/stderr: "per_class": get_task_ratio_dict(locust_classes),
[2017-02-17 11:22:12,625] Leos-MacBook-Air.local/ERROR/stderr: 
[2017-02-17 11:22:12,625] Leos-MacBook-Air.local/ERROR/stderr: File "/Users/Leo/GitHub/locust/locust/inspectlocust.py", line 24, in get_task_ratio_dict
[2017-02-17 11:22:12,628] Leos-MacBook-Air.local/ERROR/stderr: 
[2017-02-17 11:22:12,628] Leos-MacBook-Air.local/ERROR/stderr: if hasattr(tasks[0], 'weight'):
[2017-02-17 11:22:12,628] Leos-MacBook-Air.local/ERROR/stderr: 
[2017-02-17 11:22:12,628] Leos-MacBook-Air.local/ERROR/stderr: TypeError
[2017-02-17 11:22:12,628] Leos-MacBook-Air.local/ERROR/stderr: :
[2017-02-17 11:22:12,628] Leos-MacBook-Air.local/ERROR/stderr: 'dict_values' object does not support indexing
[2017-02-17 11:22:12,628] Leos-MacBook-Air.local/ERROR/stderr:
@heyman heyman closed this as completed in e398dcb Feb 17, 2017
@heyman
Copy link
Member

heyman commented Feb 17, 2017

Fixed now. Thanks for reporting!

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

2 participants