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

Error - Get_next_task return random.choice(self.tasks) and Random.py choice raise IndexError('Cannot choose from an empty sequence') from None) #748

Closed
Eddie-Uncle opened this issue Mar 12, 2018 · 1 comment

Comments

@Eddie-Uncle
Copy link

Eddie-Uncle commented Mar 12, 2018

Description of issue / feature request

TBD I am getting this exception:

Count,Message,Traceback,Nodes
1036,Cannot choose from an empty sequence," File ""/usr/local/lib/python3.6/site-packages/locust/core.py"", line 268, in run
self.schedule_task(self.get_next_task())
File ""/usr/local/lib/python3.6/site-packages/locust/core.py"", line 329, in get_next_task
return random.choice(self.tasks)
File ""/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/random.py"", line 258, in choice
raise IndexError('Cannot choose from an empty sequence') from None
",local

Expected behavior

TBD Load multiple web pages

Actual behavior

TBD Load is just working in some (and seems that is skipping other pages, so I can't test the load on them and the pages do exist, no 404)

Environment settings (for bug reports)

  • OS:macoS HIGH Sierra
  • Python version: 3.6.4
  • Locust version: 0.8.1

Steps to reproduce (for bug reports)

Here is my code:

       from locust import HttpLocust, TaskSet, task

       class UserBehavior(TaskSet):
                    def on_start(self):
                     self.login()

                     def login(self):
                     self.client.post("/dotAdmin", {"username":"username@company.com", "password":"username})

 class WebsiteUser(HttpLocust):
          task_set = UserBehavior
          min_wait = 2000
          max_wait = 9000

 class MobileUser(HttpLocust):
         task_set = UserBehavior
         min_wait = 2000
         max_wait = 9000

class MyTaskSet(TaskSet):

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

@task(13)
def about(self):
    self.client.get("/about-us/our-team")

@task(11)
def blogs(self):
    self.client.get("/blogs")

@task(10)
def contactus(self):
    self.client.get("/contact-us")

@task(8)
def products(self):
    self.client.get("/products")

@task(19)
def resources(self):
    self.client.get("/demos/content-geolocation")

  class MyLocust(HttpLocust):
    task_set = MyTaskSet
    min_wait = 5000
    max_wait = 15000

TBD - example code appreciated

@Eddie-Uncle
Copy link
Author

Guys, I fixed, had some functions and fixed the code. Thank you

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

1 participant