python


Celery - How to send task from remote machine?


We have a server running celery workers and a Redis queue. The tasks are defined on that server.
I need to be able to call these tasks from a remote machine.
I know that it is done using send_task but I still haven't figured out HOW? How do I tell send_task where the queue is? Where do I pass connection params (or whatever needed)? I've been looking for hours and all I can find is this:
from celery.execute import send_task
send_task('tasks.add')
Well, that means that I need celery on my calling machine as well. But what else do I need to set up?
This may be a way:
Creating a Celery object and using send_task from that object, the object can have the configuration to find the broker.
from celery import Celery
celery = Celery()
celery.config_from_object('celeryconfig')
celery.send_task('tasks.add', (2,2))
celeryconfig is a file containing the celery configuration, there are other ways set config on the celery object.
There are several ways to define routing rules, the most general of which is the custom router object. In all cases, the caller just provides a routing_key parameter in send_task, delay or apply_async and the router determines which queue to send the task into.
on the remote machine, start up celery with the broker_url pointing to the machine you want to run the tasks on. Then just submit the tasks (if you have specific queues to submit to, then add the appropriate routing keys).
What you found was right.
from celery.execute import send_task
send_task('tasks.add')
If any args needed
send_taks('tasks.add', kwargs={'a'=1, 'b'=2})

Related Links

sublime text + python's anaconda
Code python to check credit card and bank
How to retrieve the last characters from a remote text file using Python?
installing PyQt 5 on windows 7 with python 3.4
django powered website switches between logged in users
Using conda install within a python script
How to create a memory-mapped file in Python that is accessible from a called application?
Sorting and indexing between 2 numpy arrays
How to catch Exception and still proceed on with the task?
how to use dir() as default argument within a function [duplicate]
Python clear button
pyspark assigning name to column agg output [duplicate]
Python subclass interact to master class
Combining different names in a database
Insert into mysql python - not working
How to specify conda requirement file?

Categories

HOME
visual-studio-2015
symfony
uibutton
ocaml
backup
jasmine
search-engine
rfc
rocketmq
laravel-4
docker-windows
data-science-experience
avl-tree
codeblocks
internet-explorer-11
xcode8.3
onenote-api
facebook-javascript-sdk
eclipse-cdt
oclint
cortex-a
finite-group-theory
tee
qt-installer
uiview
symfony2-easyadmin
python-unicode
rhapsody
quartus
jcl
jconsole
countif
nsmenuitem
richfaces
piwik
rworldmap
go-cd
delete-file
jflex
croppic
bus-error
configure
bitcoin-testnet
pljson
openshift-enterprise
es-shell
fltk
onbackpressed
productivity
microdata
ivona
fastq
windows-firewall
gauss
heroku-postgres
iphone-developer-program
teiid
festival
vici
barcode-printing
nsfetchedresultscontrolle
mongoose-populate
spark-cassandra-connector
except
optionbutton
ninject.web.mvc
response-headers
calibration
crash-dumps
cpu-cores
gulp-livereload
adobe-indesign
subversion-edge
code-first-migrations
hana-xs
named-ranges
gmaps4rails
ibmsbt
yahoo-boss-api
spdy
map-force
jstack
factors
sim900
angulartics
confusion-matrix
nservicebus4
sslexception
nscolor
entity-framework-4.1
manage.py
sharpmap
qss
mvs
autostart
viewdidload
easygui
windows-live-id
ruby-debug
delegatecommand
openvg
integer-promotion
virtualquery
gears
weborb
writing

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App