我正在使用 Celery 来处理多个数据挖掘任务。其中一项任务连接到远程服务,该服务最多允许 10 个同时连接per user(或者换句话说,它CAN全球连接数超过 10 个,但CANNOT每个单独作业超过 10 个连接)。
I THINK 令牌桶(限速) http://celeryproject.org/docs/internals/reference/celery.worker.buckets.html是我正在寻找的,但我似乎找不到它的任何实现。
Celery 具有速率限制功能,并包含通用令牌桶实现。
设置任务的速率限制:http://docs.celeryproject.org/en/latest/userguide/tasks.html#Task.rate_limit http://docs.celeryproject.org/en/latest/userguide/tasks.html#Task.rate_limit
或者在运行时:
http://docs.celeryproject.org/en/latest/userguide/workers.html#rate-limits http://docs.celeryproject.org/en/latest/userguide/workers.html#rate-limits
令牌桶的实现在 Kombu 中
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)