We have a Python application that uses Celery, with RabbitMQ as the Broker. Think of this application as a management application and only puts messages/tasks into the Broker and won't be acting upon them.
There will be another application (which may or may not be Python based) which will be acting upon the messages.
Is it possible for the management application to put a message/task on a Queue when that task doesn't exist in it's codebase? If so, how would I go about this?
There is a more "Celery-esque" way called Signatures. Setup a Celery app pointing to the same broker and create a signature for your task:
from celery import Celery
celeryapp = Celery(...)
my_task = celeryapp.signature('task.add')
result = my_task.delay(2, 2)
print result.get()
Celery
or Import from a module.Call send_task()
method.
from twittershell.core import app # Celery Instance from a module
async_result = app.send_task(name='tasks.followers', args=(529675892, ))
The signature of send_task
method is:
def send_task(self, name, args=None, kwargs=None, countdown=None,
eta=None, task_id=None, producer=None, connection=None,
router=None, result_cls=None, expires=None,
publisher=None, link=None, link_error=None,
add_to_parent=True, reply_to=None, **options):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With