-
Notifications
You must be signed in to change notification settings - Fork 3k
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
ValueError: StatsEntry.use_response_times_cache must be set to True #1531
Comments
Let me see. |
Sorry! In my development, I did not consider that the use_response_times_cache parameter of worker mode is False. def stats_history(runner):
"""Save current stats info to history for charts of report."""
while True:
stats = runner.stats
if not stats.total.use_response_times_cache: # *** add this
break # *** add this
r = {
'time': datetime.datetime.now().strftime("%H:%M:%S"),
'current_rps': stats.total.current_rps or 0,
'current_fail_per_sec': stats.total.current_fail_per_sec or 0,
'response_time_percentile_95': stats.total.get_current_response_time_percentile(0.95) or 0,
'response_time_percentile_50': stats.total.get_current_response_time_percentile(0.5) or 0,
'user_count': runner.user_count or 0,
}
stats.history.append(r)
gevent.sleep(HISTORY_STATS_INTERVAL_SEC) Should I make a new PR? @cyberw |
Yes 🙂 |
I made a PR myself :) |
fix #1531 (ValueError: StatsEntry.use_response_times_cache must be set to True)
Because this was in a release I made an emergency fix in my own PR & new release (1.2.1, on its way out now). @taojy123 , can you make a test case that excercises this scenario? |
ok def test_stats_history(self):
env1 = Environment(events=locust.events, catch_exceptions=False)
runner1 = env1.create_master_runner("127.0.0.1", 5558)
env2 = Environment(events=locust.events, catch_exceptions=False)
runner2 = env2.create_worker_runner("127.0.0.1", 5558)
greenlet1 = gevent.spawn(stats_history, runner1)
greenlet2 = gevent.spawn(stats_history, runner2)
gevent.sleep(1)
hs1 = runner1.stats.history
hs2 = runner2.stats.history
gevent.kill(greenlet1)
gevent.kill(greenlet2)
self.assertEqual(1, len(hs1))
self.assertEqual(0, len(hs2)) |
Nice! Can you make a PR? |
ok, I just woke up,I'll make a PR later. |
Hi! I am able to reproduce the error when I run locust within python subprocess.Popen:
Error:
Locust: 2.8.3 |
I see this on every locust worker running
1.2
:Tried with very basic locust file, same issue:
Any idea @cyberw or @vstepanov-lohika-tix?
The text was updated successfully, but these errors were encountered: