Python hangs when trying to access celery shared_task

Viewed 453

I have a celery task within a django project which when called, does absolutely nothing. No exception is produced, Rabbit MQ nor the celery worker registers receiving the task either.

@shared_task
def test():
    print('starting task')
    time.sleep(10)
    return True

In the interactive shell if I import the task and try to run it

>import twitterbot.tasks
>twitter_bot.tasks.test.delay()

The REPL just sits there until I send a keyboard interrupt. I then receive

^CTraceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/kombu/utils/objects.py", line 42, in __get__
    return obj.__dict__[self.__name__]
KeyError: 'tasks'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/kombu/utils/objects.py", line 42, in __get__
    return obj.__dict__[self.__name__]
KeyError: 'data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/kombu/utils/objects.py", line 42, in __get__
    return obj.__dict__[self.__name__]
KeyError: 'tasks'

During handling of the above exception, another exception occurred:
keyboard interrupt here ..

Strangely, if I simply try to access a property of the task

>twitter_bot.tasks.test

I have the same issue. Is this an issue with my imports or what?

0 Answers
Related