ukejoe
ukejoe

Reputation: 737

Celery SchedulingError: an integer is required

I'm using Celery on Heroku with Redis as my broker. I've tried RabbitMQ as a broker as well, but keep getting the following error when trying to run a scheduled task:

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 

This is how my task is written:

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

Any ideas what's going on?

Upvotes: 0

Views: 490

Answers (1)

ukejoe
ukejoe

Reputation: 737

It just occurred to me what was going on. In my settings file, I had the following line:

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

I should have forced that to be an integer:

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

Upvotes: 1

Related Questions