-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
54 lines (38 loc) · 1 KB
/
run.py
File metadata and controls
54 lines (38 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""myapp.py
Usage:
(window1)$ python myapp.py -l info
(window2)$ python
>>> from myapp import add
>>> add.delay(16, 16).get()
32
You can also specify the app to use with celeryd::
$ celeryd -l info --app=myapp.celery
"""
import sys
sys.path.insert(0,'lib')
sys.path.insert(0, 'lib/celery')
sys.path.insert(0, 'lib/kombu')
from celery import Celery
BROKER_BACKEND = 'redis'
BROKER_HOST = '127.0.0.1'
BROKER_PORT = 6379
BROKER_VHOST = '12'
CELERY_RESULT_BACKEND = "redis"
REDIS_HOST = '127.0.0.1'
REDIS_PORT = 6379
REDIS_DB = '100'
REDIS_CONNECT_RETRY = True
celery = Celery("myapp")
#celery.conf.update(BROKER_URL="amqp://guest:guest@localhost:5672//")
celery.conf.update(BROKER_BACKEND='redis')
celery.conf.update(BROKER_HOST='127.0.0.1')
celery.conf.update(BROKER_PORT=6379)
celery.conf.update(BROKER_VHOST='12')
print celery.conf
@celery.task
def add(x, y):
print 'i am doing work'
return x + y
if __name__ == "__main__":
import celery.bin.celeryd
celery.bin.celeryd.main()