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

Extending numpy mask
How to slice off 1 pixel layer from an image data array with numpy or similar
ImportError: No module named pkg_resources when I am trying to use py2exe
Need to check if an answer in a quiz is correct (Python)
NEURON python Graph() is blank
“canonical” way to use logging for Python asserts
IOError: [Errno 13] when specifying path for functions
How to specify the user data dir or profile dir (for cookies) in embedded Webkit?
django-tracking not working with django1.9
Astroquery SIMBAD : Obtaining data for diameter, mass, distance, luminosity and age of celestial object
Python- Module not having defined attribute
difference between two regular expressions: [abc]+ and ([abc])+
Model does not create a verion after deleting a foreign key model object (django-reversion)
How do I save the entire workspace in pandas (like RData)
Python: Read the content of a variable [duplicate]
How to use timeit for multiple values

Categories

HOME
rest
dotnetrdf
ajax
crystal-reports
freepascal
textwatcher
google-sheets-api
laravel-5.2
cocos2d-x-3.0
csvhelper
couchdb-2.0
webdav
phonegap-cli
adsense
spring-cloud-contract
pygame
proguard
actionscript-2
subquery
shipping
rfid
mongodb-query
dlib
equalizer
event-log
zend-framework-mvc
boolean-expression
jive
cruisecontrol.net
ghost-inspector
facebook4j
nsmenuitem
tarantool
restfb
novnc
tampermonkey
compare-and-swap
data-cleansing
ab-initio
autofill
roundcube
ioc-container
protobuf-net
apache-cloudstack
ifstream
geo
body-parser
salesforce-chatter
superpowered
powershell-remoting
pox
liquid-xml
office365connectors
alchemy.js
productivity
jdbi
python-idle
automator
onmouseover
number-theory
amazon-machine-learning
xmgrace
shutdown
ogre3d
iphone-developer-program
selenium-firefoxdriver
restivejs
laravel-query-builder
rsqlite
keycode
coremidi
alter
galleriffic
radians
spark-cassandra-connector
clob
wikitext
zuora
python-winshell
futuretask
integral
ffserver
ubercart
ctrlp
rhel5
microblaze
formvalidation-plugin
method-overriding
csplit
planetary.js
cppdepend
opensocial
modeshape
nservicebus4
robospice
onselect
ftp4j
carddav
backbone-relational
sharpmap
database-permissions
fieldset
moq-3
getstring
point-sprites
nintendo
cross-domain-policy
associative
port-scanning
ets
ruby-debug
osx-leopard
openvg
asp.net-mvc-controller
project-lifecycle
dotproject

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