gpt4 book ai didi

kubernetes - 在Kubernetes中运行蝗虫时无法从 'HttpUser'错误导入名称 'locust'

转载 作者:行者123 更新时间:2023-12-02 12:09:38 26 4
gpt4 key购买 nike

我正在使用Helm Charts(https://github.com/helm/charts/tree/master/stable/locust)在Kubernetes上部署蝗虫
2 Worker Pod正在运行,没有错误,但是master处于CrashLoopBackOff状态。
当我检查失败的Pod的日志时,看到以下错误:

[2020-10-07 21:46:18,300] locust-master-5bf8d86867-kfxxg/ERROR/stderr: Traceback (most recent call last):
[2020-10-07 21:46:18,300] locust-master-5bf8d86867-kfxxg/ERROR/stderr: File "/usr/local/bin/locust", line 11, in <module>
[2020-10-07 21:46:18,300] locust-master-5bf8d86867-kfxxg/ERROR/stderr:
[2020-10-07 21:46:18,300] locust-master-5bf8d86867-kfxxg/ERROR/stderr: sys.exit(main())
[2020-10-07 21:46:18,300] locust-master-5bf8d86867-kfxxg/ERROR/stderr:
[2020-10-07 21:46:18,301] locust-master-5bf8d86867-kfxxg/ERROR/stderr: File "/usr/local/lib/python3.7/site-packages/locust/main.py", line 391, in main
[2020-10-07 21:46:18,301] locust-master-5bf8d86867-kfxxg/ERROR/stderr:
[2020-10-07 21:46:18,301] locust-master-5bf8d86867-kfxxg/ERROR/stderr: docstring, locusts = load_locustfile(locustfile)
[2020-10-07 21:46:18,301] locust-master-5bf8d86867-kfxxg/ERROR/stderr:
[2020-10-07 21:46:18,301] locust-master-5bf8d86867-kfxxg/ERROR/stderr: File "/usr/local/lib/python3.7/site-packages/locust/main.py", line 358, in load_locustfile
[2020-10-07 21:46:18,301] locust-master-5bf8d86867-kfxxg/ERROR/stderr:
[2020-10-07 21:46:18,302] locust-master-5bf8d86867-kfxxg/ERROR/stderr: imported = __import__(os.path.splitext(locustfile)[0])
[2020-10-07 21:46:18,302] locust-master-5bf8d86867-kfxxg/ERROR/stderr:
[2020-10-07 21:46:18,302] locust-master-5bf8d86867-kfxxg/ERROR/stderr: File "/locust-tasks/tasks.py", line 1, in <module>
[2020-10-07 21:46:18,302] locust-master-5bf8d86867-kfxxg/ERROR/stderr:
[2020-10-07 21:46:18,302] locust-master-5bf8d86867-kfxxg/ERROR/stderr: from locust import HttpUser, task, TaskSet, between
[2020-10-07 21:46:18,302] locust-master-5bf8d86867-kfxxg/ERROR/stderr:
[2020-10-07 21:46:18,302] locust-master-5bf8d86867-kfxxg/ERROR/stderr: ImportError
[2020-10-07 21:46:18,302] locust-master-5bf8d86867-kfxxg/ERROR/stderr: :
[2020-10-07 21:46:18,302] locust-master-5bf8d86867-kfxxg/ERROR/stderr: cannot import name 'HttpUser' from 'locust' (/usr/local/lib/python3.7/site-packages/locust/__init__.py)
[2020-10-07 21:46:18,303] locust-master-5bf8d86867-kfxxg/ERROR/stderr:
如果有人可以帮助我了解我在做什么错,我将不胜感激。我的想法是我使用的是 HttpUser,并且在我拖动的图像(greenbirdit /蝗虫)中仍然是 LocustUser,但是我不知道如何解决。
谢谢你的帮助!

最佳答案

您到Locust Helm Chart的链接说它正在使用Locust容器0.9.0。在Locust 1.0之前,HttpUserHttpLocust。您可以在此处查看0.9.0的文档:https://docs.locust.io/en/0.9.0/
我没有使用Helm,但可以肯定的是,您似乎要重写locustfile以使用HttpLocust和其他1.0之前的API,直到Helm将图表更新为使用1.0+。

关于kubernetes - 在Kubernetes中运行蝗虫时无法从 'HttpUser'错误导入名称 'locust',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64253006/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com