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 longer logging interval stats when using LoadTestShape after 2.1.x #1906

Closed
dbfx opened this issue Oct 17, 2021 · 1 comment · Fixed by #1907
Closed

No longer logging interval stats when using LoadTestShape after 2.1.x #1906

dbfx opened this issue Oct 17, 2021 · 1 comment · Fixed by #1907
Labels

Comments

@dbfx
Copy link

dbfx commented Oct 17, 2021

Describe the bug

If I use any LoadTestShape test in 2.1.0 it will log interval statistics (CSV) every X seconds depending on CSV_STATS_INTERVAL_SEC.

However, from 2.2 (up to and including 2.4) it will not log the interval stats.

Expected behavior

Should see output like so:

 Aggregated                                                                            48     0(0.00%)  |     331      75    1089      99  |    2.10    0.00
----------------------------------------------------------------------------------------------------------------------------------------------------------------
 GET /                                                                                 48     0(0.00%)  |     331      75    1089      99  |    2.10    0.00
----------------------------------------------------------------------------------------------------------------------------------------------------------------
 Name                                                                              # reqs      # fails  |     Avg     Min     Max  Median  |   req/s failures/s

 Aggregated                                                                            44     0(0.00%)  |     353      75    1089     100  |    2.10    0.00
----------------------------------------------------------------------------------------------------------------------------------------------------------------
 GET /                                                                                 44     0(0.00%)  |     353      75    1089     100  |    2.10    0.00
----------------------------------------------------------------------------------------------------------------------------------------------------------------

Actual behavior

You see the shape launching debug info, but no aggregated stats etc.

Steps to reproduce

Use any LoadTestShape test, for example:

import math
from locust import HttpUser, TaskSet, task, between
from locust import LoadTestShape

class QuickstartUser(HttpUser):
    wait_time = between(5, 9)

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


class DoubleWave(LoadTestShape):
    """
    A shape to imitate some specific user behavior. In this example, midday
    and evening meal times. First peak of users appear at time_limit/3 and
    second peak appears at 2*time_limit/3
    Settings:
        min_users -- minimum users
        peak_one_users -- users in first peak
        peak_two_users -- users in second peak
        time_limit -- total length of test
    """

    min_users = 20
    peak_one_users = 60
    peak_two_users = 40
    time_limit = 300

    def tick(self):
        run_time = round(self.get_run_time())

        if run_time < self.time_limit:
            user_count = (
                (self.peak_one_users - self.min_users)
                * math.e ** -(((run_time / (self.time_limit / 10 * 2 / 3)) - 5) ** 2)
                + (self.peak_two_users - self.min_users)
                * math.e ** -(((run_time / (self.time_limit / 10 * 2 / 3)) - 10) ** 2)
                + self.min_users
            )
            return (round(user_count), round(user_count))
        else:
            return None    

Environment

  • OS: Linux
  • Python version: 3
  • Locust version: 2.2, 2.4
  • Locust command line that you ran: /usr/local/bin/locust -f ./shape.py --host https://testsite:443 --headless --csv=mycsv --csv-full-history -LDEBUG
  • Locust file contents (anonymized if necessary): above
@dbfx dbfx added the bug label Oct 17, 2021
@cyberw
Copy link
Collaborator

cyberw commented Oct 17, 2021

Probably my fault (when refactoring/introducing —autostart). I’ll have a look in the coming week.

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

Successfully merging a pull request may close this issue.

2 participants