Source

eggDiscover / documentation / build / celery.html

Full commit
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>The Celery Module &mdash; EggDiscover 0.1 documentation</title>
    
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="EggDiscover 0.1 documentation" href="index.html" />
    <link rel="up" title="External apps used in this project" href="externalapps.html" />
    <link rel="prev" title="The Twitter Module" href="twitter.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="twitter.html" title="The Twitter Module"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">EggDiscover 0.1 documentation</a> &raquo;</li>
          <li><a href="externalapps.html" accesskey="U">External apps used in this project</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-celery">
<span id="the-celery-module"></span><h1>The Celery Module<a class="headerlink" href="#module-celery" title="Permalink to this headline">¶</a></h1>
<p>Distributed Task Queue</p>
<span class="target" id="module-celery.app"></span><div class="section" id="celery-app">
<h2>celery.app<a class="headerlink" href="#celery-app" title="Permalink to this headline">¶</a></h2>
<p>Celery Application.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="celery.app.App">
<em class="property">class </em><tt class="descclassname">celery.app.</tt><tt class="descname">App</tt><big>(</big><em>main=None</em>, <em>loader=None</em>, <em>backend=None</em>, <em>amqp=None</em>, <em>events=None</em>, <em>log=None</em>, <em>control=None</em>, <em>set_as_current=True</em>, <em>accept_magic_kwargs=False</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/app.html#App"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.app.App" title="Permalink to this definition">¶</a></dt>
<dd><p>Celery Application.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>main</strong> &#8211; Name of the main module if running as <cite>__main__</cite>.</li>
<li><strong>loader</strong> &#8211; The loader class, or the name of the loader class to use.
Default is <tt class="xref py py-class docutils literal"><span class="pre">celery.loaders.app.AppLoader</span></tt>.</li>
<li><strong>backend</strong> &#8211; The result store backend class, or the name of the
backend class to use. Default is the value of the
<a href="#id1"><span class="problematic" id="id2">:setting:`CELERY_RESULT_BACKEND`</span></a> setting.</li>
<li><strong>amqp</strong> &#8211; AMQP object or class name.</li>
<li><strong>events</strong> &#8211; Events object or class name.</li>
<li><strong>log</strong> &#8211; Log object or class name.</li>
<li><strong>control</strong> &#8211; Control object or class name.</li>
<li><strong>set_as_current</strong> &#8211; Make this the global current app.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="celery.app.App.Beat">
<tt class="descname">Beat</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/app.html#App.Beat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.app.App.Beat" title="Permalink to this definition">¶</a></dt>
<dd><p>Create new <tt class="xref py py-class docutils literal"><span class="pre">Beat</span></tt> instance.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.app.App.Task">
<tt class="descname">Task</tt><a class="reference internal" href="_modules/celery/app.html#App.Task"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.app.App.Task" title="Permalink to this definition">¶</a></dt>
<dd><p>Default Task base class for this application.</p>
</dd></dl>

<dl class="method">
<dt id="celery.app.App.TaskSet">
<tt class="descname">TaskSet</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/app.html#App.TaskSet"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.app.App.TaskSet" title="Permalink to this definition">¶</a></dt>
<dd><p>Create new <tt class="xref py py-class docutils literal"><span class="pre">TaskSet</span></tt>.</p>
</dd></dl>

<dl class="method">
<dt id="celery.app.App.Worker">
<tt class="descname">Worker</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/app.html#App.Worker"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.app.App.Worker" title="Permalink to this definition">¶</a></dt>
<dd><p>Create new <tt class="xref py py-class docutils literal"><span class="pre">Worker</span></tt> instance.</p>
</dd></dl>

<dl class="method">
<dt id="celery.app.App.create_task_cls">
<tt class="descname">create_task_cls</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/app.html#App.create_task_cls"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.app.App.create_task_cls" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a base task class using default configuration
taken from this app.</p>
</dd></dl>

<dl class="method">
<dt id="celery.app.App.set_current">
<tt class="descname">set_current</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/app.html#App.set_current"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.app.App.set_current" title="Permalink to this definition">¶</a></dt>
<dd><p>Make this the current app for this thread.</p>
</dd></dl>

<dl class="method">
<dt id="celery.app.App.task">
<tt class="descname">task</tt><big>(</big><em>*args</em>, <em>**options</em><big>)</big><a class="reference internal" href="_modules/celery/app.html#App.task"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.app.App.task" title="Permalink to this definition">¶</a></dt>
<dd><p>Decorator to create a task class out of any callable.</p>
<div class="admonition-examples admonition">
<p class="first admonition-title">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="nd">@task</span><span class="p">()</span>
<span class="k">def</span> <span class="nf">refresh_feed</span><span class="p">(</span><span class="n">url</span><span class="p">):</span>
    <span class="k">return</span> <span class="n">Feed</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">url</span><span class="o">=</span><span class="n">url</span><span class="p">)</span><span class="o">.</span><span class="n">refresh</span><span class="p">()</span>
</pre></div>
</div>
<p>With setting extra options and using retry.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="nd">@task</span><span class="p">(</span><span class="n">exchange</span><span class="o">=</span><span class="s">&quot;feeds&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">refresh_feed</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
    <span class="k">try</span><span class="p">:</span>
        <span class="k">return</span> <span class="n">Feed</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">url</span><span class="o">=</span><span class="n">url</span><span class="p">)</span><span class="o">.</span><span class="n">refresh</span><span class="p">()</span>
    <span class="k">except</span> <span class="n">socket</span><span class="o">.</span><span class="n">error</span><span class="p">,</span> <span class="n">exc</span><span class="p">:</span>
        <span class="n">refresh_feed</span><span class="o">.</span><span class="n">retry</span><span class="p">(</span><span class="n">args</span><span class="o">=</span><span class="p">[</span><span class="n">url</span><span class="p">],</span> <span class="n">kwargs</span><span class="o">=</span><span class="n">kwargs</span><span class="p">,</span> <span class="n">exc</span><span class="o">=</span><span class="n">exc</span><span class="p">)</span>
</pre></div>
</div>
<p>Calling the resulting task:</p>
<div class="last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">refresh_feed</span><span class="p">(</span><span class="s">&quot;http://example.com/rss&quot;</span><span class="p">)</span> <span class="c"># Regular</span>
<span class="go">&lt;Feed: http://example.com/rss&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">refresh_feed</span><span class="o">.</span><span class="n">delay</span><span class="p">(</span><span class="s">&quot;http://example.com/rss&quot;</span><span class="p">)</span> <span class="c"># Async</span>
<span class="go">&lt;AsyncResult: 8998d0f4-da0b-4669-ba03-d5ab5ac6ad5d&gt;</span>
</pre></div>
</div>
</div>
</dd></dl>

<dl class="method">
<dt id="celery.app.App.worker_main">
<tt class="descname">worker_main</tt><big>(</big><em>argv=None</em><big>)</big><a class="reference internal" href="_modules/celery/app.html#App.worker_main"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.app.App.worker_main" title="Permalink to this definition">¶</a></dt>
<dd><p>Run <strong class="program">celeryd</strong> using <cite>argv</cite>.  Uses <a class="reference external" href="http://docs.python.org/library/sys.html#sys.argv" title="(in Python v2.7)"><tt class="xref py py-data docutils literal"><span class="pre">sys.argv</span></tt></a>
if <cite>argv</cite> is not specified.</p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="celery.app.app_or_default">
<tt class="descclassname">celery.app.</tt><tt class="descname">app_or_default</tt><big>(</big><em>app=None</em><big>)</big><a class="headerlink" href="#celery.app.app_or_default" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the app provided or the default app if none.</p>
<p>The environment variable <span class="target" id="index-0"></span><tt class="xref std std-envvar docutils literal"><span class="pre">CELERY_TRACE_APP</span></tt> is used to
trace app leaks.  When enabled an exception is raised if there
is no active app.</p>
</dd></dl>

<dl class="data">
<dt id="celery.app.default_app">
<tt class="descclassname">celery.app.</tt><tt class="descname">default_app</tt><em class="property"> = &lt;Celery: default:0x2ff63d0&gt;</em><a class="headerlink" href="#celery.app.default_app" title="Permalink to this definition">¶</a></dt>
<dd><p>Global fallback app instance.</p>
</dd></dl>

<dl class="data">
<dt id="celery.app.default_loader">
<tt class="descclassname">celery.app.</tt><tt class="descname">default_loader</tt><em class="property"> = 'default'</em><a class="headerlink" href="#celery.app.default_loader" title="Permalink to this definition">¶</a></dt>
<dd><p>The &#8220;default&#8221; loader is the default loader used by old applications.</p>
</dd></dl>

</div>
<span class="target" id="module-celery.beat"></span><div class="section" id="celery-beat">
<h2>celery.beat<a class="headerlink" href="#celery-beat" title="Permalink to this headline">¶</a></h2>
<p>The Celery periodic task scheduler.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
<dl class="function">
<dt id="celery.beat.EmbeddedService">
<tt class="descclassname">celery.beat.</tt><tt class="descname">EmbeddedService</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/beat.html#EmbeddedService"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.beat.EmbeddedService" title="Permalink to this definition">¶</a></dt>
<dd><p>Return embedded clock service.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>thread</strong> &#8211; Run threaded instead of as a separate process.
Default is <tt class="xref py py-const docutils literal"><span class="pre">False</span></tt>.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="celery.beat.ScheduleEntry">
<em class="property">class </em><tt class="descclassname">celery.beat.</tt><tt class="descname">ScheduleEntry</tt><big>(</big><em>name=None</em>, <em>task=None</em>, <em>last_run_at=None</em>, <em>total_run_count=None</em>, <em>schedule=None</em>, <em>args=()</em>, <em>kwargs={}</em>, <em>options={}</em>, <em>relative=False</em><big>)</big><a class="reference internal" href="_modules/celery/beat.html#ScheduleEntry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.beat.ScheduleEntry" title="Permalink to this definition">¶</a></dt>
<dd><p>An entry in the scheduler.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>name</strong> &#8211; see <a class="reference internal" href="#celery.beat.ScheduleEntry.name" title="celery.beat.ScheduleEntry.name"><tt class="xref py py-attr docutils literal"><span class="pre">name</span></tt></a>.</li>
<li><strong>schedule</strong> &#8211; see <a class="reference internal" href="#celery.beat.ScheduleEntry.schedule" title="celery.beat.ScheduleEntry.schedule"><tt class="xref py py-attr docutils literal"><span class="pre">schedule</span></tt></a>.</li>
<li><strong>args</strong> &#8211; see <a class="reference internal" href="#celery.beat.ScheduleEntry.args" title="celery.beat.ScheduleEntry.args"><tt class="xref py py-attr docutils literal"><span class="pre">args</span></tt></a>.</li>
<li><strong>kwargs</strong> &#8211; see <a class="reference internal" href="#celery.beat.ScheduleEntry.kwargs" title="celery.beat.ScheduleEntry.kwargs"><tt class="xref py py-attr docutils literal"><span class="pre">kwargs</span></tt></a>.</li>
<li><strong>options</strong> &#8211; see <a class="reference internal" href="#celery.beat.ScheduleEntry.options" title="celery.beat.ScheduleEntry.options"><tt class="xref py py-attr docutils literal"><span class="pre">options</span></tt></a>.</li>
<li><strong>last_run_at</strong> &#8211; see <a class="reference internal" href="#celery.beat.ScheduleEntry.last_run_at" title="celery.beat.ScheduleEntry.last_run_at"><tt class="xref py py-attr docutils literal"><span class="pre">last_run_at</span></tt></a>.</li>
<li><strong>total_run_count</strong> &#8211; see <a class="reference internal" href="#celery.beat.ScheduleEntry.total_run_count" title="celery.beat.ScheduleEntry.total_run_count"><tt class="xref py py-attr docutils literal"><span class="pre">total_run_count</span></tt></a>.</li>
<li><strong>relative</strong> &#8211; Is the time relative to when the server starts?</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="celery.beat.ScheduleEntry.args">
<tt class="descname">args</tt><em class="property"> = None</em><a class="headerlink" href="#celery.beat.ScheduleEntry.args" title="Permalink to this definition">¶</a></dt>
<dd><p>Positional arguments to apply.</p>
</dd></dl>

<dl class="method">
<dt id="celery.beat.ScheduleEntry.is_due">
<tt class="descname">is_due</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/beat.html#ScheduleEntry.is_due"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.beat.ScheduleEntry.is_due" title="Permalink to this definition">¶</a></dt>
<dd><p>See <tt class="xref py py-meth docutils literal"><span class="pre">celery.task.base.PeriodicTask.is_due()</span></tt>.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.beat.ScheduleEntry.kwargs">
<tt class="descname">kwargs</tt><em class="property"> = None</em><a class="headerlink" href="#celery.beat.ScheduleEntry.kwargs" title="Permalink to this definition">¶</a></dt>
<dd><p>Keyword arguments to apply.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.beat.ScheduleEntry.last_run_at">
<tt class="descname">last_run_at</tt><em class="property"> = None</em><a class="headerlink" href="#celery.beat.ScheduleEntry.last_run_at" title="Permalink to this definition">¶</a></dt>
<dd><p>The time and date of when this task was last scheduled.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.beat.ScheduleEntry.name">
<tt class="descname">name</tt><em class="property"> = None</em><a class="headerlink" href="#celery.beat.ScheduleEntry.name" title="Permalink to this definition">¶</a></dt>
<dd><p>The task name</p>
</dd></dl>

<dl class="method">
<dt id="celery.beat.ScheduleEntry.next">
<tt class="descname">next</tt><big>(</big><em>last_run_at=None</em><big>)</big><a class="headerlink" href="#celery.beat.ScheduleEntry.next" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a new instance of the same class, but with
its date and count fields updated.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.beat.ScheduleEntry.options">
<tt class="descname">options</tt><em class="property"> = None</em><a class="headerlink" href="#celery.beat.ScheduleEntry.options" title="Permalink to this definition">¶</a></dt>
<dd><p>Task execution options.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.beat.ScheduleEntry.schedule">
<tt class="descname">schedule</tt><em class="property"> = None</em><a class="headerlink" href="#celery.beat.ScheduleEntry.schedule" title="Permalink to this definition">¶</a></dt>
<dd><p>The schedule (run_every/crontab)</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.beat.ScheduleEntry.total_run_count">
<tt class="descname">total_run_count</tt><em class="property"> = 0</em><a class="headerlink" href="#celery.beat.ScheduleEntry.total_run_count" title="Permalink to this definition">¶</a></dt>
<dd><p>Total number of times this task has been scheduled.</p>
</dd></dl>

<dl class="method">
<dt id="celery.beat.ScheduleEntry.update">
<tt class="descname">update</tt><big>(</big><em>other</em><big>)</big><a class="reference internal" href="_modules/celery/beat.html#ScheduleEntry.update"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.beat.ScheduleEntry.update" title="Permalink to this definition">¶</a></dt>
<dd><p>Update values from another entry.</p>
<p>Does only update &#8220;editable&#8221; fields (task, schedule, args, kwargs,
options).</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="celery.beat.Scheduler">
<em class="property">class </em><tt class="descclassname">celery.beat.</tt><tt class="descname">Scheduler</tt><big>(</big><em>schedule=None</em>, <em>logger=None</em>, <em>max_interval=None</em>, <em>app=None</em>, <em>Publisher=None</em>, <em>lazy=False</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/beat.html#Scheduler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.beat.Scheduler" title="Permalink to this definition">¶</a></dt>
<dd><p>Scheduler for periodic tasks.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>schedule</strong> &#8211; see <a class="reference internal" href="#celery.beat.Scheduler.schedule" title="celery.beat.Scheduler.schedule"><tt class="xref py py-attr docutils literal"><span class="pre">schedule</span></tt></a>.</li>
<li><strong>logger</strong> &#8211; see <a class="reference internal" href="#celery.beat.Scheduler.logger" title="celery.beat.Scheduler.logger"><tt class="xref py py-attr docutils literal"><span class="pre">logger</span></tt></a>.</li>
<li><strong>max_interval</strong> &#8211; see <a class="reference internal" href="#celery.beat.Scheduler.max_interval" title="celery.beat.Scheduler.max_interval"><tt class="xref py py-attr docutils literal"><span class="pre">max_interval</span></tt></a>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="celery.beat.Scheduler.Entry">
<tt class="descname">Entry</tt><a class="headerlink" href="#celery.beat.Scheduler.Entry" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#celery.beat.ScheduleEntry" title="celery.beat.ScheduleEntry"><tt class="xref py py-class docutils literal"><span class="pre">ScheduleEntry</span></tt></a></p>
</dd></dl>

<dl class="attribute">
<dt id="celery.beat.Scheduler.logger">
<tt class="descname">logger</tt><em class="property"> = None</em><a class="headerlink" href="#celery.beat.Scheduler.logger" title="Permalink to this definition">¶</a></dt>
<dd><p>Current logger.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.beat.Scheduler.max_interval">
<tt class="descname">max_interval</tt><em class="property"> = 1</em><a class="headerlink" href="#celery.beat.Scheduler.max_interval" title="Permalink to this definition">¶</a></dt>
<dd><p>Maximum time to sleep between re-checking the schedule.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.beat.Scheduler.schedule">
<tt class="descname">schedule</tt><a class="reference internal" href="_modules/celery/beat.html#Scheduler.schedule"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.beat.Scheduler.schedule" title="Permalink to this definition">¶</a></dt>
<dd><p>The schedule dict/shelve.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.beat.Scheduler.sync_every">
<tt class="descname">sync_every</tt><em class="property"> = 180</em><a class="headerlink" href="#celery.beat.Scheduler.sync_every" title="Permalink to this definition">¶</a></dt>
<dd><p>How often to sync the schedule (3 minutes by default)</p>
</dd></dl>

<dl class="method">
<dt id="celery.beat.Scheduler.tick">
<tt class="descname">tick</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/beat.html#Scheduler.tick"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.beat.Scheduler.tick" title="Permalink to this definition">¶</a></dt>
<dd><p>Run a tick, that is one iteration of the scheduler.</p>
<p>Executes all due tasks.</p>
</dd></dl>

</dd></dl>

<dl class="exception">
<dt id="celery.beat.SchedulingError">
<em class="property">exception </em><tt class="descclassname">celery.beat.</tt><tt class="descname">SchedulingError</tt><a class="reference internal" href="_modules/celery/beat.html#SchedulingError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.beat.SchedulingError" title="Permalink to this definition">¶</a></dt>
<dd><p>An error occured while scheduling a task.</p>
</dd></dl>

</div>
<span class="target" id="module-celery.contrib"></span><span class="target" id="module-celery.datastructures"></span><div class="section" id="celery-datastructures">
<h2>celery.datastructures<a class="headerlink" href="#celery-datastructures" title="Permalink to this headline">¶</a></h2>
<p>Custom types and data structures.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="celery.datastructures.AttributeDict">
<em class="property">class </em><tt class="descclassname">celery.datastructures.</tt><tt class="descname">AttributeDict</tt><a class="reference internal" href="_modules/celery/datastructures.html#AttributeDict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.datastructures.AttributeDict" title="Permalink to this definition">¶</a></dt>
<dd><p>Dict subclass with attribute access.</p>
</dd></dl>

<dl class="class">
<dt id="celery.datastructures.AttributeDictMixin">
<em class="property">class </em><tt class="descclassname">celery.datastructures.</tt><tt class="descname">AttributeDictMixin</tt><a class="reference internal" href="_modules/celery/datastructures.html#AttributeDictMixin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.datastructures.AttributeDictMixin" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds attribute access to mappings.</p>
<p><cite>d.key -&gt; d[key]</cite></p>
</dd></dl>

<dl class="class">
<dt id="celery.datastructures.ConfigurationView">
<em class="property">class </em><tt class="descclassname">celery.datastructures.</tt><tt class="descname">ConfigurationView</tt><big>(</big><em>changes</em>, <em>defaults</em><big>)</big><a class="reference internal" href="_modules/celery/datastructures.html#ConfigurationView"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.datastructures.ConfigurationView" title="Permalink to this definition">¶</a></dt>
<dd><p>A view over an applications configuration dicts.</p>
<p>If the key does not exist in <tt class="docutils literal"><span class="pre">changes</span></tt>, the <tt class="docutils literal"><span class="pre">defaults</span></tt> dict
is consulted.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>changes</strong> &#8211; Dict containing changes to the configuration.</li>
<li><strong>defaults</strong> &#8211; Dict containing the default configuration.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="celery.datastructures.DictAttribute">
<em class="property">class </em><tt class="descclassname">celery.datastructures.</tt><tt class="descname">DictAttribute</tt><big>(</big><em>obj</em><big>)</big><a class="reference internal" href="_modules/celery/datastructures.html#DictAttribute"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.datastructures.DictAttribute" title="Permalink to this definition">¶</a></dt>
<dd><p>Dict interface to attributes.</p>
<p><cite>obj[k] -&gt; obj.k</cite></p>
</dd></dl>

<dl class="class">
<dt id="celery.datastructures.ExceptionInfo">
<em class="property">class </em><tt class="descclassname">celery.datastructures.</tt><tt class="descname">ExceptionInfo</tt><big>(</big><em>exc_info</em><big>)</big><a class="reference internal" href="_modules/celery/datastructures.html#ExceptionInfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.datastructures.ExceptionInfo" title="Permalink to this definition">¶</a></dt>
<dd><p>Exception wrapping an exception and its traceback.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>exc_info</strong> &#8211; The exception info tuple as returned by
<a class="reference external" href="http://docs.python.org/library/sys.html#sys.exc_info" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">sys.exc_info()</span></tt></a>.</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="celery.datastructures.ExceptionInfo.exception">
<tt class="descname">exception</tt><em class="property"> = None</em><a class="headerlink" href="#celery.datastructures.ExceptionInfo.exception" title="Permalink to this definition">¶</a></dt>
<dd><p>Exception instance.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.datastructures.ExceptionInfo.tb">
<tt class="descname">tb</tt><em class="property"> = None</em><a class="headerlink" href="#celery.datastructures.ExceptionInfo.tb" title="Permalink to this definition">¶</a></dt>
<dd><p>Pickleable traceback instance for use with <a class="reference external" href="http://docs.python.org/library/traceback.html#traceback" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">traceback</span></tt></a></p>
</dd></dl>

<dl class="attribute">
<dt id="celery.datastructures.ExceptionInfo.traceback">
<tt class="descname">traceback</tt><em class="property"> = None</em><a class="headerlink" href="#celery.datastructures.ExceptionInfo.traceback" title="Permalink to this definition">¶</a></dt>
<dd><p>String representation of the traceback.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.datastructures.ExceptionInfo.type">
<tt class="descname">type</tt><em class="property"> = None</em><a class="headerlink" href="#celery.datastructures.ExceptionInfo.type" title="Permalink to this definition">¶</a></dt>
<dd><p>Exception type.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="celery.datastructures.LRUCache">
<em class="property">class </em><tt class="descclassname">celery.datastructures.</tt><tt class="descname">LRUCache</tt><big>(</big><em>limit=None</em><big>)</big><a class="reference internal" href="_modules/celery/datastructures.html#LRUCache"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.datastructures.LRUCache" title="Permalink to this definition">¶</a></dt>
<dd><p>LRU Cache implementation using a doubly linked list to track access.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>limit</strong> &#8211; The maximum number of keys to keep in the cache.
When a new key is inserted and the limit has been exceeded,
the <em>Least Recently Used</em> key will be discarded from the
cache.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="celery.datastructures.LimitedSet">
<em class="property">class </em><tt class="descclassname">celery.datastructures.</tt><tt class="descname">LimitedSet</tt><big>(</big><em>maxlen=None</em>, <em>expires=None</em><big>)</big><a class="reference internal" href="_modules/celery/datastructures.html#LimitedSet"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.datastructures.LimitedSet" title="Permalink to this definition">¶</a></dt>
<dd><p>Kind-of Set with limitations.</p>
<p>Good for when you need to test for membership (<cite>a in set</cite>),
but the list might become to big, so you want to limit it so it doesn&#8217;t
consume too much resources.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>maxlen</strong> &#8211; Maximum number of members before we start
evicting expired members.</li>
<li><strong>expires</strong> &#8211; Time in seconds, before a membership expires.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="celery.datastructures.LimitedSet.add">
<tt class="descname">add</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/celery/datastructures.html#LimitedSet.add"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.datastructures.LimitedSet.add" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a new member.</p>
</dd></dl>

<dl class="method">
<dt id="celery.datastructures.LimitedSet.clear">
<tt class="descname">clear</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/datastructures.html#LimitedSet.clear"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.datastructures.LimitedSet.clear" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove all members</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.datastructures.LimitedSet.first">
<tt class="descname">first</tt><a class="reference internal" href="_modules/celery/datastructures.html#LimitedSet.first"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.datastructures.LimitedSet.first" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the oldest member.</p>
</dd></dl>

<dl class="method">
<dt id="celery.datastructures.LimitedSet.pop_value">
<tt class="descname">pop_value</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/celery/datastructures.html#LimitedSet.pop_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.datastructures.LimitedSet.pop_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove membership by finding value.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="celery.datastructures.TokenBucket">
<em class="property">class </em><tt class="descclassname">celery.datastructures.</tt><tt class="descname">TokenBucket</tt><big>(</big><em>fill_rate</em>, <em>capacity=1</em><big>)</big><a class="reference internal" href="_modules/celery/datastructures.html#TokenBucket"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.datastructures.TokenBucket" title="Permalink to this definition">¶</a></dt>
<dd><p>Token Bucket Algorithm.</p>
<p>See <a class="reference external" href="http://en.wikipedia.org/wiki/Token_Bucket">http://en.wikipedia.org/wiki/Token_Bucket</a>
Most of this code was stolen from an entry in the ASPN Python Cookbook:
<a class="reference external" href="http://code.activestate.com/recipes/511490/">http://code.activestate.com/recipes/511490/</a></p>
<div class="admonition-thread-safety admonition">
<p class="first admonition-title">Thread safety</p>
<p class="last">This implementation may not be thread safe.</p>
</div>
<dl class="method">
<dt id="celery.datastructures.TokenBucket.can_consume">
<tt class="descname">can_consume</tt><big>(</big><em>tokens=1</em><big>)</big><a class="reference internal" href="_modules/celery/datastructures.html#TokenBucket.can_consume"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.datastructures.TokenBucket.can_consume" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns <tt class="xref py py-const docutils literal"><span class="pre">True</span></tt> if <cite>tokens</cite> number of tokens can be consumed
from the bucket.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.datastructures.TokenBucket.capacity">
<tt class="descname">capacity</tt><em class="property"> = 1</em><a class="headerlink" href="#celery.datastructures.TokenBucket.capacity" title="Permalink to this definition">¶</a></dt>
<dd><p>Maximum number of tokensin the bucket.</p>
</dd></dl>

<dl class="method">
<dt id="celery.datastructures.TokenBucket.expected_time">
<tt class="descname">expected_time</tt><big>(</big><em>tokens=1</em><big>)</big><a class="reference internal" href="_modules/celery/datastructures.html#TokenBucket.expected_time"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.datastructures.TokenBucket.expected_time" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the expected time in seconds when a new token should be
available.</p>
<div class="admonition-warning admonition">
<p class="first admonition-title">Warning</p>
<p class="last">This consumes a token from the bucket.</p>
</div>
</dd></dl>

<dl class="attribute">
<dt id="celery.datastructures.TokenBucket.fill_rate">
<tt class="descname">fill_rate</tt><em class="property"> = None</em><a class="headerlink" href="#celery.datastructures.TokenBucket.fill_rate" title="Permalink to this definition">¶</a></dt>
<dd><p>The rate in tokens/second that the bucket will be refilled</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.datastructures.TokenBucket.timestamp">
<tt class="descname">timestamp</tt><em class="property"> = None</em><a class="headerlink" href="#celery.datastructures.TokenBucket.timestamp" title="Permalink to this definition">¶</a></dt>
<dd><p>Timestamp of the last time a token was taken out of the bucket.</p>
</dd></dl>

</dd></dl>

</div>
<span class="target" id="module-celery.db"></span><span class="target" id="module-celery.decorators"></span><div class="section" id="celery-decorators">
<h2>celery.decorators✞<a class="headerlink" href="#celery-decorators" title="Permalink to this headline">¶</a></h2>
<p>Deprecated decorators, use <cite>celery.task.task</cite>,
and <cite>celery.task.periodic_task</cite> instead.</p>
<p>The new decorators does not support magic keyword arguments.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
</div>
<span class="target" id="module-celery.events"></span><div class="section" id="celery-events">
<h2>celery.events<a class="headerlink" href="#celery-events" title="Permalink to this headline">¶</a></h2>
<p>Events are messages sent for actions happening
in the worker (and clients if <a href="#id3"><span class="problematic" id="id4">:setting:`CELERY_SEND_TASK_SENT_EVENT`</span></a>
is enabled), used for monitoring purposes.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
<dl class="function">
<dt id="celery.events.Event">
<tt class="descclassname">celery.events.</tt><tt class="descname">Event</tt><big>(</big><em>type</em>, <em>_fields=None</em>, <em>**fields</em><big>)</big><a class="reference internal" href="_modules/celery/events.html#Event"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.events.Event" title="Permalink to this definition">¶</a></dt>
<dd><p>Create an event.</p>
<p>An event is a dictionary, the only required field is <tt class="docutils literal"><span class="pre">type</span></tt>.</p>
</dd></dl>

<dl class="class">
<dt id="celery.events.EventDispatcher">
<em class="property">class </em><tt class="descclassname">celery.events.</tt><tt class="descname">EventDispatcher</tt><big>(</big><em>connection=None</em>, <em>hostname=None</em>, <em>enabled=True</em>, <em>channel=None</em>, <em>buffer_while_offline=True</em>, <em>app=None</em>, <em>serializer=None</em><big>)</big><a class="reference internal" href="_modules/celery/events.html#EventDispatcher"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.events.EventDispatcher" title="Permalink to this definition">¶</a></dt>
<dd><p>Send events as messages.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>connection</strong> &#8211; Connection to the broker.</li>
<li><strong>hostname</strong> &#8211; Hostname to identify ourselves as,
by default uses the hostname returned by <a class="reference external" href="http://docs.python.org/library/socket.html#socket.gethostname" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">socket.gethostname()</span></tt></a>.</li>
<li><strong>enabled</strong> &#8211; Set to <tt class="xref py py-const docutils literal"><span class="pre">False</span></tt> to not actually publish any events,
making <a class="reference internal" href="#celery.events.EventDispatcher.send" title="celery.events.EventDispatcher.send"><tt class="xref py py-meth docutils literal"><span class="pre">send()</span></tt></a> a noop operation.</li>
<li><strong>channel</strong> &#8211; Can be used instead of <cite>connection</cite> to specify
an exact channel to use when sending events.</li>
<li><strong>buffer_while_offline</strong> &#8211; If enabled events will be buffered
while the connection is down. <tt class="xref py py-meth docutils literal"><span class="pre">flush()</span></tt> must be called
as soon as the connection is re-established.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>You need to <a class="reference internal" href="#celery.events.EventDispatcher.close" title="celery.events.EventDispatcher.close"><tt class="xref py py-meth docutils literal"><span class="pre">close()</span></tt></a> this after use.</p>
<dl class="method">
<dt id="celery.events.EventDispatcher.close">
<tt class="descname">close</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/events.html#EventDispatcher.close"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.events.EventDispatcher.close" title="Permalink to this definition">¶</a></dt>
<dd><p>Close the event dispatcher.</p>
</dd></dl>

<dl class="method">
<dt id="celery.events.EventDispatcher.send">
<tt class="descname">send</tt><big>(</big><em>type</em>, <em>**fields</em><big>)</big><a class="reference internal" href="_modules/celery/events.html#EventDispatcher.send"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.events.EventDispatcher.send" title="Permalink to this definition">¶</a></dt>
<dd><p>Send event.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>type</strong> &#8211; Kind of event.</li>
<li><strong>**fields</strong> &#8211; Event arguments.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="celery.events.EventReceiver">
<em class="property">class </em><tt class="descclassname">celery.events.</tt><tt class="descname">EventReceiver</tt><big>(</big><em>connection</em>, <em>handlers=None</em>, <em>routing_key='#'</em>, <em>node_id=None</em>, <em>app=None</em><big>)</big><a class="reference internal" href="_modules/celery/events.html#EventReceiver"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.events.EventReceiver" title="Permalink to this definition">¶</a></dt>
<dd><p>Capture events.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>connection</strong> &#8211; Connection to the broker.</li>
<li><strong>handlers</strong> &#8211; Event handlers.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p><tt class="xref py py-attr docutils literal"><span class="pre">handlers</span></tt> is a dict of event types and their handlers,
the special handler <cite>&#8220;*&#8221;</cite> captures all events that doesn&#8217;t have a
handler.</p>
<dl class="method">
<dt id="celery.events.EventReceiver.capture">
<tt class="descname">capture</tt><big>(</big><em>limit=None</em>, <em>timeout=None</em>, <em>wakeup=True</em><big>)</big><a class="reference internal" href="_modules/celery/events.html#EventReceiver.capture"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.events.EventReceiver.capture" title="Permalink to this definition">¶</a></dt>
<dd><p>Open up a consumer capturing events.</p>
<p>This has to run in the main process, and it will never
stop unless forced via <tt class="xref py py-exc docutils literal"><span class="pre">KeyboardInterrupt</span></tt> or <tt class="xref py py-exc docutils literal"><span class="pre">SystemExit</span></tt>.</p>
</dd></dl>

<dl class="method">
<dt id="celery.events.EventReceiver.consumer">
<tt class="descname">consumer</tt><big>(</big><em>*args</em>, <em>**kwds</em><big>)</big><a class="reference internal" href="_modules/celery/events.html#EventReceiver.consumer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.events.EventReceiver.consumer" title="Permalink to this definition">¶</a></dt>
<dd><p>Create event consumer.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">This creates a new channel that needs to be closed
by calling <cite>consumer.channel.close()</cite>.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="celery.events.EventReceiver.process">
<tt class="descname">process</tt><big>(</big><em>type</em>, <em>event</em><big>)</big><a class="reference internal" href="_modules/celery/events.html#EventReceiver.process"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.events.EventReceiver.process" title="Permalink to this definition">¶</a></dt>
<dd><p>Process the received event by dispatching it to the appropriate
handler.</p>
</dd></dl>

</dd></dl>

</div>
<span class="target" id="module-celery.exceptions"></span><div class="section" id="celery-exceptions">
<h2>celery.exceptions<a class="headerlink" href="#celery-exceptions" title="Permalink to this headline">¶</a></h2>
<p>This module contains Celery-specific exceptions.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
<dl class="exception">
<dt id="celery.exceptions.AlreadyRegistered">
<em class="property">exception </em><tt class="descclassname">celery.exceptions.</tt><tt class="descname">AlreadyRegistered</tt><a class="reference internal" href="_modules/celery/exceptions.html#AlreadyRegistered"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.exceptions.AlreadyRegistered" title="Permalink to this definition">¶</a></dt>
<dd><p>The task is already registered.</p>
</dd></dl>

<dl class="exception">
<dt id="celery.exceptions.ImproperlyConfigured">
<em class="property">exception </em><tt class="descclassname">celery.exceptions.</tt><tt class="descname">ImproperlyConfigured</tt><a class="reference internal" href="_modules/celery/exceptions.html#ImproperlyConfigured"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.exceptions.ImproperlyConfigured" title="Permalink to this definition">¶</a></dt>
<dd><p>Celery is somehow improperly configured.</p>
</dd></dl>

<dl class="exception">
<dt id="celery.exceptions.MaxRetriesExceededError">
<em class="property">exception </em><tt class="descclassname">celery.exceptions.</tt><tt class="descname">MaxRetriesExceededError</tt><a class="reference internal" href="_modules/celery/exceptions.html#MaxRetriesExceededError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.exceptions.MaxRetriesExceededError" title="Permalink to this definition">¶</a></dt>
<dd><p>The tasks max restart limit has been exceeded.</p>
</dd></dl>

<dl class="exception">
<dt id="celery.exceptions.NotConfigured">
<em class="property">exception </em><tt class="descclassname">celery.exceptions.</tt><tt class="descname">NotConfigured</tt><a class="reference internal" href="_modules/celery/exceptions.html#NotConfigured"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.exceptions.NotConfigured" title="Permalink to this definition">¶</a></dt>
<dd><p>Celery has not been configured, as no config module has been found.</p>
</dd></dl>

<dl class="exception">
<dt id="celery.exceptions.NotRegistered">
<em class="property">exception </em><tt class="descclassname">celery.exceptions.</tt><tt class="descname">NotRegistered</tt><a class="reference internal" href="_modules/celery/exceptions.html#NotRegistered"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.exceptions.NotRegistered" title="Permalink to this definition">¶</a></dt>
<dd><p>The task is not registered.</p>
</dd></dl>

<dl class="exception">
<dt id="celery.exceptions.QueueNotFound">
<em class="property">exception </em><tt class="descclassname">celery.exceptions.</tt><tt class="descname">QueueNotFound</tt><a class="reference internal" href="_modules/celery/exceptions.html#QueueNotFound"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.exceptions.QueueNotFound" title="Permalink to this definition">¶</a></dt>
<dd><p>Task routed to a queue not in CELERY_QUEUES.</p>
</dd></dl>

<dl class="exception">
<dt id="celery.exceptions.RetryTaskError">
<em class="property">exception </em><tt class="descclassname">celery.exceptions.</tt><tt class="descname">RetryTaskError</tt><big>(</big><em>message</em>, <em>exc</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/exceptions.html#RetryTaskError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.exceptions.RetryTaskError" title="Permalink to this definition">¶</a></dt>
<dd><p>The task is to be retried later.</p>
</dd></dl>

<dl class="exception">
<dt id="celery.exceptions.SoftTimeLimitExceeded">
<em class="property">exception </em><tt class="descclassname">celery.exceptions.</tt><tt class="descname">SoftTimeLimitExceeded</tt><a class="reference internal" href="_modules/celery/exceptions.html#SoftTimeLimitExceeded"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.exceptions.SoftTimeLimitExceeded" title="Permalink to this definition">¶</a></dt>
<dd><p>The soft time limit has been exceeded. This exception is raised
to give the task a chance to clean up.</p>
</dd></dl>

<dl class="exception">
<dt id="celery.exceptions.SystemTerminate">
<em class="property">exception </em><tt class="descclassname">celery.exceptions.</tt><tt class="descname">SystemTerminate</tt><a class="reference internal" href="_modules/celery/exceptions.html#SystemTerminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.exceptions.SystemTerminate" title="Permalink to this definition">¶</a></dt>
<dd><p>Signals that the worker should terminate.</p>
</dd></dl>

<dl class="exception">
<dt id="celery.exceptions.TaskRevokedError">
<em class="property">exception </em><tt class="descclassname">celery.exceptions.</tt><tt class="descname">TaskRevokedError</tt><a class="reference internal" href="_modules/celery/exceptions.html#TaskRevokedError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.exceptions.TaskRevokedError" title="Permalink to this definition">¶</a></dt>
<dd><p>The task has been revoked, so no result available.</p>
</dd></dl>

<dl class="exception">
<dt id="celery.exceptions.TimeLimitExceeded">
<em class="property">exception </em><tt class="descclassname">celery.exceptions.</tt><tt class="descname">TimeLimitExceeded</tt><a class="reference internal" href="_modules/celery/exceptions.html#TimeLimitExceeded"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.exceptions.TimeLimitExceeded" title="Permalink to this definition">¶</a></dt>
<dd><p>The time limit has been exceeded and the job has been terminated.</p>
</dd></dl>

<dl class="exception">
<dt id="celery.exceptions.TimeoutError">
<em class="property">exception </em><tt class="descclassname">celery.exceptions.</tt><tt class="descname">TimeoutError</tt><a class="reference internal" href="_modules/celery/exceptions.html#TimeoutError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.exceptions.TimeoutError" title="Permalink to this definition">¶</a></dt>
<dd><p>The operation timed out.</p>
</dd></dl>

<dl class="exception">
<dt id="celery.exceptions.WorkerLostError">
<em class="property">exception </em><tt class="descclassname">celery.exceptions.</tt><tt class="descname">WorkerLostError</tt><a class="reference internal" href="_modules/celery/exceptions.html#WorkerLostError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.exceptions.WorkerLostError" title="Permalink to this definition">¶</a></dt>
<dd><p>The worker processing a job has exited prematurely.</p>
</dd></dl>

</div>
<span class="target" id="module-celery.execute"></span><dl class="function">
<dt id="celery.execute.apply">
<tt class="descclassname">celery.execute.</tt><tt class="descname">apply</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/execute.html#apply"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.execute.apply" title="Permalink to this definition">¶</a></dt>
<dd><p><em>[Deprecated]</em> Use <cite>task.apply()</cite></p>
</dd></dl>

<dl class="function">
<dt id="celery.execute.apply_async">
<tt class="descclassname">celery.execute.</tt><tt class="descname">apply_async</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/execute.html#apply_async"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.execute.apply_async" title="Permalink to this definition">¶</a></dt>
<dd><p><em>[Deprecated]</em> Use <cite>task.apply_async()</cite></p>
</dd></dl>

<span class="target" id="module-celery.loaders"></span><div class="section" id="celery-loaders">
<h2>celery.loaders<a class="headerlink" href="#celery-loaders" title="Permalink to this headline">¶</a></h2>
<p>Loaders define how configuration is read, what happens
when workers start, when tasks are executed and so on.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
<dl class="function">
<dt id="celery.loaders.get_loader_cls">
<tt class="descclassname">celery.loaders.</tt><tt class="descname">get_loader_cls</tt><big>(</big><em>loader</em><big>)</big><a class="reference internal" href="_modules/celery/loaders.html#get_loader_cls"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.loaders.get_loader_cls" title="Permalink to this definition">¶</a></dt>
<dd><p>Get loader class by name/alias</p>
</dd></dl>

</div>
<span class="target" id="module-celery.local"></span><div class="section" id="celery-local">
<h2>celery.local<a class="headerlink" href="#celery-local" title="Permalink to this headline">¶</a></h2>
<p>This module contains critical utilities that
needs to be loaded as soon as possible, and that
shall not load any third party modules.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="celery.local.Proxy">
<em class="property">class </em><tt class="descclassname">celery.local.</tt><tt class="descname">Proxy</tt><big>(</big><em>local</em>, <em>name=None</em><big>)</big><a class="reference internal" href="_modules/celery/local.html#Proxy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.local.Proxy" title="Permalink to this definition">¶</a></dt>
<dd><p>Proxy to another object.</p>
</dd></dl>

<dl class="function">
<dt id="celery.local.try_import">
<tt class="descclassname">celery.local.</tt><tt class="descname">try_import</tt><big>(</big><em>module</em><big>)</big><a class="reference internal" href="_modules/celery/local.html#try_import"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.local.try_import" title="Permalink to this definition">¶</a></dt>
<dd><p>Try to import and return module, or return
None if the module does not exist.</p>
</dd></dl>

</div>
<span class="target" id="module-celery.log"></span><dl class="class">
<dt id="celery.log.LoggingProxy">
<em class="property">class </em><tt class="descclassname">celery.log.</tt><tt class="descname">LoggingProxy</tt><big>(</big><em>logger</em>, <em>loglevel=None</em><big>)</big><a class="reference internal" href="_modules/celery/log.html#LoggingProxy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.log.LoggingProxy" title="Permalink to this definition">¶</a></dt>
<dd><p>Forward file object to <a class="reference external" href="http://docs.python.org/library/logging.html#logging.Logger" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">logging.Logger</span></tt></a> instance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>logger</strong> &#8211; The <a class="reference external" href="http://docs.python.org/library/logging.html#logging.Logger" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">logging.Logger</span></tt></a> instance to forward to.</li>
<li><strong>loglevel</strong> &#8211; Loglevel to use when writing messages.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="celery.log.LoggingProxy.close">
<tt class="descname">close</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/log.html#LoggingProxy.close"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.log.LoggingProxy.close" title="Permalink to this definition">¶</a></dt>
<dd><p>When the object is closed, no write requests are forwarded to
the logging object anymore.</p>
</dd></dl>

<dl class="method">
<dt id="celery.log.LoggingProxy.flush">
<tt class="descname">flush</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/log.html#LoggingProxy.flush"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.log.LoggingProxy.flush" title="Permalink to this definition">¶</a></dt>
<dd><p>This object is not buffered so any <a class="reference internal" href="#celery.log.LoggingProxy.flush" title="celery.log.LoggingProxy.flush"><tt class="xref py py-meth docutils literal"><span class="pre">flush()</span></tt></a> requests
are ignored.</p>
</dd></dl>

<dl class="method">
<dt id="celery.log.LoggingProxy.isatty">
<tt class="descname">isatty</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/log.html#LoggingProxy.isatty"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.log.LoggingProxy.isatty" title="Permalink to this definition">¶</a></dt>
<dd><p>Always returns <tt class="xref py py-const docutils literal"><span class="pre">False</span></tt>. Just here for file support.</p>
</dd></dl>

<dl class="method">
<dt id="celery.log.LoggingProxy.writelines">
<tt class="descname">writelines</tt><big>(</big><em>sequence</em><big>)</big><a class="reference internal" href="_modules/celery/log.html#LoggingProxy.writelines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.log.LoggingProxy.writelines" title="Permalink to this definition">¶</a></dt>
<dd><p><cite>writelines(sequence_of_strings) -&gt; None</cite>.</p>
<p>Write the strings to the file.</p>
<p>The sequence can be any iterable object producing strings.
This is equivalent to calling <tt class="xref py py-meth docutils literal"><span class="pre">write()</span></tt> for each string.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="celery.log.SilenceRepeated">
<em class="property">class </em><tt class="descclassname">celery.log.</tt><tt class="descname">SilenceRepeated</tt><big>(</big><em>action</em>, <em>max_iterations=10</em><big>)</big><a class="reference internal" href="_modules/celery/log.html#SilenceRepeated"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.log.SilenceRepeated" title="Permalink to this definition">¶</a></dt>
<dd><p>Only log action every n iterations.</p>
</dd></dl>

<span class="target" id="module-celery.messaging"></span><p>This module is deprecated, use <tt class="docutils literal"><span class="pre">current_app.amqp</span></tt> instead.</p>
<span class="target" id="module-celery.platforms"></span><div class="section" id="celery-platforms">
<h2>celery.platforms<a class="headerlink" href="#celery-platforms" title="Permalink to this headline">¶</a></h2>
<p>Utilities dealing with platform specifics: signals, daemonization,
users, groups, and so on.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
<dl class="exception">
<dt id="celery.platforms.LockFailed">
<em class="property">exception </em><tt class="descclassname">celery.platforms.</tt><tt class="descname">LockFailed</tt><a class="reference internal" href="_modules/celery/platforms.html#LockFailed"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.LockFailed" title="Permalink to this definition">¶</a></dt>
<dd><p>Raised if a pidlock can&#8217;t be acquired.</p>
</dd></dl>

<dl class="class">
<dt id="celery.platforms.PIDFile">
<em class="property">class </em><tt class="descclassname">celery.platforms.</tt><tt class="descname">PIDFile</tt><big>(</big><em>path</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#PIDFile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.PIDFile" title="Permalink to this definition">¶</a></dt>
<dd><p>PID lock file.</p>
<p>This is the type returned by <a class="reference internal" href="#celery.platforms.create_pidlock" title="celery.platforms.create_pidlock"><tt class="xref py py-func docutils literal"><span class="pre">create_pidlock()</span></tt></a>.</p>
<p><strong>Should not be used directly, use the :func:`create_pidlock`
context instead</strong></p>
<dl class="method">
<dt id="celery.platforms.PIDFile.acquire">
<tt class="descname">acquire</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#PIDFile.acquire"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.PIDFile.acquire" title="Permalink to this definition">¶</a></dt>
<dd><p>Acquire lock.</p>
</dd></dl>

<dl class="method">
<dt id="celery.platforms.PIDFile.is_locked">
<tt class="descname">is_locked</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#PIDFile.is_locked"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.PIDFile.is_locked" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns true if the pid lock exists.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.platforms.PIDFile.path">
<tt class="descname">path</tt><em class="property"> = None</em><a class="headerlink" href="#celery.platforms.PIDFile.path" title="Permalink to this definition">¶</a></dt>
<dd><p>Path to the pid lock file.</p>
</dd></dl>

<dl class="method">
<dt id="celery.platforms.PIDFile.read_pid">
<tt class="descname">read_pid</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#PIDFile.read_pid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.PIDFile.read_pid" title="Permalink to this definition">¶</a></dt>
<dd><p>Reads and returns the current pid.</p>
</dd></dl>

<dl class="method">
<dt id="celery.platforms.PIDFile.release">
<tt class="descname">release</tt><big>(</big><em>*args</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#PIDFile.release"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.PIDFile.release" title="Permalink to this definition">¶</a></dt>
<dd><p>Release lock.</p>
</dd></dl>

<dl class="method">
<dt id="celery.platforms.PIDFile.remove">
<tt class="descname">remove</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#PIDFile.remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.PIDFile.remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Removes the lock.</p>
</dd></dl>

<dl class="method">
<dt id="celery.platforms.PIDFile.remove_if_stale">
<tt class="descname">remove_if_stale</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#PIDFile.remove_if_stale"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.PIDFile.remove_if_stale" title="Permalink to this definition">¶</a></dt>
<dd><p>Removes the lock if the process is not running.
(does not respond to signals).</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="celery.platforms.Signals">
<em class="property">class </em><tt class="descclassname">celery.platforms.</tt><tt class="descname">Signals</tt><a class="reference internal" href="_modules/celery/platforms.html#Signals"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.Signals" title="Permalink to this definition">¶</a></dt>
<dd><p>Convenience interface to <tt class="xref py py-mod docutils literal"><span class="pre">signals</span></tt>.</p>
<p>If the requested signal is not supported on the current platform,
the operation will be ignored.</p>
<p><strong>Examples</strong>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">celery.platforms</span> <span class="kn">import</span> <span class="n">signals</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">signals</span><span class="p">[</span><span class="s">&quot;INT&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">my_handler</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">signals</span><span class="p">[</span><span class="s">&quot;INT&quot;</span><span class="p">]</span>
<span class="go">my_handler</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">signals</span><span class="o">.</span><span class="n">supported</span><span class="p">(</span><span class="s">&quot;INT&quot;</span><span class="p">)</span>
<span class="go">True</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">signals</span><span class="o">.</span><span class="n">signum</span><span class="p">(</span><span class="s">&quot;INT&quot;</span><span class="p">)</span>
<span class="go">2</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">signals</span><span class="o">.</span><span class="n">ignore</span><span class="p">(</span><span class="s">&quot;USR1&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">signals</span><span class="p">[</span><span class="s">&quot;USR1&quot;</span><span class="p">]</span> <span class="o">==</span> <span class="n">signals</span><span class="o">.</span><span class="n">ignored</span>
<span class="go">True</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">signals</span><span class="o">.</span><span class="n">reset</span><span class="p">(</span><span class="s">&quot;USR1&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">signals</span><span class="p">[</span><span class="s">&quot;USR1&quot;</span><span class="p">]</span> <span class="o">==</span> <span class="n">signals</span><span class="o">.</span><span class="n">default</span>
<span class="go">True</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">signals</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">INT</span><span class="o">=</span><span class="n">exit_handler</span><span class="p">,</span>
<span class="gp">... </span>               <span class="n">TERM</span><span class="o">=</span><span class="n">exit_handler</span><span class="p">,</span>
<span class="gp">... </span>               <span class="n">HUP</span><span class="o">=</span><span class="n">hup_handler</span><span class="p">)</span>
</pre></div>
</div>
<dl class="method">
<dt id="celery.platforms.Signals.ignore">
<tt class="descname">ignore</tt><big>(</big><em>*signal_names</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#Signals.ignore"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.Signals.ignore" title="Permalink to this definition">¶</a></dt>
<dd><p>Ignore signal using <tt class="xref py py-const docutils literal"><span class="pre">SIG_IGN</span></tt>.</p>
<p>Does nothing if the platform doesn&#8217;t support signals,
or the specified signal in particular.</p>
</dd></dl>

<dl class="method">
<dt id="celery.platforms.Signals.reset">
<tt class="descname">reset</tt><big>(</big><em>*signal_names</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#Signals.reset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.Signals.reset" title="Permalink to this definition">¶</a></dt>
<dd><p>Reset signals to the default signal handler.</p>
<p>Does nothing if the platform doesn&#8217;t support signals,
or the specified signal in particular.</p>
</dd></dl>

<dl class="method">
<dt id="celery.platforms.Signals.signum">
<tt class="descname">signum</tt><big>(</big><em>signal_name</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#Signals.signum"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.Signals.signum" title="Permalink to this definition">¶</a></dt>
<dd><p>Get signal number from signal name.</p>
</dd></dl>

<dl class="method">
<dt id="celery.platforms.Signals.supported">
<tt class="descname">supported</tt><big>(</big><em>signal_name</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#Signals.supported"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.Signals.supported" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns true value if <tt class="docutils literal"><span class="pre">signal_name</span></tt> exists on this platform.</p>
</dd></dl>

<dl class="method">
<dt id="celery.platforms.Signals.update">
<tt class="descname">update</tt><big>(</big><em>_d_=None</em>, <em>**sigmap</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#Signals.update"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.Signals.update" title="Permalink to this definition">¶</a></dt>
<dd><p>Set signal handlers from a mapping.</p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="celery.platforms.create_pidlock">
<tt class="descclassname">celery.platforms.</tt><tt class="descname">create_pidlock</tt><big>(</big><em>pidfile</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#create_pidlock"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.create_pidlock" title="Permalink to this definition">¶</a></dt>
<dd><p>Create and verify pid file.</p>
<p>If the pid file already exists the program exits with an error message,
however if the process it refers to is not running anymore, the pid file
is deleted and the program continues.</p>
<p>The caller is responsible for releasing the lock before the program
exits.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference internal" href="#celery.platforms.PIDFile" title="celery.platforms.PIDFile"><tt class="xref py py-class docutils literal"><span class="pre">PIDFile</span></tt></a>.</td>
</tr>
</tbody>
</table>
<p><strong>Example</strong>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">atexit</span>
<span class="n">pidlock</span> <span class="o">=</span> <span class="n">create_pidlock</span><span class="p">(</span><span class="s">&quot;/var/run/app.pid&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">acquire</span><span class="p">()</span>
<span class="n">atexit</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="n">pidlock</span><span class="o">.</span><span class="n">release</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="celery.platforms.detached">
<tt class="descclassname">celery.platforms.</tt><tt class="descname">detached</tt><big>(</big><em>logfile=None</em>, <em>pidfile=None</em>, <em>uid=None</em>, <em>gid=None</em>, <em>umask=0</em>, <em>workdir=None</em>, <em>**opts</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#detached"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.detached" title="Permalink to this definition">¶</a></dt>
<dd><p>Detach the current process in the background (daemonize).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>logfile</strong> &#8211; Optional log file.  The ability to write to this file
will be verified before the process is detached.</li>
<li><strong>pidfile</strong> &#8211; Optional pid file.  The pid file will not be created,
as this is the responsibility of the child.  But the process will
exit if the pid lock exists and the pid written is still running.</li>
<li><strong>uid</strong> &#8211; Optional user id or user name to change
effective privileges to.</li>
<li><strong>gid</strong> &#8211; Optional group id or group name to change effective
privileges to.</li>
<li><strong>umask</strong> &#8211; Optional umask that will be effective in the child process.</li>
<li><strong>workdir</strong> &#8211; Optional new working directory.</li>
<li><strong>**opts</strong> &#8211; Ignored.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p><strong>Example</strong>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">atexit</span>
<span class="kn">from</span> <span class="nn">celery.platforms</span> <span class="kn">import</span> <span class="n">detached</span><span class="p">,</span> <span class="n">create_pidlock</span>

<span class="k">with</span> <span class="n">detached</span><span class="p">(</span><span class="n">logfile</span><span class="o">=</span><span class="s">&quot;/var/log/app.log&quot;</span><span class="p">,</span> <span class="n">pidfile</span><span class="o">=</span><span class="s">&quot;/var/run/app.pid&quot;</span><span class="p">,</span>
              <span class="n">uid</span><span class="o">=</span><span class="s">&quot;nobody&quot;</span><span class="p">):</span>
    <span class="c"># Now in detached child process with effective user set to nobody,</span>
    <span class="c"># and we know that our logfile can be written to, and that</span>
    <span class="c"># the pidfile is not locked.</span>
    <span class="n">pidlock</span> <span class="o">=</span> <span class="n">create_pidlock</span><span class="p">(</span><span class="s">&quot;/var/run/app.pid&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">acquire</span><span class="p">()</span>
    <span class="n">atexit</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="n">pidlock</span><span class="o">.</span><span class="n">release</span><span class="p">)</span>

    <span class="c"># Run the program</span>
    <span class="n">program</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">logfile</span><span class="o">=</span><span class="s">&quot;/var/log/app.log&quot;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="celery.platforms.get_fdmax">
<tt class="descclassname">celery.platforms.</tt><tt class="descname">get_fdmax</tt><big>(</big><em>default=None</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#get_fdmax"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.get_fdmax" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the maximum number of open file descriptors
on this system.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>default</strong> &#8211; Value returned if there&#8217;s no file
descriptor limit.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="celery.platforms.parse_gid">
<tt class="descclassname">celery.platforms.</tt><tt class="descname">parse_gid</tt><big>(</big><em>gid</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#parse_gid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.parse_gid" title="Permalink to this definition">¶</a></dt>
<dd><p>Parse group id.</p>
<p>gid can be an integer (gid) or a string (group name), if a group name
the gid is taken from the password file.</p>
</dd></dl>

<dl class="function">
<dt id="celery.platforms.parse_uid">
<tt class="descclassname">celery.platforms.</tt><tt class="descname">parse_uid</tt><big>(</big><em>uid</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#parse_uid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.parse_uid" title="Permalink to this definition">¶</a></dt>
<dd><p>Parse user id.</p>
<p>uid can be an integer (uid) or a string (user name), if a user name
the uid is taken from the password file.</p>
</dd></dl>

<dl class="function">
<dt id="celery.platforms.set_effective_user">
<tt class="descclassname">celery.platforms.</tt><tt class="descname">set_effective_user</tt><big>(</big><em>uid=None</em>, <em>gid=None</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#set_effective_user"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.set_effective_user" title="Permalink to this definition">¶</a></dt>
<dd><p>Change process privileges to new user/group.</p>
<p>If UID and GID is set the effective user/group is set.</p>
<p>If only UID is set, the effective user is set, and the group is
set to the users primary group.</p>
<p>If only GID is set, the effective group is set.</p>
</dd></dl>

<dl class="function">
<dt id="celery.platforms.set_mp_process_title">
<tt class="descclassname">celery.platforms.</tt><tt class="descname">set_mp_process_title</tt><big>(</big><em>progname</em>, <em>info=None</em>, <em>hostname=None</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#set_mp_process_title"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.set_mp_process_title" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the ps name using the multiprocessing process name.</p>
<p>Only works if <tt class="xref py py-mod docutils literal"><span class="pre">setproctitle</span></tt> is installed.</p>
</dd></dl>

<dl class="function">
<dt id="celery.platforms.set_process_title">
<tt class="descclassname">celery.platforms.</tt><tt class="descname">set_process_title</tt><big>(</big><em>progname</em>, <em>info=None</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#set_process_title"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.set_process_title" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the ps name for the currently running process.</p>
<p>Only works if <tt class="xref py py-mod docutils literal"><span class="pre">setproctitle</span></tt> is installed.</p>
</dd></dl>

<dl class="function">
<dt id="celery.platforms.setegid">
<tt class="descclassname">celery.platforms.</tt><tt class="descname">setegid</tt><big>(</big><em>gid</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#setegid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.setegid" title="Permalink to this definition">¶</a></dt>
<dd><p>Set effective group id.</p>
</dd></dl>

<dl class="function">
<dt id="celery.platforms.seteuid">
<tt class="descclassname">celery.platforms.</tt><tt class="descname">seteuid</tt><big>(</big><em>uid</em><big>)</big><a class="reference internal" href="_modules/celery/platforms.html#seteuid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.platforms.seteuid" title="Permalink to this definition">¶</a></dt>
<dd><p>Set effective user id.</p>
</dd></dl>

</div>
<span class="target" id="module-celery.registry"></span><div class="section" id="celery-registry">
<h2>celery.registry<a class="headerlink" href="#celery-registry" title="Permalink to this headline">¶</a></h2>
<p>Registry of available tasks.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
<dl class="data">
<dt id="celery.registry.tasks">
<tt class="descclassname">celery.registry.</tt><tt class="descname">tasks</tt><em class="property"> = {'celery.chord_unlock': &lt;&#64;task: celery.chord_unlock&gt;, 'celery.backend_cleanup': &lt;&#64;task: celery.backend_cleanup&gt;, 'celery.chord': &lt;&#64;task: celery.chord&gt;, 'celery.ping': &lt;&#64;task: celery.ping&gt;}</em><a class="headerlink" href="#celery.registry.tasks" title="Permalink to this definition">¶</a></dt>
<dd><p>Global task registry.</p>
</dd></dl>

</div>
<span class="target" id="module-celery.routes"></span><div class="section" id="celery-routes">
<h2>celery.routes<a class="headerlink" href="#celery-routes" title="Permalink to this headline">¶</a></h2>
<p>Contains utilities for working with task routes
(<a href="#id5"><span class="problematic" id="id6">:setting:`CELERY_ROUTES`</span></a>).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="celery.routes.MapRoute">
<em class="property">class </em><tt class="descclassname">celery.routes.</tt><tt class="descname">MapRoute</tt><big>(</big><em>map</em><big>)</big><a class="reference internal" href="_modules/celery/routes.html#MapRoute"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.routes.MapRoute" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a router out of a <a class="reference external" href="http://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">dict</span></tt></a>.</p>
</dd></dl>

<dl class="function">
<dt id="celery.routes.prepare">
<tt class="descclassname">celery.routes.</tt><tt class="descname">prepare</tt><big>(</big><em>routes</em><big>)</big><a class="reference internal" href="_modules/celery/routes.html#prepare"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.routes.prepare" title="Permalink to this definition">¶</a></dt>
<dd><p>Expands the <a href="#id7"><span class="problematic" id="id8">:setting:`CELERY_ROUTES`</span></a> setting.</p>
</dd></dl>

</div>
<span class="target" id="module-celery.schedules"></span><div class="section" id="celery-schedules">
<h2>celery.schedules<a class="headerlink" href="#celery-schedules" title="Permalink to this headline">¶</a></h2>
<p>Schedules define the intervals at which periodic tasks
should run.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
<dl class="exception">
<dt id="celery.schedules.ParseException">
<em class="property">exception </em><tt class="descclassname">celery.schedules.</tt><tt class="descname">ParseException</tt><a class="reference internal" href="_modules/celery/schedules.html#ParseException"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.schedules.ParseException" title="Permalink to this definition">¶</a></dt>
<dd><p>Raised by crontab_parser when the input can&#8217;t be parsed.</p>
</dd></dl>

<dl class="class">
<dt id="celery.schedules.crontab">
<em class="property">class </em><tt class="descclassname">celery.schedules.</tt><tt class="descname">crontab</tt><big>(</big><em>minute='*'</em>, <em>hour='*'</em>, <em>day_of_week='*'</em>, <em>nowfun=&lt;built-in method now of type object at 0x7fd35e780c60&gt;</em><big>)</big><a class="reference internal" href="_modules/celery/schedules.html#crontab"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.schedules.crontab" title="Permalink to this definition">¶</a></dt>
<dd><p>A crontab can be used as the <cite>run_every</cite> value of a
<tt class="xref py py-class docutils literal"><span class="pre">PeriodicTask</span></tt> to add cron-like scheduling.</p>
<p>Like a <em class="manpage">cron</em> job, you can specify units of time of when
you would like the task to execute. It is a reasonably complete
implementation of cron&#8217;s features, so it should provide a fair
degree of scheduling needs.</p>
<p>You can specify a minute, an hour, and/or a day of the week in any
of the following formats:</p>
<dl class="attribute">
<dt id="celery.schedules.crontab.minute">
<tt class="descname">minute</tt><a class="headerlink" href="#celery.schedules.crontab.minute" title="Permalink to this definition">¶</a></dt>
<dd><ul class="simple">
<li>A (list of) integers from 0-59 that represent the minutes of
an hour of when execution should occur; or</li>
<li>A string representing a crontab pattern.  This may get pretty
advanced, like <cite>minute=&#8221;*/15&#8221;</cite> (for every quarter) or
<cite>minute=&#8221;1,13,30-45,50-59/2&#8221;</cite>.</li>
</ul>
</dd></dl>

<dl class="attribute">
<dt id="celery.schedules.crontab.hour">
<tt class="descname">hour</tt><a class="headerlink" href="#celery.schedules.crontab.hour" title="Permalink to this definition">¶</a></dt>
<dd><ul class="simple">
<li>A (list of) integers from 0-23 that represent the hours of
a day of when execution should occur; or</li>
<li>A string representing a crontab pattern.  This may get pretty
advanced, like <cite>hour=&#8221;*/3&#8221;</cite> (for every three hours) or
<cite>hour=&#8221;0,8-17/2&#8221;</cite> (at midnight, and every two hours during
office hours).</li>
</ul>
</dd></dl>

<dl class="attribute">
<dt id="celery.schedules.crontab.day_of_week">
<tt class="descname">day_of_week</tt><a class="headerlink" href="#celery.schedules.crontab.day_of_week" title="Permalink to this definition">¶</a></dt>
<dd><ul class="simple">
<li>A (list of) integers from 0-6, where Sunday = 0 and Saturday =
6, that represent the days of a week that execution should
occur.</li>
<li>A string representing a crontab pattern.  This may get pretty
advanced, like <cite>day_of_week=&#8221;mon-fri&#8221;</cite> (for weekdays only).
(Beware that <cite>day_of_week=&#8221;*/2&#8221;</cite> does not literally mean
&#8220;every two days&#8221;, but &#8220;every day that is divisible by two&#8221;!)</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="celery.schedules.crontab.is_due">
<tt class="descname">is_due</tt><big>(</big><em>last_run_at</em><big>)</big><a class="reference internal" href="_modules/celery/schedules.html#crontab.is_due"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.schedules.crontab.is_due" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns tuple of two items <cite>(is_due, next_time_to_run)</cite>,
where next time to run is in seconds.</p>
<p>See <tt class="xref py py-meth docutils literal"><span class="pre">celery.schedules.schedule.is_due()</span></tt> for more information.</p>
</dd></dl>

<dl class="method">
<dt id="celery.schedules.crontab.remaining_estimate">
<tt class="descname">remaining_estimate</tt><big>(</big><em>last_run_at</em><big>)</big><a class="reference internal" href="_modules/celery/schedules.html#crontab.remaining_estimate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.schedules.crontab.remaining_estimate" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns when the periodic task should run next as a timedelta.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="celery.schedules.crontab_parser">
<em class="property">class </em><tt class="descclassname">celery.schedules.</tt><tt class="descname">crontab_parser</tt><big>(</big><em>max_=60</em><big>)</big><a class="reference internal" href="_modules/celery/schedules.html#crontab_parser"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.schedules.crontab_parser" title="Permalink to this definition">¶</a></dt>
<dd><p>Parser for crontab expressions. Any expression of the form &#8216;groups&#8217;
(see BNF grammar below) is accepted and expanded to a set of numbers.
These numbers represent the units of time that the crontab needs to
run on:</p>
<div class="highlight-python"><pre>digit   :: '0'..'9'
dow     :: 'a'..'z'
number  :: digit+ | dow+
steps   :: number
range   :: number ( '-' number ) ?
numspec :: '*' | range
expr    :: numspec ( '/' steps ) ?
groups  :: expr ( ',' expr ) *</pre>
</div>
<p>The parser is a general purpose one, useful for parsing hours, minutes and
day_of_week expressions.  Example usage:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">minutes</span> <span class="o">=</span> <span class="n">crontab_parser</span><span class="p">(</span><span class="mi">60</span><span class="p">)</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="s">&quot;*/15&quot;</span><span class="p">)</span>
<span class="go">[0, 15, 30, 45]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">hours</span> <span class="o">=</span> <span class="n">crontab_parser</span><span class="p">(</span><span class="mi">24</span><span class="p">)</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="s">&quot;*/4&quot;</span><span class="p">)</span>
<span class="go">[0, 4, 8, 12, 16, 20]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">day_of_week</span> <span class="o">=</span> <span class="n">crontab_parser</span><span class="p">(</span><span class="mi">7</span><span class="p">)</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="s">&quot;*&quot;</span><span class="p">)</span>
<span class="go">[0, 1, 2, 3, 4, 5, 6]</span>
</pre></div>
</div>
<dl class="exception">
<dt id="celery.schedules.crontab_parser.ParseException">
<em class="property">exception </em><tt class="descname">ParseException</tt><a class="headerlink" href="#celery.schedules.crontab_parser.ParseException" title="Permalink to this definition">¶</a></dt>
<dd><p>Raised by crontab_parser when the input can&#8217;t be parsed.</p>
</dd></dl>

</dd></dl>

</div>
<span class="target" id="module-celery.signals"></span><div class="section" id="celery-signals">
<h2>celery.signals<a class="headerlink" href="#celery-signals" title="Permalink to this headline">¶</a></h2>
<p>See <em class="xref std std-ref">signals</em>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
</div>
<span class="target" id="module-celery.states"></span><div class="section" id="celery-states">
<h2>celery.states<a class="headerlink" href="#celery-states" title="Permalink to this headline">¶</a></h2>
<p>Built-in Task States.</p>
<div class="section" id="states">
<span id="id9"></span><h3>States<a class="headerlink" href="#states" title="Permalink to this headline">¶</a></h3>
<p>See <em class="xref std std-ref">task-states</em>.</p>
</div>
<div class="section" id="sets">
<h3>Sets<a class="headerlink" href="#sets" title="Permalink to this headline">¶</a></h3>
<div class="section" id="ready-states">
<h4>READY_STATES<a class="headerlink" href="#ready-states" title="Permalink to this headline">¶</a></h4>
<p>Set of states meaning the task result is ready (has been executed).</p>
</div>
<div class="section" id="unready-states">
<h4>UNREADY_STATES<a class="headerlink" href="#unready-states" title="Permalink to this headline">¶</a></h4>
<p>Set of states meaning the task result is not ready (has not been executed).</p>
</div>
<div class="section" id="exception-states">
<h4>EXCEPTION_STATES<a class="headerlink" href="#exception-states" title="Permalink to this headline">¶</a></h4>
<p>Set of states meaning the task returned an exception.</p>
</div>
<div class="section" id="propagate-states">
<h4>PROPAGATE_STATES<a class="headerlink" href="#propagate-states" title="Permalink to this headline">¶</a></h4>
<p>Set of exception states that should propagate exceptions to the user.</p>
</div>
<div class="section" id="all-states">
<h4>ALL_STATES<a class="headerlink" href="#all-states" title="Permalink to this headline">¶</a></h4>
<p>Set of all possible states.</p>
</div>
</div>
<div class="section" id="misc">
<h3>Misc.<a class="headerlink" href="#misc" title="Permalink to this headline">¶</a></h3>
<dl class="data">
<dt id="celery.states.PRECEDENCE">
<tt class="descclassname">celery.states.</tt><tt class="descname">PRECEDENCE</tt><em class="property"> = ['SUCCESS', 'FAILURE', None, 'REVOKED', 'STARTED', 'RECEIVED', 'RETRY', 'PENDING']</em><a class="headerlink" href="#celery.states.PRECEDENCE" title="Permalink to this definition">¶</a></dt>
<dd><p>State precedence.
None represents the precedence of an unknown state.
Lower index means higher precedence.</p>
</dd></dl>

<dl class="function">
<dt id="celery.states.precedence">
<tt class="descclassname">celery.states.</tt><tt class="descname">precedence</tt><big>(</big><em>state</em><big>)</big><a class="reference internal" href="_modules/celery/states.html#precedence"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.states.precedence" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the precedence index for state.</p>
<p>Lower index means higher precedence.</p>
</dd></dl>

<dl class="class">
<dt id="celery.states.state">
<em class="property">class </em><tt class="descclassname">celery.states.</tt><tt class="descname">state</tt><a class="reference internal" href="_modules/celery/states.html#state"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.states.state" title="Permalink to this definition">¶</a></dt>
<dd><p>State is a subclass of <tt class="xref py py-class docutils literal"><span class="pre">str</span></tt>, implementing comparison
methods adhering to state precedence rules.</p>
</dd></dl>

</div>
</div>
<span class="target" id="module-celery.task"></span><div class="section" id="celery-task">
<h2>celery.task<a class="headerlink" href="#celery-task" title="Permalink to this headline">¶</a></h2>
<p>Creating tasks, subtasks, sets and chords.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
<dl class="function">
<dt id="celery.task.periodic_task">
<tt class="descclassname">celery.task.</tt><tt class="descname">periodic_task</tt><big>(</big><em>*args</em>, <em>**options</em><big>)</big><a class="reference internal" href="_modules/celery/task.html#periodic_task"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.task.periodic_task" title="Permalink to this definition">¶</a></dt>
<dd><p>Decorator to create a task class out of any callable.</p>
<div class="admonition-examples admonition">
<p class="first admonition-title">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="nd">@task</span>
<span class="k">def</span> <span class="nf">refresh_feed</span><span class="p">(</span><span class="n">url</span><span class="p">):</span>
    <span class="k">return</span> <span class="n">Feed</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">url</span><span class="o">=</span><span class="n">url</span><span class="p">)</span><span class="o">.</span><span class="n">refresh</span><span class="p">()</span>
</pre></div>
</div>
<p>With setting extra options and using retry.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="nd">@task</span><span class="p">(</span><span class="n">exchange</span><span class="o">=</span><span class="s">&quot;feeds&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">refresh_feed</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
    <span class="k">try</span><span class="p">:</span>
        <span class="k">return</span> <span class="n">Feed</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">url</span><span class="o">=</span><span class="n">url</span><span class="p">)</span><span class="o">.</span><span class="n">refresh</span><span class="p">()</span>
    <span class="k">except</span> <span class="n">socket</span><span class="o">.</span><span class="n">error</span><span class="p">,</span> <span class="n">exc</span><span class="p">:</span>
        <span class="n">refresh_feed</span><span class="o">.</span><span class="n">retry</span><span class="p">(</span><span class="n">args</span><span class="o">=</span><span class="p">[</span><span class="n">url</span><span class="p">],</span> <span class="n">kwargs</span><span class="o">=</span><span class="n">kwargs</span><span class="p">,</span> <span class="n">exc</span><span class="o">=</span><span class="n">exc</span><span class="p">)</span>
</pre></div>
</div>
<p>Calling the resulting task:</p>
<div class="last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">refresh_feed</span><span class="p">(</span><span class="s">&quot;http://example.com/rss&quot;</span><span class="p">)</span> <span class="c"># Regular</span>
<span class="go">&lt;Feed: http://example.com/rss&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">refresh_feed</span><span class="o">.</span><span class="n">delay</span><span class="p">(</span><span class="s">&quot;http://example.com/rss&quot;</span><span class="p">)</span> <span class="c"># Async</span>
<span class="go">&lt;AsyncResult: 8998d0f4-da0b-4669-ba03-d5ab5ac6ad5d&gt;</span>
</pre></div>
</div>
</div>
</dd></dl>

<dl class="function">
<dt id="celery.task.ping">
<tt class="descclassname">celery.task.</tt><tt class="descname">ping</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/task.html#ping"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.task.ping" title="Permalink to this definition">¶</a></dt>
<dd><p>Deprecated and scheduled for removal in Celery 2.3.</p>
<p>Please use <tt class="xref py py-meth docutils literal"><span class="pre">celery.task.control.ping()</span></tt> instead.</p>
</dd></dl>

<dl class="function">
<dt id="celery.task.task">
<tt class="descclassname">celery.task.</tt><tt class="descname">task</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/task.html#task"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.task.task" title="Permalink to this definition">¶</a></dt>
<dd><p>Decorator to create a task class out of any callable.</p>
<p><strong>Examples</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="nd">@task</span>
<span class="k">def</span> <span class="nf">refresh_feed</span><span class="p">(</span><span class="n">url</span><span class="p">):</span>
    <span class="k">return</span> <span class="n">Feed</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">url</span><span class="o">=</span><span class="n">url</span><span class="p">)</span><span class="o">.</span><span class="n">refresh</span><span class="p">()</span>
</pre></div>
</div>
<p>With setting extra options and using retry.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="nd">@task</span><span class="p">(</span><span class="n">max_retries</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">refresh_feed</span><span class="p">(</span><span class="n">url</span><span class="p">):</span>
    <span class="k">try</span><span class="p">:</span>
        <span class="k">return</span> <span class="n">Feed</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">url</span><span class="o">=</span><span class="n">url</span><span class="p">)</span><span class="o">.</span><span class="n">refresh</span><span class="p">()</span>
    <span class="k">except</span> <span class="n">socket</span><span class="o">.</span><span class="n">error</span><span class="p">,</span> <span class="n">exc</span><span class="p">:</span>
        <span class="n">refresh_feed</span><span class="o">.</span><span class="n">retry</span><span class="p">(</span><span class="n">exc</span><span class="o">=</span><span class="n">exc</span><span class="p">)</span>
</pre></div>
</div>
<p>Calling the resulting task:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">refresh_feed</span><span class="p">(</span><span class="s">&quot;http://example.com/rss&quot;</span><span class="p">)</span> <span class="c"># Regular</span>
<span class="go">&lt;Feed: http://example.com/rss&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">refresh_feed</span><span class="o">.</span><span class="n">delay</span><span class="p">(</span><span class="s">&quot;http://example.com/rss&quot;</span><span class="p">)</span> <span class="c"># Async</span>
<span class="go">&lt;AsyncResult: 8998d0f4-da0b-4669-ba03-d5ab5ac6ad5d&gt;</span>
</pre></div>
</div>
</dd></dl>

</div>
<span class="target" id="module-celery.worker"></span><div class="section" id="celery-worker">
<h2>celery.worker<a class="headerlink" href="#celery-worker" title="Permalink to this headline">¶</a></h2>
<p>The worker.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
<dl class="data">
<dt id="celery.worker.WORKER_SIGIGNORE">
<tt class="descclassname">celery.worker.</tt><tt class="descname">WORKER_SIGIGNORE</tt><em class="property"> = frozenset(['SIGINT'])</em><a class="headerlink" href="#celery.worker.WORKER_SIGIGNORE" title="Permalink to this definition">¶</a></dt>
<dd><p>List of signals to ignore when a child process starts.</p>
</dd></dl>

<dl class="data">
<dt id="celery.worker.WORKER_SIGRESET">
<tt class="descclassname">celery.worker.</tt><tt class="descname">WORKER_SIGRESET</tt><em class="property"> = frozenset(['SIGHUP', 'SIGTERM', 'SIGTTOU', 'SIGTTIN', 'SIGUSR1'])</em><a class="headerlink" href="#celery.worker.WORKER_SIGRESET" title="Permalink to this definition">¶</a></dt>
<dd><p>List of signals to reset when a child process starts.</p>
</dd></dl>

<dl class="class">
<dt id="celery.worker.WorkController">
<em class="property">class </em><tt class="descclassname">celery.worker.</tt><tt class="descname">WorkController</tt><big>(</big><em>concurrency=None</em>, <em>logfile=None</em>, <em>loglevel=None</em>, <em>send_events=None</em>, <em>hostname=None</em>, <em>ready_callback=&lt;function noop at 0x2fbbb18&gt;</em>, <em>embed_clockservice=False</em>, <em>pool_cls=None</em>, <em>consumer_cls=None</em>, <em>mediator_cls=None</em>, <em>eta_scheduler_cls=None</em>, <em>schedule_filename=None</em>, <em>task_time_limit=None</em>, <em>task_soft_time_limit=None</em>, <em>max_tasks_per_child=None</em>, <em>pool_putlocks=None</em>, <em>db=None</em>, <em>prefetch_multiplier=None</em>, <em>eta_scheduler_precision=None</em>, <em>disable_rate_limits=None</em>, <em>autoscale=None</em>, <em>autoscaler_cls=None</em>, <em>scheduler_cls=None</em>, <em>app=None</em><big>)</big><a class="reference internal" href="_modules/celery/worker.html#WorkController"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.worker.WorkController" title="Permalink to this definition">¶</a></dt>
<dd><p>Unmanaged worker instance.</p>
<dl class="attribute">
<dt id="celery.worker.WorkController.concurrency">
<tt class="descname">concurrency</tt><em class="property"> = None</em><a class="headerlink" href="#celery.worker.WorkController.concurrency" title="Permalink to this definition">¶</a></dt>
<dd><p>The number of simultaneous processes doing work (default:
<a href="#id10"><span class="problematic" id="id11">:setting:`CELERYD_CONCURRENCY`</span></a>)</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.worker.WorkController.consumer">
<tt class="descname">consumer</tt><em class="property"> = None</em><a class="headerlink" href="#celery.worker.WorkController.consumer" title="Permalink to this definition">¶</a></dt>
<dd><p>Consumer instance.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.worker.WorkController.embed_clockservice">
<tt class="descname">embed_clockservice</tt><em class="property"> = None</em><a class="headerlink" href="#celery.worker.WorkController.embed_clockservice" title="Permalink to this definition">¶</a></dt>
<dd><p>If <tt class="xref py py-const docutils literal"><span class="pre">True</span></tt>, celerybeat is embedded, running in the main worker
process as a thread.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.worker.WorkController.logfile">
<tt class="descname">logfile</tt><em class="property"> = None</em><a class="headerlink" href="#celery.worker.WorkController.logfile" title="Permalink to this definition">¶</a></dt>
<dd><p>The logfile used, if no logfile is specified it uses <cite>stderr</cite>
(default: <a href="#id12"><span class="problematic" id="id13">:setting:`CELERYD_LOG_FILE`</span></a>).</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.worker.WorkController.logger">
<tt class="descname">logger</tt><em class="property"> = None</em><a class="headerlink" href="#celery.worker.WorkController.logger" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference external" href="http://docs.python.org/library/logging.html#logging.Logger" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">logging.Logger</span></tt></a> instance used for logging.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.worker.WorkController.loglevel">
<tt class="descname">loglevel</tt><em class="property"> = 40</em><a class="headerlink" href="#celery.worker.WorkController.loglevel" title="Permalink to this definition">¶</a></dt>
<dd><p>The loglevel used (default: <tt class="xref py py-const docutils literal"><span class="pre">logging.INFO</span></tt>)</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.worker.WorkController.mediator">
<tt class="descname">mediator</tt><em class="property"> = None</em><a class="headerlink" href="#celery.worker.WorkController.mediator" title="Permalink to this definition">¶</a></dt>
<dd><p>Instance of <tt class="xref py py-class docutils literal"><span class="pre">celery.worker.mediator.Mediator</span></tt>.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.worker.WorkController.pool">
<tt class="descname">pool</tt><em class="property"> = None</em><a class="headerlink" href="#celery.worker.WorkController.pool" title="Permalink to this definition">¶</a></dt>
<dd><p>The pool instance used.</p>
</dd></dl>

<dl class="method">
<dt id="celery.worker.WorkController.process_task">
<tt class="descname">process_task</tt><big>(</big><em>request</em><big>)</big><a class="reference internal" href="_modules/celery/worker.html#WorkController.process_task"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.worker.WorkController.process_task" title="Permalink to this definition">¶</a></dt>
<dd><p>Process task by sending it to the pool of workers.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.worker.WorkController.ready_queue">
<tt class="descname">ready_queue</tt><em class="property"> = None</em><a class="headerlink" href="#celery.worker.WorkController.ready_queue" title="Permalink to this definition">¶</a></dt>
<dd><p>The internal queue object that holds tasks ready for immediate
processing.</p>
</dd></dl>

<dl class="attribute">
<dt id="celery.worker.WorkController.send_events">
<tt class="descname">send_events</tt><em class="property"> = False</em><a class="headerlink" href="#celery.worker.WorkController.send_events" title="Permalink to this definition">¶</a></dt>
<dd><p>Enable the sending of monitoring events, these events can be captured
by monitors (celerymon).</p>
</dd></dl>

<dl class="method">
<dt id="celery.worker.WorkController.start">
<tt class="descname">start</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/worker.html#WorkController.start"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.worker.WorkController.start" title="Permalink to this definition">¶</a></dt>
<dd><p>Starts the workers main loop.</p>
</dd></dl>

<dl class="method">
<dt id="celery.worker.WorkController.stop">
<tt class="descname">stop</tt><big>(</big><em>in_sighandler=False</em><big>)</big><a class="reference internal" href="_modules/celery/worker.html#WorkController.stop"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.worker.WorkController.stop" title="Permalink to this definition">¶</a></dt>
<dd><p>Graceful shutdown of the worker server.</p>
</dd></dl>

<dl class="method">
<dt id="celery.worker.WorkController.terminate">
<tt class="descname">terminate</tt><big>(</big><em>in_sighandler=False</em><big>)</big><a class="reference internal" href="_modules/celery/worker.html#WorkController.terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.worker.WorkController.terminate" title="Permalink to this definition">¶</a></dt>
<dd><p>Not so graceful shutdown of the worker server.</p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="celery.worker.process_initializer">
<tt class="descclassname">celery.worker.</tt><tt class="descname">process_initializer</tt><big>(</big><em>app</em>, <em>hostname</em><big>)</big><a class="reference internal" href="_modules/celery/worker.html#process_initializer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.worker.process_initializer" title="Permalink to this definition">¶</a></dt>
<dd><p>Initializes the process so it can be used to process tasks.</p>
<p>Used for multiprocessing environments.</p>
</dd></dl>

</div>
<span class="target" id="module-celery.utils"></span><div class="section" id="celery-utils">
<h2>celery.utils<a class="headerlink" href="#celery-utils" title="Permalink to this headline">¶</a></h2>
<p>Utility functions.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">copyright:</th><td class="field-body"><ol class="first loweralpha simple" start="3">
<li>2009 - 2011 by Ask Solem.</li>
</ol>
</td>
</tr>
<tr class="field-even field"><th class="field-name">license:</th><td class="field-body"><p class="first last">BSD, see LICENSE for more details.</p>
</td>
</tr>
</tbody>
</table>
<dl class="function">
<dt id="celery.utils.chunks">
<tt class="descclassname">celery.utils.</tt><tt class="descname">chunks</tt><big>(</big><em>it</em>, <em>n</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#chunks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.chunks" title="Permalink to this definition">¶</a></dt>
<dd><p>Split an iterator into chunks with <cite>n</cite> elements each.</p>
<p>Examples</p>
<blockquote>
<div><p># n == 2
&gt;&gt;&gt; x = chunks(iter([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), 2)
&gt;&gt;&gt; list(x)
[[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10]]</p>
<p># n == 3
&gt;&gt;&gt; x = chunks(iter([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), 3)
&gt;&gt;&gt; list(x)
[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10]]</p>
</div></blockquote>
</dd></dl>

<dl class="function">
<dt id="celery.utils.cry">
<tt class="descclassname">celery.utils.</tt><tt class="descname">cry</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/celery/utils.html#cry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.cry" title="Permalink to this definition">¶</a></dt>
<dd><p>Return stacktrace of all active threads.</p>
<p>From <a class="reference external" href="https://gist.github.com/737056">https://gist.github.com/737056</a></p>
</dd></dl>

<dl class="function">
<dt id="celery.utils.find_module">
<tt class="descclassname">celery.utils.</tt><tt class="descname">find_module</tt><big>(</big><em>module</em>, <em>path=None</em>, <em>imp=None</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#find_module"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.find_module" title="Permalink to this definition">¶</a></dt>
<dd><p>Version of <a class="reference external" href="http://docs.python.org/library/imp.html#imp.find_module" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">imp.find_module()</span></tt></a> supporting dots.</p>
</dd></dl>

<dl class="function">
<dt id="celery.utils.first">
<tt class="descclassname">celery.utils.</tt><tt class="descname">first</tt><big>(</big><em>predicate</em>, <em>iterable</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#first"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.first" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the first element in <cite>iterable</cite> that <cite>predicate</cite> returns a
<tt class="xref py py-const docutils literal"><span class="pre">True</span></tt> value for.</p>
</dd></dl>

<dl class="function">
<dt id="celery.utils.firstmethod">
<tt class="descclassname">celery.utils.</tt><tt class="descname">firstmethod</tt><big>(</big><em>method</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#firstmethod"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.firstmethod" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a functions that with a list of instances,
finds the first instance that returns a value for the given method.</p>
<p>The list can also contain promises (<a class="reference internal" href="#celery.utils.promise" title="celery.utils.promise"><tt class="xref py py-class docutils literal"><span class="pre">promise</span></tt></a>.)</p>
</dd></dl>

<dl class="function">
<dt id="celery.utils.fun_takes_kwargs">
<tt class="descclassname">celery.utils.</tt><tt class="descname">fun_takes_kwargs</tt><big>(</big><em>fun</em>, <em>kwlist=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="reference internal" href="_modules/celery/utils.html#fun_takes_kwargs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.fun_takes_kwargs" title="Permalink to this definition">¶</a></dt>
<dd><p>With a function, and a list of keyword arguments, returns arguments
in the list which the function takes.</p>
<p>If the object has an <cite>argspec</cite> attribute that is used instead
of using the <tt class="xref py py-meth docutils literal"><span class="pre">inspect.getargspec()</span></tt> introspection.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>fun</strong> &#8211; The function to inspect arguments of.</li>
<li><strong>kwlist</strong> &#8211; The list of keyword arguments.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">def</span> <span class="nf">foo</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">logfile</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">loglevel</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="gp">... </span>    <span class="k">return</span> <span class="n">x</span> <span class="o">*</span> <span class="n">y</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">fun_takes_kwargs</span><span class="p">(</span><span class="n">foo</span><span class="p">,</span> <span class="p">[</span><span class="s">&quot;logfile&quot;</span><span class="p">,</span> <span class="s">&quot;loglevel&quot;</span><span class="p">,</span> <span class="s">&quot;task_id&quot;</span><span class="p">])</span>
<span class="go">[&quot;logfile&quot;, &quot;loglevel&quot;]</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">def</span> <span class="nf">foo</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">fun_takes_kwargs</span><span class="p">(</span><span class="n">foo</span><span class="p">,</span> <span class="p">[</span><span class="s">&quot;logfile&quot;</span><span class="p">,</span> <span class="s">&quot;loglevel&quot;</span><span class="p">,</span> <span class="s">&quot;task_id&quot;</span><span class="p">])</span>
<span class="go">[&quot;logfile&quot;, &quot;loglevel&quot;, &quot;task_id&quot;]</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="celery.utils.get_cls_by_name">
<tt class="descclassname">celery.utils.</tt><tt class="descname">get_cls_by_name</tt><big>(</big><em>name</em>, <em>aliases={}</em>, <em>imp=None</em>, <em>package=None</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#get_cls_by_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.get_cls_by_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Get class by name.</p>
<p>The name should be the full dot-separated path to the class:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">modulename</span><span class="o">.</span><span class="n">ClassName</span>
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-python"><pre>celery.concurrency.processes.TaskPool
                            ^- class name</pre>
</div>
<p>If <cite>aliases</cite> is provided, a dict containing short name/long name
mappings, the name is looked up in the aliases first.</p>
<p>Examples:</p>
<blockquote>
<div><div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">get_cls_by_name</span><span class="p">(</span><span class="s">&quot;celery.concurrency.processes.TaskPool&quot;</span><span class="p">)</span>
<span class="go">&lt;class &#39;celery.concurrency.processes.TaskPool&#39;&gt;</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">get_cls_by_name</span><span class="p">(</span><span class="s">&quot;default&quot;</span><span class="p">,</span> <span class="p">{</span>
<span class="gp">... </span>    <span class="s">&quot;default&quot;</span><span class="p">:</span> <span class="s">&quot;celery.concurrency.processes.TaskPool&quot;</span><span class="p">})</span>
<span class="go">&lt;class &#39;celery.concurrency.processes.TaskPool&#39;&gt;</span>
</pre></div>
</div>
<p># Does not try to look up non-string names.
&gt;&gt;&gt; from celery.concurrency.processes import TaskPool
&gt;&gt;&gt; get_cls_by_name(TaskPool) is TaskPool
True</p>
</div></blockquote>
</dd></dl>

<dl class="function">
<dt id="celery.utils.get_full_cls_name">
<tt class="descclassname">celery.utils.</tt><tt class="descname">get_full_cls_name</tt><big>(</big><em>cls</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#get_full_cls_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.get_full_cls_name" title="Permalink to this definition">¶</a></dt>
<dd><p>With a class, get its full module and class name.</p>
</dd></dl>

<dl class="function">
<dt id="celery.utils.get_symbol_by_name">
<tt class="descclassname">celery.utils.</tt><tt class="descname">get_symbol_by_name</tt><big>(</big><em>name</em>, <em>aliases={}</em>, <em>imp=None</em>, <em>package=None</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#celery.utils.get_symbol_by_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Get class by name.</p>
<p>The name should be the full dot-separated path to the class:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">modulename</span><span class="o">.</span><span class="n">ClassName</span>
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-python"><pre>celery.concurrency.processes.TaskPool
                            ^- class name</pre>
</div>
<p>If <cite>aliases</cite> is provided, a dict containing short name/long name
mappings, the name is looked up in the aliases first.</p>
<p>Examples:</p>
<blockquote>
<div><div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">get_cls_by_name</span><span class="p">(</span><span class="s">&quot;celery.concurrency.processes.TaskPool&quot;</span><span class="p">)</span>
<span class="go">&lt;class &#39;celery.concurrency.processes.TaskPool&#39;&gt;</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">get_cls_by_name</span><span class="p">(</span><span class="s">&quot;default&quot;</span><span class="p">,</span> <span class="p">{</span>
<span class="gp">... </span>    <span class="s">&quot;default&quot;</span><span class="p">:</span> <span class="s">&quot;celery.concurrency.processes.TaskPool&quot;</span><span class="p">})</span>
<span class="go">&lt;class &#39;celery.concurrency.processes.TaskPool&#39;&gt;</span>
</pre></div>
</div>
<p># Does not try to look up non-string names.
&gt;&gt;&gt; from celery.concurrency.processes import TaskPool
&gt;&gt;&gt; get_cls_by_name(TaskPool) is TaskPool
True</p>
</div></blockquote>
</dd></dl>

<dl class="function">
<dt id="celery.utils.import_from_cwd">
<tt class="descclassname">celery.utils.</tt><tt class="descname">import_from_cwd</tt><big>(</big><em>module</em>, <em>imp=None</em>, <em>package=None</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#import_from_cwd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.import_from_cwd" title="Permalink to this definition">¶</a></dt>
<dd><p>Import module, but make sure it finds modules
located in the current directory.</p>
<p>Modules located in the current directory has
precedence over modules located in <cite>sys.path</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="celery.utils.instantiate">
<tt class="descclassname">celery.utils.</tt><tt class="descname">instantiate</tt><big>(</big><em>name</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#instantiate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.instantiate" title="Permalink to this definition">¶</a></dt>
<dd><p>Instantiate class by name.</p>
<p>See <a class="reference internal" href="#celery.utils.get_cls_by_name" title="celery.utils.get_cls_by_name"><tt class="xref py py-func docutils literal"><span class="pre">get_cls_by_name()</span></tt></a>.</p>
</dd></dl>

<dl class="function">
<dt id="celery.utils.kwdict">
<tt class="descclassname">celery.utils.</tt><tt class="descname">kwdict</tt><big>(</big><em>kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#kwdict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.kwdict" title="Permalink to this definition">¶</a></dt>
<dd><p>Make sure keyword arguments are not in unicode.</p>
<p>This should be fixed in newer Python versions,
see: <a class="reference external" href="http://bugs.python.org/issue4978">http://bugs.python.org/issue4978</a>.</p>
</dd></dl>

<dl class="function">
<dt id="celery.utils.lpmerge">
<tt class="descclassname">celery.utils.</tt><tt class="descname">lpmerge</tt><big>(</big><em>L</em>, <em>R</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#lpmerge"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.lpmerge" title="Permalink to this definition">¶</a></dt>
<dd><p>Left precedent dictionary merge.  Keeps values from <cite>l</cite>, if the value
in <cite>r</cite> is <tt class="xref py py-const docutils literal"><span class="pre">None</span></tt>.</p>
</dd></dl>

<dl class="function">
<dt id="celery.utils.mattrgetter">
<tt class="descclassname">celery.utils.</tt><tt class="descname">mattrgetter</tt><big>(</big><em>*attrs</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#mattrgetter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.mattrgetter" title="Permalink to this definition">¶</a></dt>
<dd><p>Like <a class="reference external" href="http://docs.python.org/library/operator.html#operator.itemgetter" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">operator.itemgetter()</span></tt></a> but returns <tt class="xref py py-const docutils literal"><span class="pre">None</span></tt> on missing
attributes instead of raising <tt class="xref py py-exc docutils literal"><span class="pre">AttributeError</span></tt>.</p>
</dd></dl>

<dl class="function">
<dt id="celery.utils.maybe_promise">
<tt class="descclassname">celery.utils.</tt><tt class="descname">maybe_promise</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#maybe_promise"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.maybe_promise" title="Permalink to this definition">¶</a></dt>
<dd><p>Evaluates if the value is a promise.</p>
</dd></dl>

<dl class="class">
<dt id="celery.utils.mpromise">
<em class="property">class </em><tt class="descclassname">celery.utils.</tt><tt class="descname">mpromise</tt><big>(</big><em>fun</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#mpromise"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.mpromise" title="Permalink to this definition">¶</a></dt>
<dd><p>Memoized promise.</p>
<p>The function is only evaluated once, every subsequent access
will return the same value.</p>
<dl class="attribute">
<dt id="celery.utils.mpromise.evaluated">
<tt class="descname">evaluated</tt><a class="headerlink" href="#celery.utils.mpromise.evaluated" title="Permalink to this definition">¶</a></dt>
<dd><p>Set to to <tt class="xref py py-const docutils literal"><span class="pre">True</span></tt> after the promise has been evaluated.</p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="celery.utils.noop">
<tt class="descclassname">celery.utils.</tt><tt class="descname">noop</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#noop"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.noop" title="Permalink to this definition">¶</a></dt>
<dd><p>No operation.</p>
<p>Takes any arguments/keyword arguments and does nothing.</p>
</dd></dl>

<dl class="function">
<dt id="celery.utils.padlist">
<tt class="descclassname">celery.utils.</tt><tt class="descname">padlist</tt><big>(</big><em>container</em>, <em>size</em>, <em>default=None</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#padlist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.padlist" title="Permalink to this definition">¶</a></dt>
<dd><p>Pad list with default elements.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">first</span><span class="p">,</span> <span class="n">last</span><span class="p">,</span> <span class="n">city</span> <span class="o">=</span> <span class="n">padlist</span><span class="p">([</span><span class="s">&quot;George&quot;</span><span class="p">,</span> <span class="s">&quot;Costanza&quot;</span><span class="p">,</span> <span class="s">&quot;NYC&quot;</span><span class="p">],</span> <span class="mi">3</span><span class="p">)</span>
<span class="go">(&quot;George&quot;, &quot;Costanza&quot;, &quot;NYC&quot;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">first</span><span class="p">,</span> <span class="n">last</span><span class="p">,</span> <span class="n">city</span> <span class="o">=</span> <span class="n">padlist</span><span class="p">([</span><span class="s">&quot;George&quot;</span><span class="p">,</span> <span class="s">&quot;Costanza&quot;</span><span class="p">],</span> <span class="mi">3</span><span class="p">)</span>
<span class="go">(&quot;George&quot;, &quot;Costanza&quot;, None)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">first</span><span class="p">,</span> <span class="n">last</span><span class="p">,</span> <span class="n">city</span><span class="p">,</span> <span class="n">planet</span> <span class="o">=</span> <span class="n">padlist</span><span class="p">([</span><span class="s">&quot;George&quot;</span><span class="p">,</span> <span class="s">&quot;Costanza&quot;</span><span class="p">,</span>
<span class="go">                                         &quot;NYC&quot;], 4, default=&quot;Earth&quot;)</span>
<span class="go">(&quot;George&quot;, &quot;Costanza&quot;, &quot;NYC&quot;, &quot;Earth&quot;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="class">
<dt id="celery.utils.promise">
<em class="property">class </em><tt class="descclassname">celery.utils.</tt><tt class="descname">promise</tt><big>(</big><em>fun</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#promise"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.promise" title="Permalink to this definition">¶</a></dt>
<dd><p>A promise.</p>
<p>Evaluated when called or if the <tt class="xref py py-meth docutils literal"><span class="pre">evaluate()</span></tt> method is called.
The function is evaluated on every access, so the value is not
memoized (see <a class="reference internal" href="#celery.utils.mpromise" title="celery.utils.mpromise"><tt class="xref py py-class docutils literal"><span class="pre">mpromise</span></tt></a>).</p>
<dl class="docutils">
<dt>Overloaded operations that will evaluate the promise:</dt>
<dd><tt class="xref py py-meth docutils literal"><span class="pre">__str__()</span></tt>, <tt class="xref py py-meth docutils literal"><span class="pre">__repr__()</span></tt>, <tt class="xref py py-meth docutils literal"><span class="pre">__cmp__()</span></tt>.</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="celery.utils.textindent">
<tt class="descclassname">celery.utils.</tt><tt class="descname">textindent</tt><big>(</big><em>t</em>, <em>indent=0</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#textindent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.textindent" title="Permalink to this definition">¶</a></dt>
<dd><p>Indent text.</p>
</dd></dl>

<dl class="function">
<dt id="celery.utils.truncate_text">
<tt class="descclassname">celery.utils.</tt><tt class="descname">truncate_text</tt><big>(</big><em>text</em>, <em>maxlen=128</em>, <em>suffix='...'</em><big>)</big><a class="reference internal" href="_modules/celery/utils.html#truncate_text"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#celery.utils.truncate_text" title="Permalink to this definition">¶</a></dt>
<dd><p>Truncates text to a maximum number of characters.</p>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">The Celery Module</a><ul>
<li><a class="reference internal" href="#celery-app">celery.app</a></li>
<li><a class="reference internal" href="#celery-beat">celery.beat</a></li>
<li><a class="reference internal" href="#celery-datastructures">celery.datastructures</a></li>
<li><a class="reference internal" href="#celery-decorators">celery.decorators✞</a></li>
<li><a class="reference internal" href="#celery-events">celery.events</a></li>
<li><a class="reference internal" href="#celery-exceptions">celery.exceptions</a></li>
<li><a class="reference internal" href="#celery-loaders">celery.loaders</a></li>
<li><a class="reference internal" href="#celery-local">celery.local</a></li>
<li><a class="reference internal" href="#celery-platforms">celery.platforms</a></li>
<li><a class="reference internal" href="#celery-registry">celery.registry</a></li>
<li><a class="reference internal" href="#celery-routes">celery.routes</a></li>
<li><a class="reference internal" href="#celery-schedules">celery.schedules</a></li>
<li><a class="reference internal" href="#celery-signals">celery.signals</a></li>
<li><a class="reference internal" href="#celery-states">celery.states</a><ul>
<li><a class="reference internal" href="#states">States</a></li>
<li><a class="reference internal" href="#sets">Sets</a><ul>
<li><a class="reference internal" href="#ready-states">READY_STATES</a></li>
<li><a class="reference internal" href="#unready-states">UNREADY_STATES</a></li>
<li><a class="reference internal" href="#exception-states">EXCEPTION_STATES</a></li>
<li><a class="reference internal" href="#propagate-states">PROPAGATE_STATES</a></li>
<li><a class="reference internal" href="#all-states">ALL_STATES</a></li>
</ul>
</li>
<li><a class="reference internal" href="#misc">Misc.</a></li>
</ul>
</li>
<li><a class="reference internal" href="#celery-task">celery.task</a></li>
<li><a class="reference internal" href="#celery-worker">celery.worker</a></li>
<li><a class="reference internal" href="#celery-utils">celery.utils</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="twitter.html"
                        title="previous chapter">The Twitter Module</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/celery.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="twitter.html" title="The Twitter Module"
             >previous</a> |</li>
        <li><a href="index.html">EggDiscover 0.1 documentation</a> &raquo;</li>
          <li><a href="externalapps.html" >External apps used in this project</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012, Yohann Gabory.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2.
    </div>
  </body>
</html>