locust - 所有用户完成任务后如何停止蝗虫负载测试?
问题描述
在 locust 文档中,我们只能使用 self.interrupt() 停止任务,但它会移动到父类。它不会停止负载测试。我想在所有用户登录并完成他们的任务后停止完整的负载测试
蝗虫版本:1.1
class RegisteredUser(User):
@task
class Forum(TaskSet):
@task(5)
def view_thread(self):
pass
@task(1)
def stop(self):
self.interrupt()
@task
def frontpage(self):
pass
解决方案
您可以调用self.environment.runner.quit()
以停止整个运行。
更多信息:https ://docs.locust.io/en/stable/writing-a-locustfile.html#environment-attribute
推荐阅读
- stenciljs - @state() 修饰属性更改时,模板不会重新渲染组件
- python - Django 自动标准化模型字段
- android - 如何限制测验中的问题列表?
- haskell - 在 GHC 中发生通用子表达式消除 (CSE) 的确切情况是什么?
- c++ - flex 生成的 c++ 解析器稳定吗?
- javascript - 尝试通过 c# 从 html 访问上传的文件时,如何修复 Visual Studio 中的 NullReference 错误?
- ruby - sqlite3 .execute2 在 ruby 文件中遇到问题
- php - 在 PHP 页面上传图片
- python - 如何解决python中的以下错误:“IndexError:字符串索引超出范围”
- python - 选择最大值时从列表中返回随机值并具有 2 个相同的最大值