Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Command line 通过redis cli检查并重试重新确认作业_Command Line_Redis_Resque - Fatal编程技术网

Command line 通过redis cli检查并重试重新确认作业

Command line 通过redis cli检查并重试重新确认作业,command-line,redis,resque,Command Line,Redis,Resque,我无法在我的服务器上运行resque web,因为有些问题我仍然需要处理,但我仍然需要检查并重试resque队列中失败的作业 有没有人有过关于如何查看失败作业队列以查看错误是什么以及如何使用redis cli命令行重试的经验 谢谢,在以下链接上找到了解决方案: 在rails控制台中,我们可以使用以下命令检查并重试失败的作业: Resque::Failure.count (Resque::Failure.count-1).downto(0).each { |i| Resque::Failur

我无法在我的服务器上运行resque web,因为有些问题我仍然需要处理,但我仍然需要检查并重试resque队列中失败的作业

有没有人有过关于如何查看失败作业队列以查看错误是什么以及如何使用redis cli命令行重试的经验


谢谢,

在以下链接上找到了解决方案:

在rails控制台中,我们可以使用以下命令检查并重试失败的作业:

 Resque::Failure.count
(Resque::Failure.count-1).downto(0).each { |i| Resque::Failure.requeue(i) }
1-获取失败作业的数量:

 Resque::Failure.count
(Resque::Failure.count-1).downto(0).each { |i| Resque::Failure.requeue(i) }
2-检查错误异常类和回溯

Resque::Failure.all(0,20).each { |job|
   puts "#{job["exception"]}  #{job["backtrace"]}"
}
作业对象是包含失败作业信息的哈希。您可以检查它以查看更多信息。还要注意,这只列出了前20个失败的作业。不确定如何列出它们,因此必须改变值(0、20)才能得到整个列表

3-重试所有失败的作业:

 Resque::Failure.count
(Resque::Failure.count-1).downto(0).each { |i| Resque::Failure.requeue(i) }
4-重置失败的作业计数:

 Resque::Failure.clear

重试所有作业不会重置计数器。我们必须清除它,使其变为零。

使用ruby控制台这样做会更简单,因为Resque有各种帮助程序。为什么要直接在redis cli中执行此操作?谢谢,按照您的建议使用rails控制台解决了我的问题。别忘了Resque还有一个易于配置的web界面,用于查看错误及其堆栈跟踪。有关更多信息,请参阅。要列出所有失败的作业,可以执行以下操作:
Resque::Failure.all(0,0)