Celery SchedulelingError:需要一个整数



我在Heroku上使用Celery,Redis作为我的代理。我也尝试过RabbitMQ作为代理,但在尝试运行计划任务时不断出现以下错误:

Traceback (most recent call last): 
  File "/app/.heroku/python/lib/python2.7/site-packages/celery/beat.py", line 203, in maybe_due 
    result = self.apply_async(entry, publisher=publisher) 
  File "/app/.heroku/python/lib/python2.7/site-packages/celery/beat.py", line 259, in apply_async 
    entry, exc=exc)), sys.exc_info()[2]) 
  File "/app/.heroku/python/lib/python2.7/site-packages/celery/beat.py", line 251, in apply_async 
    **entry.options) 
  File "/app/.heroku/python/lib/python2.7/site-packages/celery/app/task.py", line 555, in apply_async 
    **dict(self._get_exec_options(), **options) 
  File "/app/.heroku/python/lib/python2.7/site-packages/celery/app/base.py", line 347, in send_task 
    with self.producer_or_acquire(producer) as P: 
  File "/app/.heroku/python/lib/python2.7/site-packages/celery/app/base.py", line 402, in producer_or_acquire 
    producer, self.amqp.producer_pool.acquire, block=True, 
  File "/app/.heroku/python/lib/python2.7/site-packages/celery/app/amqp.py", line 492, in producer_pool 
    self.app.pool, 
  File "/app/.heroku/python/lib/python2.7/site-packages/celery/app/base.py", line 608, in pool 
    self._pool = self.connection().Pool(limit=limit) 
  File "/app/.heroku/python/lib/python2.7/site-packages/kombu/connection.py", line 612, in Pool 
    return ConnectionPool(self, limit, preload) 
  File "/app/.heroku/python/lib/python2.7/site-packages/kombu/connection.py", line 987, in __init__ 
    preload=preload) 
  File "/app/.heroku/python/lib/python2.7/site-packages/kombu/connection.py", line 833, in __init__ 
    self.setup() 
  File "/app/.heroku/python/lib/python2.7/site-packages/kombu/connection.py", line 1011, in setup 
    for i in range(self.limit): 
SchedulingError: Couldn't apply scheduled task my_task: an integer is required 

我的任务是这样写的:

@app.task(ignore_result=True)
def my_task():
    do_something()

你知道发生了什么事吗?

我突然想到发生了什么。在我的设置文件中,我有以下行:

BROKER_POOL_LIMIT = os.environ.get('BROKER_POOL_LIMIT', 1)

我应该强迫它是一个整数:

BROKER_POOL_LIMIT = int(os.environ.get('BROKER_POOL_LIMIT', 1))

相关内容

  • 没有找到相关文章

最新更新