Answer the question
In order to leave comments, you need to log in
How to call a method in Django celery from code?
Good afternoon. I'm trying to create a task that should be called from the start of the walker and then called after a certain time. Here is the task code . When I start the walker, I get this:
[tasks]
. test_odoo.tasks.populate_db
[2019-04-11 09:59:24,102: INFO/MainProcess] Connected to amqp://guest:**@127.0.0.1:5672//
[2019-04-11 09:59:24,107: INFO/MainProcess] mingle: searching for neighbors
[2019-04-11 09:59:25,119: INFO/MainProcess] mingle: all alone
[2019-04-11 09:59:25,130: WARNING/MainProcess] /home/user/.virtualenvs/django/lib/python3.6/site-packages/celery/fixups/django.py:202: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments!
warnings.warn('Using settings.DEBUG leads to a memory leak, never '
[2019-04-11 09:59:25,130: INFO/MainProcess] [email protected] ready.
Answer the question
In order to leave comments, you need to log in
celerybeat
Specify which task to run and with what frequency:
CELERY_BEAT_SCHEDULE = {
'task_name': {
'task': 'app.module.task_name',
'schedule': timezone.timedelta(minutes=1),
}
}
from celery import shared_task
@shared_task
def task_name(*args, **kwargs):
pass
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question