- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我使用 Celery 安排将来发送电子邮件。我将任务放在 celery 中,并在将来有时设置了 apply_async() 和 ETA。
当我查看 flower 时,我看到为 future 安排的所有任务都处于已接收状态。
如果我重新启动 celery,所有任务都将消失。为什么他们不见了?
我使用 Redis 作为代理。
编辑1
在我发现的文档中:
If a task is not acknowledged within the Visibility Timeout the task will be redelivered to another worker and executed.
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 are planning to use.
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.
Periodic tasks will not be affected by the visibility timeout, as this is a concept separate from ETA/countdown.
You can increase this timeout by configuring a transport option with the same name:
BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 43200}
The value must be an int describing the number of seconds.
但我的任务的 ETA 可以用月或年来衡量。
编辑 2
这是我在输入时得到的结果:
$ celery -A app inspect scheduled
{u'priority': 6, u'eta': u'2015-11-22T11:53:00-08:00', u'request': {u'args': u'(16426,)', u'time_start': None, u'name': u'core.tasks.action_due', u'delivery_info': {u'priority': 0, u'redelivered': None, u'routing_key': u'celery', u'exchange': u'celery'}, u'hostname': u'celery@app.myplanmap.com', u'acknowledged': False, u'kwargs': u'{}', u'id': u'8ac59984-f8d0-47ae-ac9e-c4e3ea9c4ac6', u'worker_pid': None}}
如果你仔细观察,任务还没有被确认,所以它应该在 celery 重启后留在 redis 中,对吧?
最佳答案
你必须使用 RabbitMq 而不是 redis。
RabbitMQ 功能齐全、稳定、耐用且易于安装。这是生产环境的绝佳选择。
Redis 也是功能完备的,但在突然终止或电源故障的情况下更容易丢失数据。
使用 rabbit mq,您在重启时丢失消息的问题必须解决。
关于python - Celery重启丢失定时任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33801985/
我对开发领域有点陌生,我正在开发一个 Android 项目。我正在尝试使用手机相机闪光灯。我试图让它以重复的 Action 闪烁。下面是我的 .java 文件中的一个剪辑。 public vo
我正在制作一个 ios 应用程序,它是一种诗集。我想要的功能之一是定时“阅读”,因此一首诗中的单词出现的时间与我阅读时的时间相同。所以我有一个数组,里面有诗中的词,还有延迟。 现在我想遍历单词,在屏幕
这个问题在这里已经有了答案: Loop doesn't see value changed by other thread without a print statement (1 个回答) 关闭
我如何才能使用计时器?例如,我想显示某个文本 10 秒,然后我想在剩余时间内显示不同的文本。 谢谢 凯文 最佳答案 延迟操作的最简单方法是使用 NSObject 的 PerformSelector:w
我在这里的措辞上有点困难,但要点是我使用返回一个对象的 Promise.race (如下所示)。大多数时候,至少有一些 promise 会崩溃,但这是故意的。这仅意味着未找到产品。为了避免 Promi
我正在寻找定时 JDialog,它会在指定时间过后消失,并且找到的代码运行正常。 JFrame f = new JFrame(); final JDia
我试图让选择器在不同的时间轮换,我想我会尝试一个简单的 if/else 语句,让第一个选择器在 3 秒后轮换,接下来的选择器在 30 秒后轮换。然而,它只是每三秒旋转一次。如果我想出了如何完成这项工作
这个问题已经有答案了: How to implement a timer in c? (7 个回答) Creating a Timer in C (2 个回答) 已关闭 9 年前。 我需要根据用户输入
我有一个在我文档的 head 标签中调用的 javascript 文件,每隔 30 秒,我希望重新加载这个 javascript 文件。 我对此做了一些研究,似乎它在提取本地存储的文件副本或跨浏览器问
我想看看运行 bash 函数需要多长时间。在做了一些研究之后,我想出了这种使用子 shell 的方法: function test-function() { time ( rs
我正在使用 jQuery,并且我有一个 aAax 请求,如下所示; $.ajax({ type: 'POST', url: 'test.php',
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求提供代码的问题必须表现出对所解决问题的最低限度的了解。包括尝试的解决方案、为什么它们不起作用以及预期结果
我想为系统的每笔交易制定一个程序任务,以预留15分钟的等待时间。如果超过15分钟,程序将改变状态/状态。如果状态在 15 分钟内发生变化,则结束任务。我可以应用更多更好的代码吗?比如Wait/Slee
我正在制作一个打字速度测试程序,它有一个循环需要运行 60 秒然后退出并显示结果。我读过其他关于为 C++ 程序计时的地方,但我的研究没有定论。该程序正在运行 (llbd),我希望有人有解决方案/更好
我试图在一个简单的游戏中每 0.5 - 2 秒随机创建一个障碍。我已经有了创建障碍的功能,但我无法为实例化计时。我试过研究这个,但我还没有想出任何相关的东西。你们能帮帮我吗? 最佳答案 您可以使用 p
我有以下测试,在运行特别长的 fib 断言时不会失败。 未正确失败的测试 #!/usr/env/bin python2.7 import unittest from fib import fib fr
我想知道这是否可行。有没有一种方法可以使用 PHP 每 24 小时更新一次行的值。为什么?我正在创建一个使用在线货币(称为 Yads)的 child 网站。 Row 的值是用户拥有的 Yad 数量。
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求提供代码的问题必须表现出对所解决问题的最低限度理解。包括尝试过的解决方案、为什么它们不起作用,以及预
有 Cron API 这样的东西吗? 我的意思是,是否有一种编程方式可以在不影响 Cron 的情况下添加/删除 Cron 作业? 最佳答案 UNIX cron 的 API 是文件系统。有一个用于安装/
1、SpringBoot:集成Swagger终极版 学习目标: 了解Swagger的概念及作用 掌握在项目中集成Swagger自动生成API文档 1.1、Sw
我是一名优秀的程序员,十分优秀!