- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的大多数 Celery 任务的 ETA 都长于 Amazon SQS 定义的最大可见性超时。
celery documentation说:
This causes problems with ETA/countdown/retry tasks where the time to execute exceeds the visibility timeout; in fact if that happens it will be executed again, and again in a loop.
So you have to increase the visibility timeout to match the time of the longest ETA you’re planning to use.
同时它还说:
The maximum visibility timeout supported by AWS as of this writing is 12 hours (43200 seconds):
如果我使用 SQS,我应该怎么做才能避免在我的工作人员中多次执行任务?
最佳答案
通常,执行预计到达时间很长的任务不是一个好主意。
首先是“visibility_timeout”问题。而且你可能不想要一个非常大的可见性超时,因为如果工作人员在任务即将运行前 1 分钟崩溃,那么队列仍然会等待 visibility_timeout 完成,然后再将任务发送给另一个工作人员,我猜你不想要这又是 1 个月。
来自 celery 文档:
Note that Celery will redeliver messages at worker shutdown, so having a long visibility timeout will only delay the redelivery of ‘lost’ tasks in the event of a power failure or forcefully terminated workers.
而且,SQS 只允许确认列表中的任务数。
SQS 将这些任务称为“飞行消息”。来自 http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html :
A message is considered to be in flight after it's received from a queue by a consumer, but not yet deleted from the queue.
For standard queues, there can be a maximum of 120,000 inflight messages per queue. If you reach this limit, Amazon SQS returns the OverLimit error message. To avoid reaching the limit, you should delete messages from the queue after they're processed. You can also increase the number of queues you use to process your messages.
For FIFO queues, there can be a maximum of 20,000 inflight messages per queue. If you reach this limit, Amazon SQS returns no error messages.
我看到了两种可能的解决方案,您可以改用 RabbitMQ,它不依赖于可见性超时(如果您不想管理自己的服务,可以使用“RabbitMQ 即服务”服务),或者更改您的代码以具有非常小的 ETA (最佳实践)
这些是我的 2 美分,也许@asksol 可以提供一些额外的见解。
关于python - Celery SQS + 任务重复 + SQS 可见性超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41300209/
当我运行此命令进行 celery 节拍时。 [2013-06-27 02:17:05,936: INFO/MainProcess] Celerybeat: Starting... [2013-06-2
我需要构建一个处理两种类型任务的系统。一种类型可以创建更多自身或另一种类型的任务。将有很少的 worker (2-3)和只有一个主机。最重要的要求是系统应该优雅地处理重新启动:即在重新启动时,正在进行
我们使用 Celery 4.2.1 和 Redis,并为我们的任务设置了全局软超时和硬超时。我们所有的自定义任务都设计为保持在限制范围内,但每天内置任务 backend_cleanup 任务最终都会因
我知道这违背了使用 Celery 的全部目的,但是是否有一个函数会阻塞直到结果返回? 所以我可以调用 actual_result = MyTask.dont_delay(some_arg="foo")
我们使用 Celery 4.2.1 和 Redis,并为我们的任务设置了全局软超时和硬超时。我们所有的自定义任务都设计为保持在限制范围内,但每天内置任务 backend_cleanup 任务最终都会因
我知道这违背了使用 Celery 的全部目的,但是是否有一个函数会阻塞直到结果返回? 所以我可以调用 actual_result = MyTask.dont_delay(some_arg="foo")
我计划使用 celery 作为我的项目的任务管理组件。它几乎具有我的项目所需的所有功能。我将有一组可以独立执行或按指定顺序执行的任务。在顺序任务中,我希望能够在中间任务之一失败时执行清理/回滚。我想知
它是运行 Celery 的实际处理器还是另一个进程?在花中,我可以在工作池中看到多个进程吗?这两者之间有什么区别? 最佳答案 当您运行 celery worker 时,它会创建一个父进程来管理正在运行
我有一个名为 ShippingApp 的项目,我按照步骤设置了 celery worker。我将 celery 3.1.26.post2 与 python3.7 一起使用,当我想启动 Celery W
尽我所能,我无法杀死这些 celery worker 。 我跑: celery --app=my_app._celery:app status 我看到我有3个(我不明白为什么3个 worker = 2
我在 docker 容器中运行了 celery ,我想检查选项 CELERY_TASK_RESULT_EXPIRES = '3600' 是否已应用。 我尝试使用 celery inspect conf
我使用 celery.chord(...) 创建一组任务和一个方法,该方法在组中的所有任务完成后被调用。 我使用 amqp 结果后端(但我想切换到 memcached)。 我的 worker 每秒钟一
我正在寻找一些关于将任务生成的列表映射到 celery 中的另一个任务的最佳方法的建议。 假设我有一个名为 parse 的任务,它解析 PDF 文档并输出页面列表。然后,每个页面都需要单独传递给另一个
这不是关于如何捕获 celery worker 日志的问题。有什么方法可以捕获生产者上的 celery 日志记录。我想要的是捕获当我调用 task.delay(...) 或 task.apply_as
我正在使用以下版本: 花==0.9.3 celery ==4.3.0 这为我提供了包含多个列的任务页面的以下显示: 每次我进入这个页面时,我最终都会重新排列页面,使列的顺序不同,并将行的顺序更改为降序
我想完成这样的事情: results = [] for i in range(N): data = generate_data_slowly() res = tasks.process
我想运行一个由beat 调度的复杂任务。让我们假设定义了默认的 add/mul 任务。 @app.on_after_configure.connect def setup_periodic_tasks
我有一个应用程序,其中包含 celery worker 。当我部署这将杀死那些正在运行的进程。 所以任务将开始,但永远不会完成,并且在部署完成时不会重新启动。 避免此问题并在部署完成后重新启动这些任务
我正在开始使用 Celery 进行 Django 项目。出于本地开发目的,我根据这些说明使用 djcelery 和 djkombu(数据库传输)进行了设置 http://ask.github.com/
如何配置 celery 在任务失败时发送电子邮件警报? 例如,我希望 Celery 在 3 个以上的任务失败或 10 个以上的任务被重试时通知我。 是否可以使用 celery 或实用程序(例如花),或
我是一名优秀的程序员,十分优秀!