<bdo id='MUIqa'></bdo><ul id='MUIqa'></ul>
  1. <small id='MUIqa'></small><noframes id='MUIqa'>

    <tfoot id='MUIqa'></tfoot>
      <i id='MUIqa'><tr id='MUIqa'><dt id='MUIqa'><q id='MUIqa'><span id='MUIqa'><b id='MUIqa'><form id='MUIqa'><ins id='MUIqa'></ins><ul id='MUIqa'></ul><sub id='MUIqa'></sub></form><legend id='MUIqa'></legend><bdo id='MUIqa'><pre id='MUIqa'><center id='MUIqa'></center></pre></bdo></b><th id='MUIqa'></th></span></q></dt></tr></i><div id='MUIqa'><tfoot id='MUIqa'></tfoot><dl id='MUIqa'><fieldset id='MUIqa'></fieldset></dl></div>
    1. <legend id='MUIqa'><style id='MUIqa'><dir id='MUIqa'><q id='MUIqa'></q></dir></style></legend>

      如何跟踪芹菜的重试情况

      时间:2024-08-21
      <i id='N7H72'><tr id='N7H72'><dt id='N7H72'><q id='N7H72'><span id='N7H72'><b id='N7H72'><form id='N7H72'><ins id='N7H72'></ins><ul id='N7H72'></ul><sub id='N7H72'></sub></form><legend id='N7H72'></legend><bdo id='N7H72'><pre id='N7H72'><center id='N7H72'></center></pre></bdo></b><th id='N7H72'></th></span></q></dt></tr></i><div id='N7H72'><tfoot id='N7H72'></tfoot><dl id='N7H72'><fieldset id='N7H72'></fieldset></dl></div>
        <legend id='N7H72'><style id='N7H72'><dir id='N7H72'><q id='N7H72'></q></dir></style></legend>

        <tfoot id='N7H72'></tfoot>
      • <small id='N7H72'></small><noframes id='N7H72'>

          <tbody id='N7H72'></tbody>

            <bdo id='N7H72'></bdo><ul id='N7H72'></ul>
                本文介绍了如何跟踪芹菜的重试情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                在芹菜中,如何跟踪当前重试?我知道我可以这样做:

                @app.task(bind=True, default_retry_delay=900, max_retries=5)
                def send_email(self, sender=None, to=None, subject=None, message=None):
                  try:
                    # Send email
                  except Exception as e:
                    # Print log message with current retry
                    self.retry(e)
                

                但我想说这是尝试1/5.2/5等等。

                推荐答案

                当前重试次数可以在任务的request.retries属性上找到。

                @app.task(retries=3, default_retry_delay=1)
                def fail():
                    try:
                        assert False
                    except Exception as e:
                      print 'Try {0}/{1}'.format(fail.request.retries, fail.max_retries)
                      # Print log message with current retry
                      raise fail.retry(exc=e)
                
                
                [2015-01-14 15:15:55,702: WARNING/Worker-1] Try 0/3
                [2015-01-14 15:15:58,604: WARNING/Worker-3] Try 1/3
                [2015-01-14 15:16:00,605: WARNING/Worker-2] Try 2/3
                [2015-01-14 15:16:02,607: WARNING/Worker-6] Try 3/3
                      
                

                芹菜内部使用类似的方法:https://github.com/celery/celery/blob/b0cfa0d818743262a032c541cce2fa8c43fabad4/celery/app/task.py#L558

                这篇关于如何跟踪芹菜的重试情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:芹菜,叫延时倒计时 下一篇:如何实现芹菜多工自动伸缩?

                相关文章

                1. <legend id='IrWqj'><style id='IrWqj'><dir id='IrWqj'><q id='IrWqj'></q></dir></style></legend>
                  <tfoot id='IrWqj'></tfoot>

                  1. <i id='IrWqj'><tr id='IrWqj'><dt id='IrWqj'><q id='IrWqj'><span id='IrWqj'><b id='IrWqj'><form id='IrWqj'><ins id='IrWqj'></ins><ul id='IrWqj'></ul><sub id='IrWqj'></sub></form><legend id='IrWqj'></legend><bdo id='IrWqj'><pre id='IrWqj'><center id='IrWqj'></center></pre></bdo></b><th id='IrWqj'></th></span></q></dt></tr></i><div id='IrWqj'><tfoot id='IrWqj'></tfoot><dl id='IrWqj'><fieldset id='IrWqj'></fieldset></dl></div>
                  2. <small id='IrWqj'></small><noframes id='IrWqj'>

                      <bdo id='IrWqj'></bdo><ul id='IrWqj'></ul>