what is it?

it is possible to have a worker listening on one instance and kick off a task on a different instance

example

on vm instance/container A

tasks.py
from celery import Celery
 
# REDIS_BROKER and REDIS_BACKEND is the address of the redis
# instance used for the task
app = Celery('tasks', backend=REDIS_BACKEND, broker=REDIS_BROKER)
 
@app.task(name='task_x')
def task_x(uid, resp_string):
	# do something
	return "foo"

run as a daemon or script: celery -A tasks worker --pool=gevent --concurrency=100 --loglevel=info

on vm instance/container B

kickoff.py
from celery import Celery
 
# same REDIS_BROKER and REDIS_BACKEND as used above
app = Celery('tasks', backend=REDIS_BACKEND, broker=REDIS_BROKER)
 
uid = "dummy_uid"
resp_string = "whatever"
 
task = app.send_task('task_x', args=(uid, resp_string))
 
# for tasks within tasks (not recommended) set disable_sync_subtasks
# to False
result = task.get(timeout=60, disable_sync_subtasks=True)