I am having a problem getting my tasks to register. Here is my code, please help.
task.py
from celery_app import app
from celery import chord
from celery import signature
@app.task(bind=True)
def send_email(self):
chorded_tasks = chord(get_expired_users.s(),notify.s()) #these tasks actually exist#
chorded_tasks.get()
runthis.py
import celeryconfig
from celery import Celery
import os
celery = Celery()
celery.config_from_object("celeryconfig")
project_name = os.path.basename(os.getcwd())
celery.send_task(
"tasks.send_email".format(project_name),
kwargs={
},
args={
},
the code block above is what I am running. It will run fine but it wont actually do the tasks. I also have a file that runs this on a schedule and that works fine as well. I just don't understand why it wont run the actual tasks
I believe you are using wrong type for the
args
parameter. It should be a tuple or a list. In your example you are passing a dictionary as args parameter. That could cause the problem you are having. Considering that your task has no arguments something like the following should work:celery.send_task("tasks.send_email".format(project_name), (), kwargs={})