python - 人为限制 celery worker 可用的内存
问题描述
我有一个(我认为相当标准的)设置,带有 Django 服务器 + redis + celery。
根据委派给芹菜工人的任务,有时我会得到:
[2020-07-21 19:58:17,401: ERROR/MainProcess] Process 'ForkPoolWorker-1' pid:31695 exited with 'signal 9 (SIGKILL)'
[2020-07-21 19:58:17,469: ERROR/MainProcess] Task handler raised error: WorkerLostError('Worker exited prematurely: signal 9 (SIGKILL).',)
Traceback (most recent call last):
File "/path/to/venv/lib/python3.6/site-packages/billiard/pool.py", line 1267, in mark_as_worker_lost
human_status(exitcode)),
billiard.exceptions.WorkerLostError: Worker exited prematurely: signal 9 (SIGKILL).
据我所知,工人被杀死是因为系统内存不足。
我希望能够在测试环境中模拟该问题。如何人为地限制芹菜工人(或所有工人)可用的内存或模拟工人以这种方式退出?
解决方案
推荐阅读
- javascript - 用于滚动到 div 但在 div 顶部保留填充的 js 链接
- r - 提取R中的最后一个正则表达式匹配
- node.js - tail -f -n 1 返回所有内容,而不是更改
- python - 如何通过rest api从gerrit“一起提交”所有更改?
- apache-spark - 从 spark 读取 gzipped parquet 文件
- excel - 如何传播公式中的相对行?
- flutter - 如何使用 RawKeyboardListener 将焦点节点从下拉列表更改为文本字段,因为它在 Flutter Web 中听了两次按键
- kubernetes - 设置 Kubernetes 服务令牌的过期时间
- raml - 我如何在 RAML 1.0 中提及文件作为响应
- c# - DB中INSERT操作的单元测试