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

Locust won't run http request and instead just, skips ahead to the next line in the code??? #444

Closed
bgenchel opened this issue Jul 9, 2016 · 1 comment

Comments

@bgenchel
Copy link

bgenchel commented Jul 9, 2016

I'm load testing a server in which one user 'unit' involves three separate requests, to create the user entity themselves and two accompanying entities they need to work with in the system.

my TaskSet goes like this

 class TaskSetClass(TaskSet):

     def on_start(self):
         self.setup_account()

     def setup_account(self):
          res = self.client.post(
             "/users/login",
             data={{user data}},
             headers={{admin header}}
           )
           self.auth_token = res.json()["auth_token"]

           res = self.client.post(
               "/other_entity",
               data={{necessary data}},
               headers={{auth header}}
           )
           self.other_entity_id = res.json()["entity_id"]

I'm just trying to get to minimum functionality level, and so I'm running locust on this file and asking it to only spawn 1 unit. When I run though, I get an error akin to:

my-vm/ERROR/stderr: self.on_start()
my-vm/ERROR/stderr: File ".../.../CPLoadTest.py", line 92, in on_start
my-vm/ERROR/stderr: self.setup_account()
my-vm/ERROR/stderr: File ".../.../CPLoadTest.py", line 109, in setup_account
my-vm/ERROR/stderr: self.other_entity_id = res.json()["entity_id"]
my-vm/ERROR/stderr: KeyError: 'entity_id'
my-vm/ERROR/stderr: <Greenlet at 0x7fab35568050: start_locust(<class 'CPLoadTest.AppUserLocust'>)> failed with KeyError

At first look, it would appear that the second request is failing, but when I look at my server logs, NOTHING. That request has never been made! It would appear that locust is not even attempting to make that second request, but instead just skips ahead to that next line and fails.

Is there a one request per function limit in locust? why would this not be running? It makes no sense.

Additionally, I don't see anywhere in the documentation a description of how I can debug this code. How can view the value of variables at different places in the code? Where can I view logging or debug output?

@bgenchel
Copy link
Author

debug output can be seen by using logging.error()

this error was occurring for me as a result of an error on my server. It would appear that on start can run as many requests as is given.

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