D
D
densaface2016-05-11 21:47:29
Django
densaface, 2016-05-11 21:47:29

Why doesn't flower show django celery tasks?

I went through a bunch of tutorials on launching django celery, but there was no single picture in my head. In general, now django celery is working properly. Sends tasks to the queue, executes them, and in the application's views.py itself, I can request the status of the task by id, see if the task has been completed or not.
But running flower does not show any workers or tasks.
Actually, when you start flower, you can already see that it started crookedly

K:\sw\prod_web_site3>C:\Python27\python.exe manage.py celery flower -A prod_web
site.celeryapp:app_celery worker
[I 160511 20:35:08 command:136] Visit me at http://localhost:5555
[I 160511 20:35:08 command:141] Broker: redis://localhost:6379/0
[I 160511 20:35:08 command:144] Registered tasks:
    ['accounts.tasks.just_print',
     'accounts.tasks.test',
     'celery.backend_cleanup',
     'celery.chain',
     'celery.chord',
     'celery.chord_unlock',
     'celery.chunks',
     'celery.group',
     'celery.map',
     'celery.starmap']
[I 160511 20:35:08 mixins:231] Connected to redis://localhost:6379/0
[W 160511 20:35:11 control:44] 'stats' inspect method failed
[W 160511 20:35:11 control:44] 'active_queues' inspect method failed
[W 160511 20:35:11 control:44] 'registered' inspect method failed
[W 160511 20:35:11 control:44] 'scheduled' inspect method failed
[W 160511 20:35:11 control:44] 'active' inspect method failed
[W 160511 20:35:11 control:44] 'reserved' inspect method failed
[W 160511 20:35:11 control:44] 'revoked' inspect method failed
[W 160511 20:35:11 control:44] 'conf' inspect method failed

Flower saw registered tasks, was able to connect to the database, but for some reason the expected methods turned out to be inoperative.
Also, the ping command is also not executed.
K:\sw\prod_web_site3>C:\Python27\Scripts\celery.exe -A prod_web_site.celeryapp:app_celery inspect ping
Error: No nodes replied within time constraint.

How to launch the worker
K:\sw\prod_web_site3>python manage.py celery worker -l debug --pythonpath=C:\Python27\

Selerics
python manage.py celerycam --frequency=5.0
may have a problem in settings.py, in which a set of settings from various tutorials has accumulated, I will give it almost completely just in case. For me, it is important that the user, the seller, work first of all, instead of the flower I can invent my own bicycle, since in views.py I can save pids of running tasks and monitor their status. But I will be glad if the collective mind tells you ways to diagnose problems with flowers, sensible tutorials
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'userena',
    'guardian',
    'easy_thumbnails',
    'accounts',
]

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

#LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'ru'
TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

STATIC_URL = '/static/'
AUTHENTICATION_BACKENDS = (
    'userena.backends.UserenaAuthenticationBackend',
    'guardian.backends.ObjectPermissionBackend',
    'django.contrib.auth.backends.ModelBackend',
)
ANONYMOUS_USER_ID = -1

AUTH_PROFILE_MODULE = 'accounts.UserProfile'
USERENA_SIGNIN_REDIRECT_URL = '/accounts/%(username)s/'
LOGIN_URL = '/accounts/signin/'
LOGOUT_URL = '/accounts/signout/'
SITE_ID = 2

EMAIL_BACKEND = 'django_smtp_ssl.SSLEmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 465
EMAIL_HOST_USER = '***'
EMAIL_HOST_PASSWORD = '***'

#
import djcelery
djcelery.setup_loader()

INSTALLED_APPS += ('djcelery', 'djkombu',)

BROKER_URL = 'redis://localhost:6379/0'

CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'

BROKER_HOST = "localhost"
BROKER_BACKEND="redis"
REDIS_PORT=6379
REDIS_HOST = "localhost"
BROKER_USER = ""
BROKER_PASSWORD =""
BROKER_VHOST = "0"
REDIS_DB = 0
REDIS_CONNECT_RETRY = True
CELERY_SEND_EVENTS=True
#CELERY_RESULT_BACKEND='redis'
CELERY_TASK_RESULT_EXPIRES =  10
CELERYBEAT_SCHEDULER="djcelery.schedulers.DatabaseScheduler"
CELERY_ALWAYS_EAGER=False
BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 3600}

CELERY_TASK_RESULT_EXPIRES = 7*86400  # 7 days
CELERY_SEND_EVENTS = True
CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"
#CELERY_ACCEPT_CONTENT = ['application/json']
#CELERY_TASK_SERIALIZER = 'json'
#CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'Europe/Kiev'

from datetime import timedelta

CELERY_ALWAYS_EAGER=False
BROKER_BACKEND = "djkombu.transport.DatabaseTransport"

CELERYCAM_EXPIRE_SUCCESS = timedelta(days=30)
CELERYCAM_EXPIRE_ERROR = timedelta(days=7)
CELERYCAM_EXPIRE_PENDING = timedelta(days=7)

Once the flower worked, but the worker accepted the tasks, but did not want to execute them, now the worker works, but the flower refuses.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
un1t, 2016-05-11
@densaface

You specified -A for flower, but not for the worker.
Well, in general, you somehow strangely launch through manage.py
Try something like this
celery -A proj worker -l info
celery -A proj flower
Tutorial here
docs.celeryproject.org/en/latest/django/first-step...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question