sen
sen

Reputation: 75

django celery cannot start worker

I am having an issue with starting up my celery worker for my django project. Thank you for giving any help here.

I think I shut down the celery process inappropriately (ctrl+c first, and ran the "celery -A proj worker " command again before it was shut down completely). Since then I have never been able to start up my celery worker. It basically gives no response from the command line, not moving forward, no error, and nothing happens literally. It is just stuck there.

but "celery worker" can start successful, only "celery -A proj worker" fails

I also tried to reinstall my celery and rabbitmq, but this doesn't help either.

Does anyone know what could be wrong here? How can I fix this issue? Thank you very much for your help.

my celery.py:

    from __future__ import absolute_import, unicode_literals
import os
from celery import Celery

# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'webSite.settings')

app = Celery('webSite')

# Using a string here means the worker doesn't have to serialize
# the configuration object to child processes.
# - namespace='CELERY' means all celery-related configuration keys
#   should have a `CELERY_` prefix.
app.config_from_object('django.conf:settings', namespace='CELERY')

# Load task modules from all registered Django app configs.
app.autodiscover_tasks()


@app.task(bind=True)
def debug_task(self):
    print('Request: {0!r}'.format(self.request))

sen

Upvotes: 0

Views: 1071

Answers (1)

sen
sen

Reputation: 75

thank you all for your help, I have figured out how to figured out the issue.

So, each time I got stuck with starting the celery worker I closed my terminals, and therefore next time the process still hang there. What solved the problem for me is kill the process while the celery process is hanging there with "kill -9".

This solved my problem, but thank you all for the help.

sen

Upvotes: 0

Related Questions