Changelog 154 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876
  1. ================
  2. Change history
  3. ================
  4. .. contents::
  5. :local:
  6. .. _version-2.4.0:
  7. 2.4.0
  8. =====
  9. .. _v240-important:
  10. Important Notes
  11. ---------------
  12. * Now depends on Kombu 1.3.0
  13. * The deprecated :func:`celery.loaders.setup_loader` function has been removed.
  14. * Deprecations
  15. The following functions has been deprecated and is scheduled for removal in
  16. version 3.0:
  17. ===================================== ===================================
  18. **Old function** **Alternative**
  19. ===================================== ===================================
  20. `celery.loaders.current_loader` `celery.current_app.loader`
  21. `celery.loaders.load_settings` `celery.current_app.conf`
  22. `celery.execute.apply` `Task.apply`
  23. `celery.execute.apply_async` `Task.apply_async`
  24. `celery.execute.delay_task` `celery.execute.send_task`
  25. ===================================== ===================================
  26. The following settings has been deprecated and is scheduled for removal
  27. in version 3.0:
  28. ===================================== ===================================
  29. **Old setting** **Alternative**
  30. ===================================== ===================================
  31. `CELERYD_LOG_LEVEL` ``celeryd --loglevel=``
  32. `CELERYD_LOG_FILE` ``celeryd --logfile=``
  33. `CELERYBEAT_LOG_LEVEL` ``celerybeat --loglevel=``
  34. `CELERYBEAT_LOG_FILE` ``celerybeat --logfile=``
  35. `CELERYMON_LOG_LEVEL` ``celerymon --loglevel=``
  36. `CELERYMON_LOG_FILE` ``celerymon --logfile=``
  37. ===================================== ===================================
  38. .. _v240-news:
  39. News
  40. ----
  41. * Broker transports can be now be specified using URLs
  42. The broker hostname can now be given as an URL instead, of the format::
  43. transport://user:password@hostname:port/virtual_host
  44. for example the default broker is written as::
  45. amqp://guest:guest@localhost:5672//
  46. Transport defaults to amqp, and is not required.
  47. user, password, port and virtual_host is also not mandatory and
  48. will default to the corresponding transport default.
  49. .. note::
  50. Note that the path component (virtual_host) always starts with a
  51. forward-slash. This is necessary to distinguish between the virtual
  52. host '' (empty) and '/', which are both acceptable virtual host names.
  53. A virtual host of '/' becomes:
  54. amqp://guest:guest@localhost:5672//
  55. and a virtual host of '' (empty) becomes::
  56. amqp://guest:guest@localhost:5672/
  57. So the leading slash in the path component is **always required**.
  58. In addition the :setting:`BROKER_URL` setting has been added as an alias
  59. to ``BROKER_HOST``. Any broker setting specified in both the URL and in
  60. the configuration will be ignored, if a setting is not provided in the URL
  61. then the value from the configuration will be used as default.
  62. Also, programs now support the :option:`-b|--broker` option to specify
  63. a broker URL on the command line::
  64. $ celeryd -b redis://localhost
  65. $ celeryctl -b amqp://guest:guest@localhost//e
  66. The environment variable :envvar:`CELERY_BROKER_URL` can also be used to
  67. easily override the default broker used.
  68. * Adds :setting:`EMAIL_USE_TLS` to enable secure SMTP connections
  69. (Issue #418).
  70. * The coloring of log messages didn't handle non-ASCII data well
  71. (Issue #427).
  72. * The Cache, Cassandra, MongoDB, Redis and Tyrant backends now respects
  73. the :setting:`CELERY_RESULT_SERIALIZER` setting (Issue #435).
  74. This means that only the database (django/sqlalchemy) backends
  75. currently does not support using custom serializers.
  76. * Logging calls no longer manually formats messages, but delegates
  77. that to the logging system, so tools like Sentry can easier
  78. work with the messages (Issue #445).
  79. * ``Task.request`` now contains the current workers hostname (Issue #460).
  80. * ``celeryd_multi`` now supports a ``stop_verify`` command to wait for
  81. processes to shutdown.
  82. * New setting :setting:`CELERY_RESULT_DB_SHORT_LIVED_SESSIONS` added,
  83. which if enabled will disable the caching of SQLAlchemy sessions.
  84. Fixes
  85. -----
  86. * Fixes case where the worker could become unresponsive because of tasks
  87. exceeding the hard time limit.
  88. * Eventlet no longer crashes if autoscale is enabled.
  89. growing and shrinking eventlet pools is still not supported.
  90. * [Windows] the multiprocessing pool tried to import ``os.kill``
  91. even though this is not available there (Issue #450).
  92. * `purge/discard_all` was not working correctly (Issue #455).
  93. * Retries will no longer be performed when tasks are called directly
  94. (using ``__call__``).
  95. Instead the exception passed to ``retry`` will be re-raised.
  96. * All result backends now implements ``__reduce__`` so that they can
  97. be pickled (Issue #441).
  98. * The ``task-sent`` event was missing from the event reference.
  99. * ``ResultSet.iterate`` now returns results as they finish (Issue #459).
  100. This was not the case previously, even though the documentation
  101. states this was the expected behavior.
  102. .. _version-2.3.1:
  103. 2.3.1
  104. =====
  105. :release-date: 2011-08-07 08:00 P.M BST
  106. Fixes
  107. -----
  108. * The :setting:`CELERY_AMQP_TASK_RESULT_EXPIRES` setting did not work,
  109. resulting in an AMQP related error about not being able to serialize
  110. floats while trying to publish task states (Issue #446).
  111. .. _version-2.3.0:
  112. 2.3.0
  113. =====
  114. :release-date: 2011-08-05 12:00 P.M BST
  115. :tested: cPython: 2.5, 2.6, 2.7; PyPy: 1.5; Jython: 2.5.2
  116. .. _v230-important:
  117. Important Notes
  118. ---------------
  119. * Now requires Kombu 1.2.1
  120. * Results are now disabled by default.
  121. The AMQP backend was not a good default because often the users were
  122. not consuming the results, resulting in thousands of queues.
  123. While the queues can be configured to expire if left unused, it was not
  124. possible to enable this by default because this was only available in
  125. recent RabbitMQ versions (2.1.1+)
  126. With this change enabling a result backend will be a conscious choice,
  127. which will hopefully lead the user to read the documentation and be aware
  128. of any common pitfalls with the particular backend.
  129. The default backend is now a dummy backend
  130. (:class:`celery.backends.base.DisabledBackend`). Saving state is simply an
  131. noop operation, and AsyncResult.wait(), .result, .state, etc. will raise
  132. a :exc:`NotImplementedError` telling the user to configure the result backend.
  133. For help choosing a backend please see :ref:`task-result-backends`.
  134. If you depend on the previous default which was the AMQP backend, then
  135. you have to set this explicitly before upgrading::
  136. CELERY_RESULT_BACKEND = "amqp"
  137. .. note::
  138. For django-celery users the default backend is still ``database``,
  139. and results are not disabled by default.
  140. * The Debian init scripts have been deprecated in favor of the generic-init.d
  141. init scripts.
  142. In addition generic init scripts for celerybeat and celeryev has been
  143. added.
  144. .. _v230-news:
  145. News
  146. ----
  147. * Automatic connection pool support.
  148. The pool is used by everything that requires a broker connection. For
  149. example applying tasks, sending broadcast commands, retrieving results
  150. with the AMQP result backend, and so on.
  151. The pool is disabled by default, but you can enable it by configuring the
  152. :setting:`BROKER_POOL_LIMIT` setting::
  153. BROKER_POOL_LIMIT = 10
  154. A limit of 10 means a maximum of 10 simultaneous connections can co-exist.
  155. Only a single connection will ever be used in a single-thread
  156. environment, but in a concurrent environment (threads, greenlets, etc., but
  157. not processes) when the limit has been exceeded, any try to acquire a
  158. connection will block the thread and wait for a connection to be released.
  159. This is something to take into consideration when choosing a limit.
  160. A limit of :const:`None` or 0 means no limit, and connections will be
  161. established and closed every time.
  162. * Introducing Chords (taskset callbacks).
  163. A chord is a task that only executes after all of the tasks in a taskset
  164. has finished executing. It's a fancy term for "taskset callbacks"
  165. adopted from
  166. `Cω <http://research.microsoft.com/en-us/um/cambridge/projects/comega/>`_).
  167. It works with all result backends, but the best implementation is
  168. currently provided by the Redis result backend.
  169. Here's an example chord::
  170. >>> chord(add.subtask((i, i))
  171. ... for i in xrange(100))(tsum.subtask()).get()
  172. 9900
  173. Please read the :ref:`Chords section in the user guide <chords>`, if you
  174. want to know more.
  175. * Time limits can now be set for individual tasks.
  176. To set the soft and hard time limits for a task use the ``time_limit``
  177. and ``soft_time_limit`` attributes:
  178. .. code-block:: python
  179. import time
  180. @task(time_limit=60, soft_time_limit=30)
  181. def sleeptask(seconds):
  182. time.sleep(seconds)
  183. If the attributes are not set, then the workers default time limits
  184. will be used.
  185. New in this version you can also change the time limits for a task
  186. at runtime using the :func:`time_limit` remote control command::
  187. >>> from celery.task import control
  188. >>> control.time_limit("tasks.sleeptask",
  189. ... soft=60, hard=120, reply=True)
  190. [{'worker1.example.com': {'ok': 'time limits set successfully'}}]
  191. Only tasks that starts executing after the time limit change will be affected.
  192. .. note::
  193. Soft time limits will still not work on Windows or other platforms
  194. that do not have the ``SIGUSR1`` signal.
  195. * Redis backend configuration directive names changed to include the
  196. ``CELERY_`` prefix.
  197. ===================================== ===================================
  198. **Old setting name** **Replace with**
  199. ===================================== ===================================
  200. `REDIS_HOST` `CELERY_REDIS_HOST`
  201. `REDIS_PORT` `CELERY_REDIS_PORT`
  202. `REDIS_DB` `CELERY_REDIS_DB`
  203. `REDIS_PASSWORD` `CELERY_REDIS_PASSWORD`
  204. ===================================== ===================================
  205. The old names are still supported but pending deprecation.
  206. * PyPy: The default pool implementation used is now multiprocessing
  207. if running on PyPy 1.5.
  208. * celeryd-multi: now supports "pass through" options.
  209. Pass through options makes it easier to use celery without a
  210. configuration file, or just add last-minute options on the command
  211. line.
  212. Example use:
  213. $ celeryd-multi start 4 -c 2 -- broker.host=amqp.example.com \
  214. broker.vhost=/ \
  215. celery.disable_rate_limits=yes
  216. * celerybeat: Now retries establishing the connection (Issue #419).
  217. * celeryctl: New ``list bindings`` command.
  218. Lists the current or all available bindings, depending on the
  219. broker transport used.
  220. * Heartbeat is now sent every 30 seconds (previously every 2 minutes).
  221. * ``ResultSet.join_native()`` and ``iter_native()`` is now supported by
  222. the Redis and Cache result backends.
  223. This is an optimized version of ``join()`` using the underlying
  224. backends ability to fetch multiple results at once.
  225. * Can now use SSL when sending error e-mails by enabling the
  226. :setting:`EMAIL_USE_SSL` setting.
  227. * ``events.default_dispatcher()``: Context manager to easily obtain
  228. an event dispatcher instance using the connection pool.
  229. * Import errors in the configuration module will not be silenced anymore.
  230. * ResultSet.iterate: Now supports the ``timeout``, ``propagate`` and
  231. ``interval`` arguments.
  232. * ``with_default_connection`` -> ``with default_connection``
  233. * TaskPool.apply_async: Keyword arguments ``callbacks`` and ``errbacks``
  234. has been renamed to ``callback`` and ``errback`` and take a single scalar
  235. value instead of a list.
  236. * No longer propagates errors occurring during process cleanup (Issue #365)
  237. * Added ``TaskSetResult.delete()``, which will delete a previously
  238. saved taskset result.
  239. * Celerybeat now syncs every 3 minutes instead of only at
  240. shutdown (Issue #382).
  241. * Monitors now properly handles unknown events, so user-defined events
  242. are displayed.
  243. * Terminating a task on Windows now also terminates all of the tasks child
  244. processes (Issue #384).
  245. * celeryd: ``-I|--include`` option now always searches the current directory
  246. to import the specified modules.
  247. * Cassandra backend: Now expires results by using TTLs.
  248. * Functional test suite in ``funtests`` is now actually working properly, and
  249. passing tests.
  250. .. _v230-fixes:
  251. Fixes
  252. -----
  253. * celeryev was trying to create the pidfile twice.
  254. * celery.contrib.batches: Fixed problem where tasks failed
  255. silently (Issue #393).
  256. * Fixed an issue where logging objects would give "<Unrepresentable",
  257. even though the objects were.
  258. * ``CELERY_TASK_ERROR_WHITE_LIST`` is now properly initialized
  259. in all loaders.
  260. * celeryd_detach now passes through command-line configuration.
  261. * Remote control command ``add_consumer`` now does nothing if the
  262. queue is already being consumed from.
  263. .. _version-2.2.7:
  264. 2.2.7
  265. =====
  266. :release-date: 2011-06-13 16:00 P.M BST
  267. * New signals: :signal:`after_setup_logger` and
  268. :signal:`after_setup_task_logger`
  269. These signals can be used to augment logging configuration
  270. after Celery has set up logging.
  271. * Redis result backend now works with Redis 2.4.4.
  272. * celeryd_multi: The :option:`--gid` option now works correctly.
  273. * celeryd: Retry wrongfully used the repr of the traceback instead
  274. of the string representation.
  275. * App.config_from_object: Now loads module, not attribute of module.
  276. * Fixed issue where logging of objects would give "<Unrepresentable: ...>"
  277. .. _version-2.2.6:
  278. 2.2.6
  279. =====
  280. :release-date: 2011-04-15 16:00 P.M CEST
  281. .. _v226-important:
  282. Important Notes
  283. ---------------
  284. * Now depends on Kombu 1.1.2.
  285. * Dependency lists now explicitly specifies that we don't want python-dateutil
  286. 2.x, as this version only supports py3k.
  287. If you have installed dateutil 2.0 by accident you should downgrade
  288. to the 1.5.0 version::
  289. pip install -U python-dateutil==1.5.0
  290. or by easy_install::
  291. easy_install -U python-dateutil==1.5.0
  292. .. _v226-fixes:
  293. Fixes
  294. -----
  295. * The new ``WatchedFileHandler`` broke Python 2.5 support (Issue #367).
  296. * Task: Don't use ``app.main`` if the task name is set explicitly.
  297. * Sending emails did not work on Python 2.5, due to a bug in
  298. the version detection code (Issue #378).
  299. * Beat: Adds method ``ScheduleEntry._default_now``
  300. This method can be overridden to change the default value
  301. of ``last_run_at``.
  302. * An error occurring in process cleanup could mask task errors.
  303. We no longer propagate errors happening at process cleanup,
  304. but log them instead. This way they will not interfere with publishing
  305. the task result (Issue #365).
  306. * Defining tasks did not work properly when using the Django
  307. ``shell_plus`` utility (Issue #366).
  308. * ``AsyncResult.get`` did not accept the ``interval`` and ``propagate``
  309. arguments.
  310. * celeryd: Fixed a bug where celeryd would not shutdown if a
  311. :exc:`socket.error` was raised.
  312. .. _version-2.2.5:
  313. 2.2.5
  314. =====
  315. :release-date: 2011-03-28 06:00 P.M CEST
  316. .. _v225-important:
  317. Important Notes
  318. ---------------
  319. * Now depends on Kombu 1.0.7
  320. .. _v225-news:
  321. News
  322. ----
  323. * Our documentation is now hosted by Read The Docs
  324. (http://docs.celeryproject.org), and all links have been changed to point to
  325. the new URL.
  326. * Logging: Now supports log rotation using external tools like `logrotate.d`_
  327. (Issue #321)
  328. This is accomplished by using the ``WatchedFileHandler``, which re-opens
  329. the file if it is renamed or deleted.
  330. .. _`logrotate.d`:
  331. http://www.ducea.com/2006/06/06/rotating-linux-log-files-part-2-logrotate/
  332. * :ref:`tut-otherqueues` now documents how to configure Redis/Database result
  333. backends.
  334. * gevent: Now supports ETA tasks.
  335. But gevent still needs ``CELERY_DISABLE_RATE_LIMITS=True`` to work.
  336. * TaskSet User Guide: now contains TaskSet callback recipes.
  337. * Eventlet: New signals:
  338. * ``eventlet_pool_started``
  339. * ``eventlet_pool_preshutdown``
  340. * ``eventlet_pool_postshutdown``
  341. * ``eventlet_pool_apply``
  342. See :mod:`celery.signals` for more information.
  343. * New :setting:`BROKER_TRANSPORT_OPTIONS` setting can be used to pass
  344. additional arguments to a particular broker transport.
  345. * celeryd: ``worker_pid`` is now part of the request info as returned by
  346. broadcast commands.
  347. * TaskSet.apply/Taskset.apply_async now accepts an optional ``taskset_id``
  348. argument.
  349. * The taskset_id (if any) is now available in the Task request context.
  350. * SQLAlchemy result backend: taskset_id and taskset_id columns now have a
  351. unique constraint. (Tables need to recreated for this to take affect).
  352. * Task Userguide: Added section about choosing a result backend.
  353. * Removed unused attribute ``AsyncResult.uuid``.
  354. .. _v225-fixes:
  355. Fixes
  356. -----
  357. * multiprocessing.Pool: Fixes race condition when marking job with
  358. ``WorkerLostError`` (Issue #268).
  359. The process may have published a result before it was terminated,
  360. but we have no reliable way to detect that this is the case.
  361. So we have to wait for 10 seconds before marking the result with
  362. WorkerLostError. This gives the result handler a chance to retrieve the
  363. result.
  364. * multiprocessing.Pool: Shutdown could hang if rate limits disabled.
  365. There was a race condition when the MainThread was waiting for the pool
  366. semaphore to be released. The ResultHandler now terminates after 5
  367. seconds if there are unacked jobs, but no worker processes left to start
  368. them (it needs to timeout because there could still be an ack+result
  369. that we haven't consumed from the result queue. It
  370. is unlikely we will receive any after 5 seconds with no worker processes).
  371. * celerybeat: Now creates pidfile even if the ``--detach`` option is not set.
  372. * eventlet/gevent: The broadcast command consumer is now running in a separate
  373. greenthread.
  374. This ensures broadcast commands will take priority even if there are many
  375. active tasks.
  376. * Internal module ``celery.worker.controllers`` renamed to
  377. ``celery.worker.mediator``.
  378. * celeryd: Threads now terminates the program by calling ``os._exit``, as it
  379. is the only way to ensure exit in the case of syntax errors, or other
  380. unrecoverable errors.
  381. * Fixed typo in ``maybe_timedelta`` (Issue #352).
  382. * celeryd: Broadcast commands now logs with loglevel debug instead of warning.
  383. * AMQP Result Backend: Now resets cached channel if the connection is lost.
  384. * Polling results with the AMQP result backend was not working properly.
  385. * Rate limits: No longer sleeps if there are no tasks, but rather waits for
  386. the task received condition (Performance improvement).
  387. * ConfigurationView: ``iter(dict)`` should return keys, not items (Issue #362).
  388. * celerybeat: PersistentScheduler now automatically removes a corrupted
  389. schedule file (Issue #346).
  390. * Programs that doesn't support positional command line arguments now provides
  391. a user friendly error message.
  392. * Programs no longer tries to load the configuration file when showing
  393. ``--version`` (Issue #347).
  394. * Autoscaler: The "all processes busy" log message is now severity debug
  395. instead of error.
  396. * celeryd: If the message body can't be decoded, it is now passed through
  397. ``safe_str`` when logging.
  398. This to ensure we don't get additional decoding errors when trying to log
  399. the failure.
  400. * ``app.config_from_object``/``app.config_from_envvar`` now works for all
  401. loaders.
  402. * Now emits a user-friendly error message if the result backend name is
  403. unknown (Issue #349).
  404. * :mod:`celery.contrib.batches`: Now sets loglevel and logfile in the task
  405. request so ``task.get_logger`` works with batch tasks (Issue #357).
  406. * celeryd: An exception was raised if using the amqp transport and the prefetch
  407. count value exceeded 65535 (Issue #359).
  408. The prefetch count is incremented for every received task with an
  409. ETA/countdown defined. The prefetch count is a short, so can only support
  410. a maximum value of 65535. If the value exceeds the maximum value we now
  411. disable the prefetch count, it is re-enabled as soon as the value is below
  412. the limit again.
  413. * cursesmon: Fixed unbound local error (Issue #303).
  414. * eventlet/gevent is now imported on demand so autodoc can import the modules
  415. without having eventlet/gevent installed.
  416. * celeryd: Ack callback now properly handles ``AttributeError``.
  417. * ``Task.after_return`` is now always called *after* the result has been
  418. written.
  419. * Cassandra Result Backend: Should now work with the latest ``pycassa``
  420. version.
  421. * multiprocessing.Pool: No longer cares if the putlock semaphore is released
  422. too many times. (this can happen if one or more worker processes are
  423. killed).
  424. * SQLAlchemy Result Backend: Now returns accidentally removed ``date_done`` again
  425. (Issue #325).
  426. * Task.request contex is now always initialized to ensure calling the task
  427. function directly works even if it actively uses the request context.
  428. * Exception occuring when iterating over the result from ``TaskSet.apply``
  429. fixed.
  430. * eventlet: Now properly schedules tasks with an ETA in the past.
  431. .. _version-2.2.4:
  432. 2.2.4
  433. =====
  434. :release-date: 2011-02-19 12:00 AM CET
  435. .. _v224-fixes:
  436. Fixes
  437. -----
  438. * celeryd: 2.2.3 broke error logging, resulting in tracebacks not being logged.
  439. * AMQP result backend: Polling task states did not work properly if there were
  440. more than one result message in the queue.
  441. * ``TaskSet.apply_async()`` and ``TaskSet.apply()`` now supports an optional
  442. ``taskset_id`` keyword argument (Issue #331).
  443. * The current taskset id (if any) is now available in the task context as
  444. ``request.taskset`` (Issue #329).
  445. * SQLAlchemy result backend: `date_done` was no longer part of the results as it had
  446. been accidentally removed. It is now available again (Issue #325).
  447. * SQLAlchemy result backend: Added unique constraint on `Task.task_id` and
  448. `TaskSet.taskset_id`. Tables needs to be recreated for this to take effect.
  449. * Fixed exception raised when iterating on the result of ``TaskSet.apply()``.
  450. * Tasks Userguide: Added section on choosing a result backend.
  451. .. _version-2.2.3:
  452. 2.2.3
  453. =====
  454. :release-date: 2011-02-12 04:00 P.M CET
  455. .. _v223-fixes:
  456. Fixes
  457. -----
  458. * Now depends on Kombu 1.0.3
  459. * Task.retry now supports a ``max_retries`` argument, used to change the
  460. default value.
  461. * `multiprocessing.cpu_count` may raise :exc:`NotImplementedError` on
  462. platforms where this is not supported (Issue #320).
  463. * Coloring of log messages broke if the logged object was not a string.
  464. * Fixed several typos in the init script documentation.
  465. * A regression caused `Task.exchange` and `Task.routing_key` to no longer
  466. have any effect. This is now fixed.
  467. * Routing Userguide: Fixes typo, routers in :setting:`CELERY_ROUTES` must be
  468. instances, not classes.
  469. * :program:`celeryev` did not create pidfile even though the
  470. :option:`--pidfile` argument was set.
  471. * Task logger format was no longer used. (Issue #317).
  472. The id and name of the task is now part of the log message again.
  473. * A safe version of ``repr()`` is now used in strategic places to ensure
  474. objects with a broken ``__repr__`` does not crash the worker, or otherwise
  475. make errors hard to understand (Issue #298).
  476. * Remote control command ``active_queues``: did not account for queues added
  477. at runtime.
  478. In addition the dictionary replied by this command now has a different
  479. structure: the exchange key is now a dictionary containing the
  480. exchange declaration in full.
  481. * The :option:`-Q` option to :program:`celeryd` removed unused queue
  482. declarations, so routing of tasks could fail.
  483. Queues are no longer removed, but rather `app.amqp.queues.consume_from()`
  484. is used as the list of queues to consume from.
  485. This ensures all queues are available for routing purposes.
  486. * celeryctl: Now supports the `inspect active_queues` command.
  487. .. _version-2.2.2:
  488. 2.2.2
  489. =====
  490. :release-date: 2011-02-03 04:00 P.M CET
  491. .. _v222-fixes:
  492. Fixes
  493. -----
  494. * Celerybeat could not read the schedule properly, so entries in
  495. :setting:`CELERYBEAT_SCHEDULE` would not be scheduled.
  496. * Task error log message now includes `exc_info` again.
  497. * The `eta` argument can now be used with `task.retry`.
  498. Previously it was overwritten by the countdown argument.
  499. * celeryd-multi/celeryd_detach: Now logs errors occuring when executing
  500. the `celeryd` command.
  501. * daemonizing cookbook: Fixed typo ``--time-limit 300`` ->
  502. ``--time-limit=300``
  503. * Colors in logging broke non-string objects in log messages.
  504. * ``setup_task_logger`` no longer makes assumptions about magic task kwargs.
  505. .. _version-2.2.1:
  506. 2.2.1
  507. =====
  508. :release-date: 2011-02-02 04:00 P.M CET
  509. .. _v221-fixes:
  510. Fixes
  511. -----
  512. * Eventlet pool was leaking memory (Issue #308).
  513. * Deprecated function ``celery.execute.delay_task`` was accidentally removed,
  514. now available again.
  515. * ``BasePool.on_terminate`` stub did not exist
  516. * celeryd detach: Adds readable error messages if user/group name does not
  517. exist.
  518. * Smarter handling of unicode decod errors when logging errors.
  519. .. _version-2.2.0:
  520. 2.2.0
  521. =====
  522. :release-date: 2011-02-01 10:00 AM CET
  523. .. _v220-important:
  524. Important Notes
  525. ---------------
  526. * Carrot has been replaced with `Kombu`_
  527. Kombu is the next generation messaging framework for Python,
  528. fixing several flaws present in Carrot that was hard to fix
  529. without breaking backwards compatibility.
  530. Also it adds:
  531. * First-class support for virtual transports; Redis, Django ORM,
  532. SQLAlchemy, Beanstalk, MongoDB, CouchDB and in-memory.
  533. * Consistent error handling with introspection,
  534. * The ability to ensure that an operation is performed by gracefully
  535. handling connection and channel errors,
  536. * Message compression (zlib, bzip2, or custom compression schemes).
  537. This means that `ghettoq` is no longer needed as the
  538. functionality it provided is already available in Celery by default.
  539. The virtual transports are also more feature complete with support
  540. for exchanges (direct and topic). The Redis transport even supports
  541. fanout exchanges so it is able to perform worker remote control
  542. commands.
  543. .. _`Kombu`: http://pypi.python.org/pypi/kombu
  544. * Magic keyword arguments pending deprecation.
  545. The magic keyword arguments were responsibile for many problems
  546. and quirks: notably issues with tasks and decorators, and name
  547. collisions in keyword arguments for the unaware.
  548. It wasn't easy to find a way to deprecate the magic keyword arguments,
  549. but we think this is a solution that makes sense and it will not
  550. have any adverse effects for existing code.
  551. The path to a magic keyword argument free world is:
  552. * the `celery.decorators` module is deprecated and the decorators
  553. can now be found in `celery.task`.
  554. * The decorators in `celery.task` disables keyword arguments by
  555. default
  556. * All examples in the documentation have been changed to use
  557. `celery.task`.
  558. This means that the following will have magic keyword arguments
  559. enabled (old style):
  560. .. code-block:: python
  561. from celery.decorators import task
  562. @task
  563. def add(x, y, **kwargs):
  564. print("In task %s" % kwargs["task_id"])
  565. return x + y
  566. And this will not use magic keyword arguments (new style):
  567. .. code-block:: python
  568. from celery.task import task
  569. @task
  570. def add(x, y):
  571. print("In task %s" % add.request.id)
  572. return x + y
  573. In addition, tasks can choose not to accept magic keyword arguments by
  574. setting the `task.accept_magic_kwargs` attribute.
  575. .. admonition:: Deprecation
  576. Using the decorators in :mod:`celery.decorators` emits a
  577. :class:`PendingDeprecationWarning` with a helpful message urging
  578. you to change your code, in version 2.4 this will be replaced with
  579. a :class:`DeprecationWarning`, and in version 3.0 the
  580. :mod:`celery.decorators` module will be removed and no longer exist.
  581. Similarly, the `task.accept_magic_kwargs` attribute will no
  582. longer have any effect starting from version 3.0.
  583. * The magic keyword arguments are now available as `task.request`
  584. This is called *the context*. Using thread-local storage the
  585. context contains state that is related to the current request.
  586. It is mutable and you can add custom attributes that will only be seen
  587. by the current task request.
  588. The following context attributes are always available:
  589. ===================================== ===================================
  590. **Magic Keyword Argument** **Replace with**
  591. ===================================== ===================================
  592. `kwargs["task_id"]` `self.request.id`
  593. `kwargs["delivery_info"]` `self.request.delivery_info`
  594. `kwargs["task_retries"]` `self.request.retries`
  595. `kwargs["logfile"]` `self.request.logfile`
  596. `kwargs["loglevel"]` `self.request.loglevel`
  597. `kwargs["task_is_eager` `self.request.is_eager`
  598. **NEW** `self.request.args`
  599. **NEW** `self.request.kwargs`
  600. ===================================== ===================================
  601. In addition, the following methods now automatically uses the current
  602. context, so you don't have to pass `kwargs` manually anymore:
  603. * `task.retry`
  604. * `task.get_logger`
  605. * `task.update_state`
  606. * `Eventlet`_ support.
  607. This is great news for I/O-bound tasks!
  608. To change pool implementations you use the :option:`-P|--pool` argument
  609. to :program:`celeryd`, or globally using the
  610. :setting:`CELERYD_POOL` setting. This can be the full name of a class,
  611. or one of the following aliases: `processes`, `eventlet`, `gevent`.
  612. For more information please see the :ref:`concurrency-eventlet` section
  613. in the User Guide.
  614. .. admonition:: Why not gevent?
  615. For our first alternative concurrency implementation we have focused
  616. on `Eventlet`_, but there is also an experimental `gevent`_ pool
  617. available. This is missing some features, notably the ability to
  618. schedule ETA tasks.
  619. Hopefully the `gevent`_ support will be feature complete by
  620. version 2.3, but this depends on user demand (and contributions).
  621. .. _`Eventlet`: http://eventlet.net
  622. .. _`gevent`: http://gevent.org
  623. * Python 2.4 support deprecated!
  624. We're happy^H^H^H^H^Hsad to announce that this is the last version
  625. to support Python 2.4.
  626. You are urged to make some noise if you're currently stuck with
  627. Python 2.4. Complain to your package maintainers, sysadmins and bosses:
  628. tell them it's time to move on!
  629. Apart from wanting to take advantage of with-statements, coroutines,
  630. conditional expressions and enhanced try blocks, the code base
  631. now contains so many 2.4 related hacks and workarounds it's no longer
  632. just a compromise, but a sacrifice.
  633. If it really isn't your choice, and you don't have the option to upgrade
  634. to a newer version of Python, you can just continue to use Celery 2.2.
  635. Important fixes can be backported for as long as there is interest.
  636. * `celeryd`: Now supports Autoscaling of child worker processes.
  637. The :option:`--autoscale` option can be used to configure the minimum
  638. and maximum number of child worker processes::
  639. --autoscale=AUTOSCALE
  640. Enable autoscaling by providing
  641. max_concurrency,min_concurrency. Example:
  642. --autoscale=10,3 (always keep 3 processes, but grow to
  643. 10 if necessary).
  644. * Remote Debugging of Tasks
  645. ``celery.contrib.rdb`` is an extended version of :mod:`pdb` that
  646. enables remote debugging of processes that does not have terminal
  647. access.
  648. Example usage:
  649. .. code-block:: python
  650. from celery.contrib import rdb
  651. from celery.task import task
  652. @task
  653. def add(x, y):
  654. result = x + y
  655. rdb.set_trace() # <- set breakpoint
  656. return result
  657. :func:`~celery.contrib.rdb.set_trace` sets a breakpoint at the current
  658. location and creates a socket you can telnet into to remotely debug
  659. your task.
  660. The debugger may be started by multiple processes at the same time,
  661. so rather than using a fixed port the debugger will search for an
  662. available port, starting from the base port (6900 by default).
  663. The base port can be changed using the environment variable
  664. :envvar:`CELERY_RDB_PORT`.
  665. By default the debugger will only be available from the local host,
  666. to enable access from the outside you have to set the environment
  667. variable :envvar:`CELERY_RDB_HOST`.
  668. When `celeryd` encounters your breakpoint it will log the following
  669. information::
  670. [INFO/MainProcess] Got task from broker:
  671. tasks.add[d7261c71-4962-47e5-b342-2448bedd20e8]
  672. [WARNING/PoolWorker-1] Remote Debugger:6900:
  673. Please telnet 127.0.0.1 6900. Type `exit` in session to continue.
  674. [2011-01-18 14:25:44,119: WARNING/PoolWorker-1] Remote Debugger:6900:
  675. Waiting for client...
  676. If you telnet the port specified you will be presented
  677. with a ``pdb`` shell::
  678. $ telnet localhost 6900
  679. Connected to localhost.
  680. Escape character is '^]'.
  681. > /opt/devel/demoapp/tasks.py(128)add()
  682. -> return result
  683. (Pdb)
  684. Enter ``help`` to get a list of available commands,
  685. It may be a good idea to read the `Python Debugger Manual`_ if
  686. you have never used `pdb` before.
  687. .. _`Python Debugger Manual`: http://docs.python.org/library/pdb.html
  688. * Events are now transient and is using a topic exchange (instead of direct).
  689. The `CELERYD_EVENT_EXCHANGE`, `CELERYD_EVENT_ROUTING_KEY`,
  690. `CELERYD_EVENT_EXCHANGE_TYPE` settings are no longer in use.
  691. This means events will not be stored until there is a consumer, and the
  692. events will be gone as soon as the consumer stops. Also it means there
  693. can be multiple monitors running at the same time.
  694. The routing key of an event is the type of event (e.g. `worker.started`,
  695. `worker.heartbeat`, `task.succeeded`, etc. This means a consumer can
  696. filter on specific types, to only be alerted of the events it cares about.
  697. Each consumer will create a unique queue, meaning it is in effect a
  698. broadcast exchange.
  699. This opens up a lot of possibilities, for example the workers could listen
  700. for worker events to know what workers are in the neighborhood, and even
  701. restart workers when they go down (or use this information to optimize
  702. tasks/autoscaling).
  703. .. note::
  704. The event exchange has been renamed from "celeryevent" to "celeryev"
  705. so it does not collide with older versions.
  706. If you would like to remove the old exchange you can do so
  707. by executing the following command::
  708. $ camqadm exchange.delete celeryevent
  709. * `celeryd` now starts without configuration, and configuration can be
  710. specified directly on the command line.
  711. Configuration options must appear after the last argument, separated
  712. by two dashes::
  713. $ celeryd -l info -I tasks -- broker.host=localhost broker.vhost=/app
  714. * Configuration is now an alias to the original configuration, so changes
  715. to the original will reflect Celery at runtime.
  716. * `celery.conf` has been deprecated, and modifying `celery.conf.ALWAYS_EAGER`
  717. will no longer have any effect.
  718. The default configuration is now available in the
  719. :mod:`celery.app.defaults` module. The available configuration options
  720. and their types can now be introspected.
  721. * Remote control commands are now provided by `kombu.pidbox`, the generic
  722. process mailbox.
  723. * Internal module `celery.worker.listener` has been renamed to
  724. `celery.worker.consumer`, and `.CarrotListener` is now `.Consumer`.
  725. * Previously deprecated modules `celery.models` and
  726. `celery.management.commands` have now been removed as per the deprecation
  727. timeline.
  728. * [Security: Low severity] Removed `celery.task.RemoteExecuteTask` and
  729. accompanying functions: `dmap`, `dmap_async`, and `execute_remote`.
  730. Executing arbitrary code using pickle is a potential security issue if
  731. someone gains unrestricted access to the message broker.
  732. If you really need this functionality, then you would have to add
  733. this to your own project.
  734. * [Security: Low severity] The `stats` command no longer transmits the
  735. broker password.
  736. One would have needed an authenticated broker connection to receive
  737. this password in the first place, but sniffing the password at the
  738. wire level would have been possible if using unencrypted communication.
  739. .. _v220-news:
  740. News
  741. ----
  742. * The internal module `celery.task.builtins` has been removed.
  743. * The module `celery.task.schedules` is deprecated, and
  744. `celery.schedules` should be used instead.
  745. For example if you have::
  746. from celery.task.schedules import crontab
  747. You should replace that with::
  748. from celery.schedules import crontab
  749. The module needs to be renamed because it must be possible
  750. to import schedules without importing the `celery.task` module.
  751. * The following functions have been deprecated and is scheduled for
  752. removal in version 2.3:
  753. * `celery.execute.apply_async`
  754. Use `task.apply_async()` instead.
  755. * `celery.execute.apply`
  756. Use `task.apply()` instead.
  757. * `celery.execute.delay_task`
  758. Use `registry.tasks[name].delay()` instead.
  759. * Importing `TaskSet` from `celery.task.base` is now deprecated.
  760. You should use::
  761. >>> from celery.task import TaskSet
  762. instead.
  763. * New remote control commands:
  764. * `active_queues`
  765. Returns the queue declarations a worker is currently consuming from.
  766. * Added the ability to retry publishing the task message in
  767. the event of connection loss or failure.
  768. This is disabled by default but can be enabled using the
  769. :setting:`CELERY_TASK_PUBLISH_RETRY` setting, and tweaked by
  770. the :setting:`CELERY_TASK_PUBLISH_RETRY_POLICY` setting.
  771. In addition `retry`, and `retry_policy` keyword arguments have
  772. been added to `Task.apply_async`.
  773. .. note::
  774. Using the `retry` argument to `apply_async` requires you to
  775. handle the publisher/connection manually.
  776. * Periodic Task classes (`@periodic_task`/`PeriodicTask`) will *not* be
  777. deprecated as previously indicated in the source code.
  778. But you are encouraged to use the more flexible
  779. :setting:`CELERYBEAT_SCHEDULE` setting.
  780. * Built-in daemonization support of celeryd using `celeryd-multi`
  781. is no longer experimental and is considered production quality.
  782. See :ref:`daemon-generic` if you want to use the new generic init
  783. scripts.
  784. * Added support for message compression using the
  785. :setting:`CELERY_MESSAGE_COMPRESSION` setting, or the `compression` argument
  786. to `apply_async`. This can also be set using routers.
  787. * `celeryd`: Now logs stacktrace of all threads when receiving the
  788. `SIGUSR1` signal. (Does not work on cPython 2.4, Windows or Jython).
  789. Inspired by https://gist.github.com/737056
  790. * Can now remotely terminate/kill the worker process currently processing
  791. a task.
  792. The `revoke` remote control command now supports a `terminate` argument
  793. Default signal is `TERM`, but can be specified using the `signal`
  794. argument. Signal can be the uppercase name of any signal defined
  795. in the :mod:`signal` module in the Python Standard Library.
  796. Terminating a task also revokes it.
  797. Example::
  798. >>> from celery.task.control import revoke
  799. >>> revoke(task_id, terminate=True)
  800. >>> revoke(task_id, terminate=True, signal="KILL")
  801. >>> revoke(task_id, terminate=True, signal="SIGKILL")
  802. * `TaskSetResult.join_native`: Backend-optimized version of `join()`.
  803. If available, this version uses the backends ability to retrieve
  804. multiple results at once, unlike `join()` which fetches the results
  805. one by one.
  806. So far only supported by the AMQP result backend. Support for memcached
  807. and Redis may be added later.
  808. * Improved implementations of `TaskSetResult.join` and `AsyncResult.wait`.
  809. An `interval` keyword argument have been added to both so the
  810. polling interval can be specified (default interval is 0.5 seconds).
  811. A `propagate` keyword argument have been added to `result.wait()`,
  812. errors will be returned instead of raised if this is set to False.
  813. .. warning::
  814. You should decrease the polling interval when using the database
  815. result backend, as frequent polling can result in high database load.
  816. * The PID of the child worker process accepting a task is now sent as a field
  817. with the `task-started` event.
  818. * The following fields have been added to all events in the worker class:
  819. * `sw_ident`: Name of worker software (e.g. celeryd).
  820. * `sw_ver`: Software version (e.g. 2.2.0).
  821. * `sw_sys`: Operating System (e.g. Linux, Windows, Darwin).
  822. * For better accuracy the start time reported by the multiprocessing worker
  823. process is used when calculating task duration.
  824. Previously the time reported by the accept callback was used.
  825. * `celerybeat`: New built-in daemonization support using the `--detach`
  826. option.
  827. * `celeryev`: New built-in daemonization support using the `--detach`
  828. option.
  829. * `TaskSet.apply_async`: Now supports custom publishers by using the
  830. `publisher` argument.
  831. * Added :setting:`CELERY_SEND_TASK_SENT_EVENT` setting.
  832. If enabled an event will be sent with every task, so monitors can
  833. track tasks before the workers receive them.
  834. * `celerybeat`: Now reuses the broker connection when applying
  835. scheduled tasks.
  836. * The configuration module and loader to use can now be specified on
  837. the command line.
  838. For example::
  839. $ celeryd --config=celeryconfig.py --loader=myloader.Loader
  840. * Added signals: `beat_init` and `beat_embedded_init`
  841. * :signal:`celery.signals.beat_init`
  842. Dispatched when :program:`celerybeat` starts (either standalone or
  843. embedded). Sender is the :class:`celery.beat.Service` instance.
  844. * :signal:`celery.signals.beat_embedded_init`
  845. Dispatched in addition to the :signal:`beat_init` signal when
  846. :program:`celerybeat` is started as an embedded process. Sender
  847. is the :class:`celery.beat.Service` instance.
  848. * Redis result backend: Removed deprecated settings `REDIS_TIMEOUT` and
  849. `REDIS_CONNECT_RETRY`.
  850. * CentOS init script for :program:`celeryd` now available in `contrib/centos`.
  851. * Now depends on `pyparsing` version 1.5.0 or higher.
  852. There have been reported issues using Celery with pyparsing 1.4.x,
  853. so please upgrade to the latest version.
  854. * Lots of new unit tests written, now with a total coverage of 95%.
  855. .. _v220-fixes:
  856. Fixes
  857. -----
  858. * `celeryev` Curses Monitor: Improved resize handling and UI layout
  859. (Issue #274 + Issue #276)
  860. * AMQP Backend: Exceptions occurring while sending task results are now
  861. propagated instead of silenced.
  862. `celeryd` will then show the full traceback of these errors in the log.
  863. * AMQP Backend: No longer deletes the result queue after successful
  864. poll, as this should be handled by the
  865. :setting:`CELERY_AMQP_TASK_RESULT_EXPIRES` setting instead.
  866. * AMQP Backend: Now ensures queues are declared before polling results.
  867. * Windows: celeryd: Show error if running with `-B` option.
  868. Running celerybeat embedded is known not to work on Windows, so
  869. users are encouraged to run celerybeat as a separate service instead.
  870. * Windows: Utilities no longer output ANSI color codes on Windows
  871. * camqadm: Now properly handles Ctrl+C by simply exiting instead of showing
  872. confusing traceback.
  873. * Windows: All tests are now passing on Windows.
  874. * Remove bin/ directory, and `scripts` section from setup.py.
  875. This means we now rely completely on setuptools entrypoints.
  876. .. _v220-experimental:
  877. Experimental
  878. ------------
  879. * Jython: celeryd now runs on Jython using the threaded pool.
  880. All tests pass, but there may still be bugs lurking around the corners.
  881. * PyPy: celeryd now runs on PyPy.
  882. It runs without any pool, so to get parallel execution you must start
  883. multiple instances (e.g. using :program:`celeryd-multi`).
  884. Sadly an initial benchmark seems to show a 30% performance decrease on
  885. pypy-1.4.1 + JIT. We would like to find out why this is, so stay tuned.
  886. * :class:`PublisherPool`: Experimental pool of task publishers and
  887. connections to be used with the `retry` argument to `apply_async`.
  888. The example code below will re-use connections and channels, and
  889. retry sending of the task message if the connection is lost.
  890. .. code-block:: python
  891. from celery import current_app
  892. # Global pool
  893. pool = current_app().amqp.PublisherPool(limit=10)
  894. def my_view(request):
  895. with pool.acquire() as publisher:
  896. add.apply_async((2, 2), publisher=publisher, retry=True)
  897. .. _version-2.1.4:
  898. 2.1.4
  899. =====
  900. :release-date: 2010-12-03 12:00 P.M CEST
  901. .. _v214-fixes:
  902. Fixes
  903. -----
  904. * Execution options to `apply_async` now takes precedence over options
  905. returned by active routers. This was a regression introduced recently
  906. (Issue #244).
  907. * `celeryev` curses monitor: Long arguments are now truncated so curses
  908. doesn't crash with out of bounds errors. (Issue #235).
  909. * `celeryd`: Channel errors occurring while handling control commands no
  910. longer crash the worker but are instead logged with severity error.
  911. * SQLAlchemy database backend: Fixed a race condition occurring when
  912. the client wrote the pending state. Just like the Django database backend,
  913. it does no longer save the pending state (Issue #261 + Issue #262).
  914. * Error email body now uses `repr(exception)` instead of `str(exception)`,
  915. as the latter could result in Unicode decode errors (Issue #245).
  916. * Error email timeout value is now configurable by using the
  917. :setting:`EMAIL_TIMEOUT` setting.
  918. * `celeryev`: Now works on Windows (but the curses monitor won't work without
  919. having curses).
  920. * Unit test output no longer emits non-standard characters.
  921. * `celeryd`: The broadcast consumer is now closed if the connection is reset.
  922. * `celeryd`: Now properly handles errors occurring while trying to acknowledge
  923. the message.
  924. * `TaskRequest.on_failure` now encodes traceback using the current filesystem
  925. encoding. (Issue #286).
  926. * `EagerResult` can now be pickled (Issue #288).
  927. .. _v214-documentation:
  928. Documentation
  929. -------------
  930. * Adding :ref:`contributing`.
  931. * Added :ref:`guide-optimizing`.
  932. * Added :ref:`faq-security` section to the FAQ.
  933. .. _version-2.1.3:
  934. 2.1.3
  935. =====
  936. :release-date: 2010-11-09 05:00 P.M CEST
  937. .. _v213-fixes:
  938. * Fixed deadlocks in `timer2` which could lead to `djcelerymon`/`celeryev -c`
  939. hanging.
  940. * `EventReceiver`: now sends heartbeat request to find workers.
  941. This means :program:`celeryev` and friends finds workers immediately
  942. at startup.
  943. * celeryev cursesmon: Set screen_delay to 10ms, so the screen refreshes more
  944. often.
  945. * Fixed pickling errors when pickling :class:`AsyncResult` on older Python
  946. versions.
  947. * celeryd: prefetch count was decremented by eta tasks even if there
  948. were no active prefetch limits.
  949. .. _version-2.1.2:
  950. 2.1.2
  951. =====
  952. :release-data: TBA
  953. .. _v212-fixes:
  954. Fixes
  955. -----
  956. * celeryd: Now sends the `task-retried` event for retried tasks.
  957. * celeryd: Now honors ignore result for
  958. :exc:`~celery.exceptions.WorkerLostError` and timeout errors.
  959. * celerybeat: Fixed :exc:`UnboundLocalError` in celerybeat logging
  960. when using logging setup signals.
  961. * celeryd: All log messages now includes `exc_info`.
  962. .. _version-2.1.1:
  963. 2.1.1
  964. =====
  965. :release-date: 2010-10-14 02:00 P.M CEST
  966. .. _v211-fixes:
  967. Fixes
  968. -----
  969. * Now working on Windows again.
  970. Removed dependency on the pwd/grp modules.
  971. * snapshots: Fixed race condition leading to loss of events.
  972. * celeryd: Reject tasks with an eta that cannot be converted to a time stamp.
  973. See issue #209
  974. * concurrency.processes.pool: The semaphore was released twice for each task
  975. (both at ACK and result ready).
  976. This has been fixed, and it is now released only once per task.
  977. * docs/configuration: Fixed typo `CELERYD_SOFT_TASK_TIME_LIMIT` ->
  978. :setting:`CELERYD_TASK_SOFT_TIME_LIMIT`.
  979. See issue #214
  980. * control command `dump_scheduled`: was using old .info attribute
  981. * :program:`celeryd-multi`: Fixed `set changed size during iteration` bug
  982. occurring in the restart command.
  983. * celeryd: Accidentally tried to use additional command line arguments.
  984. This would lead to an error like:
  985. `got multiple values for keyword argument 'concurrency'`.
  986. Additional command line arguments are now ignored, and does not
  987. produce this error. However -- we do reserve the right to use
  988. positional arguments in the future, so please do not depend on this
  989. behavior.
  990. * celerybeat: Now respects routers and task execution options again.
  991. * celerybeat: Now reuses the publisher instead of the connection.
  992. * Cache result backend: Using :class:`float` as the expires argument
  993. to `cache.set` is deprecated by the memcached libraries,
  994. so we now automatically cast to :class:`int`.
  995. * unit tests: No longer emits logging and warnings in test output.
  996. .. _v211-news:
  997. News
  998. ----
  999. * Now depends on carrot version 0.10.7.
  1000. * Added :setting:`CELERY_REDIRECT_STDOUTS`, and
  1001. :setting:`CELERYD_REDIRECT_STDOUTS_LEVEL` settings.
  1002. :setting:`CELERY_REDIRECT_STDOUTS` is used by :program:`celeryd` and
  1003. :program:`celerybeat`. All output to `stdout` and `stderr` will be
  1004. redirected to the current logger if enabled.
  1005. :setting:`CELERY_REDIRECT_STDOUTS_LEVEL` decides the log level used and is
  1006. :const:`WARNING` by default.
  1007. * Added :setting:`CELERYBEAT_SCHEDULER` setting.
  1008. This setting is used to define the default for the -S option to
  1009. :program:`celerybeat`.
  1010. Example:
  1011. .. code-block:: python
  1012. CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"
  1013. * Added Task.expires: Used to set default expiry time for tasks.
  1014. * New remote control commands: `add_consumer` and `cancel_consumer`.
  1015. .. method:: add_consumer(queue, exchange, exchange_type, routing_key,
  1016. **options)
  1017. :module:
  1018. Tells the worker to declare and consume from the specified
  1019. declaration.
  1020. .. method:: cancel_consumer(queue_name)
  1021. :module:
  1022. Tells the worker to stop consuming from queue (by queue name).
  1023. Commands also added to :program:`celeryctl` and
  1024. :class:`~celery.task.control.inspect`.
  1025. Example using celeryctl to start consuming from queue "queue", in
  1026. exchange "exchange", of type "direct" using binding key "key"::
  1027. $ celeryctl inspect add_consumer queue exchange direct key
  1028. $ celeryctl inspect cancel_consumer queue
  1029. See :ref:`monitoring-celeryctl` for more information about the
  1030. :program:`celeryctl` program.
  1031. Another example using :class:`~celery.task.control.inspect`:
  1032. .. code-block:: python
  1033. >>> from celery.task.control import inspect
  1034. >>> inspect.add_consumer(queue="queue", exchange="exchange",
  1035. ... exchange_type="direct",
  1036. ... routing_key="key",
  1037. ... durable=False,
  1038. ... auto_delete=True)
  1039. >>> inspect.cancel_consumer("queue")
  1040. * celerybeat: Now logs the traceback if a message can't be sent.
  1041. * celerybeat: Now enables a default socket timeout of 30 seconds.
  1042. * README/introduction/homepage: Added link to `Flask-Celery`_.
  1043. .. _`Flask-Celery`: http://github.com/ask/flask-celery
  1044. .. _version-2.1.0:
  1045. 2.1.0
  1046. =====
  1047. :release-date: 2010-10-08 12:00 P.M CEST
  1048. .. _v210-important:
  1049. Important Notes
  1050. ---------------
  1051. * Celery is now following the versioning semantics defined by `semver`_.
  1052. This means we are no longer allowed to use odd/even versioning semantics
  1053. By our previous versioning scheme this stable release should have
  1054. been version 2.2.
  1055. .. _`semver`: http://semver.org
  1056. * Now depends on Carrot 0.10.7.
  1057. * No longer depends on SQLAlchemy, this needs to be installed separately
  1058. if the database result backend is used.
  1059. * django-celery now comes with a monitor for the Django Admin interface.
  1060. This can also be used if you're not a Django user. See
  1061. :ref:`monitoring-django-admin` and :ref:`monitoring-nodjango` for more information.
  1062. * If you get an error after upgrading saying:
  1063. `AttributeError: 'module' object has no attribute 'system'`,
  1064. Then this is because the `celery.platform` module has been
  1065. renamed to `celery.platforms` to not collide with the built-in
  1066. :mod:`platform` module.
  1067. You have to remove the old :file:`platform.py` (and maybe
  1068. :file:`platform.pyc`) file from your previous Celery installation.
  1069. To do this use :program:`python` to find the location
  1070. of this module::
  1071. $ python
  1072. >>> import celery.platform
  1073. >>> celery.platform
  1074. <module 'celery.platform' from '/opt/devel/celery/celery/platform.pyc'>
  1075. Here the compiled module is in :file:`/opt/devel/celery/celery/`,
  1076. to remove the offending files do::
  1077. $ rm -f /opt/devel/celery/celery/platform.py*
  1078. .. _v210-news:
  1079. News
  1080. ----
  1081. * Added support for expiration of AMQP results (requires RabbitMQ 2.1.0)
  1082. The new configuration option :setting:`CELERY_AMQP_TASK_RESULT_EXPIRES`
  1083. sets the expiry time in seconds (can be int or float):
  1084. .. code-block:: python
  1085. CELERY_AMQP_TASK_RESULT_EXPIRES = 30 * 60 # 30 minutes.
  1086. CELERY_AMQP_TASK_RESULT_EXPIRES = 0.80 # 800 ms.
  1087. * celeryev: Event Snapshots
  1088. If enabled, :program:`celeryd` sends messages about what the worker is doing.
  1089. These messages are called "events".
  1090. The events are used by real-time monitors to show what the
  1091. cluster is doing, but they are not very useful for monitoring
  1092. over a longer period of time. Snapshots
  1093. lets you take "pictures" of the clusters state at regular intervals.
  1094. This can then be stored in a database to generate statistics
  1095. with, or even monitoring over longer time periods.
  1096. django-celery now comes with a Celery monitor for the Django
  1097. Admin interface. To use this you need to run the django-celery
  1098. snapshot camera, which stores snapshots to the database at configurable
  1099. intervals. See :ref:`monitoring-nodjango` for information about using
  1100. this monitor if you're not using Django.
  1101. To use the Django admin monitor you need to do the following:
  1102. 1. Create the new database tables.
  1103. $ python manage.py syncdb
  1104. 2. Start the django-celery snapshot camera::
  1105. $ python manage.py celerycam
  1106. 3. Open up the django admin to monitor your cluster.
  1107. The admin interface shows tasks, worker nodes, and even
  1108. lets you perform some actions, like revoking and rate limiting tasks,
  1109. and shutting down worker nodes.
  1110. There's also a Debian init.d script for :mod:`~celery.bin.celeryev` available,
  1111. see :doc:`cookbook/daemonizing` for more information.
  1112. New command line arguments to celeryev:
  1113. * :option:`-c|--camera`: Snapshot camera class to use.
  1114. * :option:`--logfile|-f`: Log file
  1115. * :option:`--loglevel|-l`: Log level
  1116. * :option:`--maxrate|-r`: Shutter rate limit.
  1117. * :option:`--freq|-F`: Shutter frequency
  1118. The :option:`--camera` argument is the name of a class used to take
  1119. snapshots with. It must support the interface defined by
  1120. :class:`celery.events.snapshot.Polaroid`.
  1121. Shutter frequency controls how often the camera thread wakes up,
  1122. while the rate limit controls how often it will actually take
  1123. a snapshot.
  1124. The rate limit can be an integer (snapshots/s), or a rate limit string
  1125. which has the same syntax as the task rate limit strings (`"200/m"`,
  1126. `"10/s"`, `"1/h",` etc).
  1127. For the Django camera case, this rate limit can be used to control
  1128. how often the snapshots are written to the database, and the frequency
  1129. used to control how often the thread wakes up to check if there's
  1130. anything new.
  1131. The rate limit is off by default, which means it will take a snapshot
  1132. for every :option:`--frequency` seconds.
  1133. .. seealso::
  1134. :ref:`monitoring-django-admin` and :ref:`monitoring-snapshots`.
  1135. * :func:`~celery.task.control.broadcast`: Added callback argument, this can be
  1136. used to process replies immediately as they arrive.
  1137. * celeryctl: New command-line utility to manage and inspect worker nodes,
  1138. apply tasks and inspect the results of tasks.
  1139. .. seealso::
  1140. The :ref:`monitoring-celeryctl` section in the :ref:`guide`.
  1141. Some examples::
  1142. $ celeryctl apply tasks.add -a '[2, 2]' --countdown=10
  1143. $ celeryctl inspect active
  1144. $ celeryctl inspect registered_tasks
  1145. $ celeryctl inspect scheduled
  1146. $ celeryctl inspect --help
  1147. $ celeryctl apply --help
  1148. * Added the ability to set an expiry date and time for tasks.
  1149. Example::
  1150. >>> # Task expires after one minute from now.
  1151. >>> task.apply_async(args, kwargs, expires=60)
  1152. >>> # Also supports datetime
  1153. >>> task.apply_async(args, kwargs,
  1154. ... expires=datetime.now() + timedelta(days=1)
  1155. When a worker receives a task that has been expired it will be
  1156. marked as revoked (:exc:`celery.exceptions.TaskRevokedError`).
  1157. * Changed the way logging is configured.
  1158. We now configure the root logger instead of only configuring
  1159. our custom logger. In addition we don't hijack
  1160. the multiprocessing logger anymore, but instead use a custom logger name
  1161. for different applications:
  1162. ===================================== =====================================
  1163. **Application** **Logger Name**
  1164. ===================================== =====================================
  1165. `celeryd` "celery"
  1166. `celerybeat` "celery.beat"
  1167. `celeryev` "celery.ev"
  1168. ===================================== =====================================
  1169. This means that the `loglevel` and `logfile` arguments will
  1170. affect all registered loggers (even those from 3rd party libraries).
  1171. Unless you configure the loggers manually as shown below, that is.
  1172. *Users can choose to configure logging by subscribing to the
  1173. :signal:`~celery.signals.setup_logging` signal:*
  1174. .. code-block:: python
  1175. from logging.config import fileConfig
  1176. from celery import signals
  1177. def setup_logging(**kwargs):
  1178. fileConfig("logging.conf")
  1179. signals.setup_logging.connect(setup_logging)
  1180. If there are no receivers for this signal, the logging subsystem
  1181. will be configured using the :option:`--loglevel`/:option:`--logfile`
  1182. argument, this will be used for *all defined loggers*.
  1183. Remember that celeryd also redirects stdout and stderr
  1184. to the celery logger, if manually configure logging
  1185. you also need to redirect the stdouts manually:
  1186. .. code-block:: python
  1187. from logging.config import fileConfig
  1188. from celery import log
  1189. def setup_logging(**kwargs):
  1190. import logging
  1191. fileConfig("logging.conf")
  1192. stdouts = logging.getLogger("mystdoutslogger")
  1193. log.redirect_stdouts_to_logger(stdouts, loglevel=logging.WARNING)
  1194. * celeryd: Added command-line option :option:`-I`/:option:`--include`:
  1195. A comma separated list of (task) modules to be imported.
  1196. Example::
  1197. $ celeryd -I app1.tasks,app2.tasks
  1198. * celeryd: now emits a warning if running as the root user (euid is 0).
  1199. * :func:`celery.messaging.establish_connection`: Ability to override defaults
  1200. used using keyword argument "defaults".
  1201. * celeryd: Now uses `multiprocessing.freeze_support()` so that it should work
  1202. with **py2exe**, **PyInstaller**, **cx_Freeze**, etc.
  1203. * celeryd: Now includes more metadata for the :state:`STARTED` state: PID and
  1204. host name of the worker that started the task.
  1205. See issue #181
  1206. * subtask: Merge additional keyword arguments to `subtask()` into task keyword
  1207. arguments.
  1208. e.g.:
  1209. >>> s = subtask((1, 2), {"foo": "bar"}, baz=1)
  1210. >>> s.args
  1211. (1, 2)
  1212. >>> s.kwargs
  1213. {"foo": "bar", "baz": 1}
  1214. See issue #182.
  1215. * celeryd: Now emits a warning if there is already a worker node using the same
  1216. name running on the same virtual host.
  1217. * AMQP result backend: Sending of results are now retried if the connection
  1218. is down.
  1219. * AMQP result backend: `result.get()`: Wait for next state if state is not
  1220. in :data:`~celery.states.READY_STATES`.
  1221. * TaskSetResult now supports subscription.
  1222. ::
  1223. >>> res = TaskSet(tasks).apply_async()
  1224. >>> res[0].get()
  1225. * Added `Task.send_error_emails` + `Task.error_whitelist`, so these can
  1226. be configured per task instead of just by the global setting.
  1227. * Added `Task.store_errors_even_if_ignored`, so it can be changed per Task,
  1228. not just by the global setting.
  1229. * The crontab scheduler no longer wakes up every second, but implements
  1230. `remaining_estimate` (*Optimization*).
  1231. * celeryd: Store :state:`FAILURE` result if the
  1232. :exc:`~celery.exceptions.WorkerLostError` exception occurs (worker process
  1233. disappeared).
  1234. * celeryd: Store :state:`FAILURE` result if one of the `*TimeLimitExceeded`
  1235. exceptions occurs.
  1236. * Refactored the periodic task responsible for cleaning up results.
  1237. * The backend cleanup task is now only added to the schedule if
  1238. :setting:`CELERY_TASK_RESULT_EXPIRES` is set.
  1239. * If the schedule already contains a periodic task named
  1240. "celery.backend_cleanup" it won't change it, so the behavior of the
  1241. backend cleanup task can be easily changed.
  1242. * The task is now run every day at 4:00 AM, rather than every day since
  1243. the first time it was run (using crontab schedule instead of
  1244. `run_every`)
  1245. * Renamed `celery.task.builtins.DeleteExpiredTaskMetaTask`
  1246. -> :class:`celery.task.builtins.backend_cleanup`
  1247. * The task itself has been renamed from "celery.delete_expired_task_meta"
  1248. to "celery.backend_cleanup"
  1249. See issue #134.
  1250. * Implemented `AsyncResult.forget` for sqla/cache/redis/tyrant backends.
  1251. (Forget and remove task result).
  1252. See issue #184.
  1253. * :meth:`TaskSetResult.join <celery.result.TaskSetResult.join>`:
  1254. Added 'propagate=True' argument.
  1255. When set to :const:`False` exceptions occurring in subtasks will
  1256. not be re-raised.
  1257. * Added `Task.update_state(task_id, state, meta)`
  1258. as a shortcut to `task.backend.store_result(task_id, meta, state)`.
  1259. The backend interface is "private" and the terminology outdated,
  1260. so better to move this to :class:`~celery.task.base.Task` so it can be
  1261. used.
  1262. * timer2: Set `self.running=False` in
  1263. :meth:`~celery.utils.timer2.Timer.stop` so it won't try to join again on
  1264. subsequent calls to `stop()`.
  1265. * Log colors are now disabled by default on Windows.
  1266. * `celery.platform` renamed to :mod:`celery.platforms`, so it doesn't
  1267. collide with the built-in :mod:`platform` module.
  1268. * Exceptions occurring in Mediator+Pool callbacks are now caught and logged
  1269. instead of taking down the worker.
  1270. * Redis result backend: Now supports result expiration using the Redis
  1271. `EXPIRE` command.
  1272. * unit tests: Don't leave threads running at tear down.
  1273. * celeryd: Task results shown in logs are now truncated to 46 chars.
  1274. * `Task.__name__` is now an alias to `self.__class__.__name__`.
  1275. This way tasks introspects more like regular functions.
  1276. * `Task.retry`: Now raises :exc:`TypeError` if kwargs argument is empty.
  1277. See issue #164.
  1278. * timedelta_seconds: Use `timedelta.total_seconds` if running on Python 2.7
  1279. * :class:`~celery.datastructures.TokenBucket`: Generic Token Bucket algorithm
  1280. * :mod:`celery.events.state`: Recording of cluster state can now
  1281. be paused and resumed, including support for buffering.
  1282. .. method:: State.freeze(buffer=True)
  1283. Pauses recording of the stream.
  1284. If `buffer` is true, events received while being frozen will be
  1285. buffered, and may be replayed later.
  1286. .. method:: State.thaw(replay=True)
  1287. Resumes recording of the stream.
  1288. If `replay` is true, then the recorded buffer will be applied.
  1289. .. method:: State.freeze_while(fun)
  1290. With a function to apply, freezes the stream before,
  1291. and replays the buffer after the function returns.
  1292. * :meth:`EventReceiver.capture <celery.events.EventReceiver.capture>`
  1293. Now supports a timeout keyword argument.
  1294. * celeryd: The mediator thread is now disabled if
  1295. :setting:`CELERY_RATE_LIMITS` is enabled, and tasks are directly sent to the
  1296. pool without going through the ready queue (*Optimization*).
  1297. .. _v210-fixes:
  1298. Fixes
  1299. -----
  1300. * Pool: Process timed out by `TimeoutHandler` must be joined by the Supervisor,
  1301. so don't remove it from the internal process list.
  1302. See issue #192.
  1303. * `TaskPublisher.delay_task` now supports exchange argument, so exchange can be
  1304. overridden when sending tasks in bulk using the same publisher
  1305. See issue #187.
  1306. * celeryd no longer marks tasks as revoked if :setting:`CELERY_IGNORE_RESULT`
  1307. is enabled.
  1308. See issue #207.
  1309. * AMQP Result backend: Fixed bug with `result.get()` if
  1310. :setting:`CELERY_TRACK_STARTED` enabled.
  1311. `result.get()` would stop consuming after receiving the
  1312. :state:`STARTED` state.
  1313. * Fixed bug where new processes created by the pool supervisor becomes stuck
  1314. while reading from the task Queue.
  1315. See http://bugs.python.org/issue10037
  1316. * Fixed timing issue when declaring the remote control command reply queue
  1317. This issue could result in replies being lost, but have now been fixed.
  1318. * Backward compatible `LoggerAdapter` implementation: Now works for Python 2.4.
  1319. Also added support for several new methods:
  1320. `fatal`, `makeRecord`, `_log`, `log`, `isEnabledFor`,
  1321. `addHandler`, `removeHandler`.
  1322. .. _v210-experimental:
  1323. Experimental
  1324. ------------
  1325. * celeryd-multi: Added daemonization support.
  1326. celeryd-multi can now be used to start, stop and restart worker nodes.
  1327. $ celeryd-multi start jerry elaine george kramer
  1328. This also creates PID files and log files (:file:`celeryd@jerry.pid`,
  1329. ..., :file:`celeryd@jerry.log`. To specify a location for these files
  1330. use the `--pidfile` and `--logfile` arguments with the `%n`
  1331. format::
  1332. $ celeryd-multi start jerry elaine george kramer \
  1333. --logfile=/var/log/celeryd@%n.log \
  1334. --pidfile=/var/run/celeryd@%n.pid
  1335. Stopping::
  1336. $ celeryd-multi stop jerry elaine george kramer
  1337. Restarting. The nodes will be restarted one by one as the old ones
  1338. are shutdown::
  1339. $ celeryd-multi restart jerry elaine george kramer
  1340. Killing the nodes (**WARNING**: Will discard currently executing tasks)::
  1341. $ celeryd-multi kill jerry elaine george kramer
  1342. See `celeryd-multi help` for help.
  1343. * celeryd-multi: `start` command renamed to `show`.
  1344. `celeryd-multi start` will now actually start and detach worker nodes.
  1345. To just generate the commands you have to use `celeryd-multi show`.
  1346. * celeryd: Added `--pidfile` argument.
  1347. The worker will write its pid when it starts. The worker will
  1348. not be started if this file exists and the pid contained is still alive.
  1349. * Added generic init.d script using `celeryd-multi`
  1350. http://github.com/ask/celery/tree/master/contrib/generic-init.d/celeryd
  1351. .. _v210-documentation:
  1352. Documentation
  1353. -------------
  1354. * Added User guide section: Monitoring
  1355. * Added user guide section: Periodic Tasks
  1356. Moved from `getting-started/periodic-tasks` and updated.
  1357. * tutorials/external moved to new section: "community".
  1358. * References has been added to all sections in the documentation.
  1359. This makes it easier to link between documents.
  1360. .. _version-2.0.3:
  1361. 2.0.3
  1362. =====
  1363. :release-date: 2010-08-27 12:00 P.M CEST
  1364. .. _v203-fixes:
  1365. Fixes
  1366. -----
  1367. * celeryd: Properly handle connection errors happening while
  1368. closing consumers.
  1369. * celeryd: Events are now buffered if the connection is down,
  1370. then sent when the connection is re-established.
  1371. * No longer depends on the :mod:`mailer` package.
  1372. This package had a name space collision with `django-mailer`,
  1373. so its functionality was replaced.
  1374. * Redis result backend: Documentation typos: Redis doesn't have
  1375. database names, but database numbers. The default database is now 0.
  1376. * :class:`~celery.task.control.inspect`:
  1377. `registered_tasks` was requesting an invalid command because of a typo.
  1378. See issue #170.
  1379. * :setting:`CELERY_ROUTES`: Values defined in the route should now have
  1380. precedence over values defined in :setting:`CELERY_QUEUES` when merging
  1381. the two.
  1382. With the follow settings::
  1383. CELERY_QUEUES = {"cpubound": {"exchange": "cpubound",
  1384. "routing_key": "cpubound"}}
  1385. CELERY_ROUTES = {"tasks.add": {"queue": "cpubound",
  1386. "routing_key": "tasks.add",
  1387. "serializer": "json"}}
  1388. The final routing options for `tasks.add` will become::
  1389. {"exchange": "cpubound",
  1390. "routing_key": "tasks.add",
  1391. "serializer": "json"}
  1392. This was not the case before: the values
  1393. in :setting:`CELERY_QUEUES` would take precedence.
  1394. * Worker crashed if the value of :setting:`CELERY_TASK_ERROR_WHITELIST` was
  1395. not an iterable
  1396. * :func:`~celery.execute.apply`: Make sure `kwargs["task_id"]` is
  1397. always set.
  1398. * `AsyncResult.traceback`: Now returns :const:`None`, instead of raising
  1399. :exc:`KeyError` if traceback is missing.
  1400. * :class:`~celery.task.control.inspect`: Replies did not work correctly
  1401. if no destination was specified.
  1402. * Can now store result/metadata for custom states.
  1403. * celeryd: A warning is now emitted if the sending of task error
  1404. emails fails.
  1405. * celeryev: Curses monitor no longer crashes if the terminal window
  1406. is resized.
  1407. See issue #160.
  1408. * celeryd: On OS X it is not possible to run `os.exec*` in a process
  1409. that is threaded.
  1410. This breaks the SIGHUP restart handler,
  1411. and is now disabled on OS X, emitting a warning instead.
  1412. See issue #152.
  1413. * :mod:`celery.execute.trace`: Properly handle `raise(str)`,
  1414. which is still allowed in Python 2.4.
  1415. See issue #175.
  1416. * Using urllib2 in a periodic task on OS X crashed because
  1417. of the proxy auto detection used in OS X.
  1418. This is now fixed by using a workaround.
  1419. See issue #143.
  1420. * Debian init scripts: Commands should not run in a sub shell
  1421. See issue #163.
  1422. * Debian init scripts: Use the absolute path of celeryd to allow stat
  1423. See issue #162.
  1424. .. _v203-documentation:
  1425. Documentation
  1426. -------------
  1427. * getting-started/broker-installation: Fixed typo
  1428. `set_permissions ""` -> `set_permissions ".*"`.
  1429. * Tasks User Guide: Added section on database transactions.
  1430. See issue #169.
  1431. * Routing User Guide: Fixed typo `"feed": -> {"queue": "feeds"}`.
  1432. See issue #169.
  1433. * Documented the default values for the :setting:`CELERYD_CONCURRENCY`
  1434. and :setting:`CELERYD_PREFETCH_MULTIPLIER` settings.
  1435. * Tasks User Guide: Fixed typos in the subtask example
  1436. * celery.signals: Documented worker_process_init.
  1437. * Daemonization cookbook: Need to export DJANGO_SETTINGS_MODULE in
  1438. `/etc/default/celeryd`.
  1439. * Added some more FAQs from stack overflow
  1440. * Daemonization cookbook: Fixed typo `CELERYD_LOGFILE/CELERYD_PIDFILE`
  1441. to `CELERYD_LOG_FILE` / `CELERYD_PID_FILE`
  1442. Also added troubleshooting section for the init scripts.
  1443. .. _version-2.0.2:
  1444. 2.0.2
  1445. =====
  1446. :release-date: 2010-07-22 11:31 A.M CEST
  1447. * Routes: When using the dict route syntax, the exchange for a task
  1448. could disappear making the task unroutable.
  1449. See issue #158.
  1450. * Test suite now passing on Python 2.4
  1451. * No longer have to type `PYTHONPATH=.` to use celeryconfig in the current
  1452. directory.
  1453. This is accomplished by the default loader ensuring that the current
  1454. directory is in `sys.path` when loading the config module.
  1455. `sys.path` is reset to its original state after loading.
  1456. Adding the current working directory to `sys.path` without the user
  1457. knowing may be a security issue, as this means someone can drop a Python module in the users
  1458. directory that executes arbitrary commands. This was the original reason
  1459. not to do this, but if done *only when loading the config module*, this
  1460. means that the behavior will only apply to the modules imported in the
  1461. config module, which I think is a good compromise (certainly better than
  1462. just explicitly setting `PYTHONPATH=.` anyway)
  1463. * Experimental Cassandra backend added.
  1464. * celeryd: SIGHUP handler accidentally propagated to worker pool processes.
  1465. In combination with 7a7c44e39344789f11b5346e9cc8340f5fe4846c
  1466. this would make each child process start a new celeryd when
  1467. the terminal window was closed :/
  1468. * celeryd: Do not install SIGHUP handler if running from a terminal.
  1469. This fixes the problem where celeryd is launched in the background
  1470. when closing the terminal.
  1471. * celeryd: Now joins threads at shutdown.
  1472. See issue #152.
  1473. * Test tear down: Don't use `atexit` but nose's `teardown()` functionality
  1474. instead.
  1475. See issue #154.
  1476. * Debian init script for celeryd: Stop now works correctly.
  1477. * Task logger: `warn` method added (synonym for `warning`)
  1478. * Can now define a white list of errors to send error emails for.
  1479. Example::
  1480. CELERY_TASK_ERROR_WHITELIST = ('myapp.MalformedInputError')
  1481. See issue #153.
  1482. * celeryd: Now handles overflow exceptions in `time.mktime` while parsing
  1483. the ETA field.
  1484. * LoggerWrapper: Try to detect loggers logging back to stderr/stdout making
  1485. an infinite loop.
  1486. * Added :class:`celery.task.control.inspect`: Inspects a running worker.
  1487. Examples::
  1488. # Inspect a single worker
  1489. >>> i = inspect("myworker.example.com")
  1490. # Inspect several workers
  1491. >>> i = inspect(["myworker.example.com", "myworker2.example.com"])
  1492. # Inspect all workers consuming on this vhost.
  1493. >>> i = inspect()
  1494. ### Methods
  1495. # Get currently executing tasks
  1496. >>> i.active()
  1497. # Get currently reserved tasks
  1498. >>> i.reserved()
  1499. # Get the current eta schedule
  1500. >>> i.scheduled()
  1501. # Worker statistics and info
  1502. >>> i.stats()
  1503. # List of currently revoked tasks
  1504. >>> i.revoked()
  1505. # List of registered tasks
  1506. >>> i.registered_tasks()
  1507. * Remote control commands `dump_active`/`dump_reserved`/`dump_schedule`
  1508. now replies with detailed task requests.
  1509. Containing the original arguments and fields of the task requested.
  1510. In addition the remote control command `set_loglevel` has been added,
  1511. this only changes the log level for the main process.
  1512. * Worker control command execution now catches errors and returns their
  1513. string representation in the reply.
  1514. * Functional test suite added
  1515. :mod:`celery.tests.functional.case` contains utilities to start
  1516. and stop an embedded celeryd process, for use in functional testing.
  1517. .. _version-2.0.1:
  1518. 2.0.1
  1519. =====
  1520. :release-date: 2010-07-09 03:02 P.M CEST
  1521. * multiprocessing.pool: Now handles encoding errors, so that pickling errors
  1522. doesn't crash the worker processes.
  1523. * The remote control command replies was not working with RabbitMQ 1.8.0's
  1524. stricter equivalence checks.
  1525. If you've already hit this problem you may have to delete the
  1526. declaration::
  1527. $ camqadm exchange.delete celerycrq
  1528. or::
  1529. $ python manage.py camqadm exchange.delete celerycrq
  1530. * A bug sneaked in the ETA scheduler that made it only able to execute
  1531. one task per second(!)
  1532. The scheduler sleeps between iterations so it doesn't consume too much CPU.
  1533. It keeps a list of the scheduled items sorted by time, at each iteration
  1534. it sleeps for the remaining time of the item with the nearest deadline.
  1535. If there are no eta tasks it will sleep for a minimum amount of time, one
  1536. second by default.
  1537. A bug sneaked in here, making it sleep for one second for every task
  1538. that was scheduled. This has been fixed, so now it should move
  1539. tasks like hot knife through butter.
  1540. In addition a new setting has been added to control the minimum sleep
  1541. interval; :setting:`CELERYD_ETA_SCHEDULER_PRECISION`. A good
  1542. value for this would be a float between 0 and 1, depending
  1543. on the needed precision. A value of 0.8 means that when the ETA of a task
  1544. is met, it will take at most 0.8 seconds for the task to be moved to the
  1545. ready queue.
  1546. * Pool: Supervisor did not release the semaphore.
  1547. This would lead to a deadlock if all workers terminated prematurely.
  1548. * Added Python version trove classifiers: 2.4, 2.5, 2.6 and 2.7
  1549. * Tests now passing on Python 2.7.
  1550. * Task.__reduce__: Tasks created using the task decorator can now be pickled.
  1551. * setup.py: nose added to `tests_require`.
  1552. * Pickle should now work with SQLAlchemy 0.5.x
  1553. * New homepage design by Jan Henrik Helmers: http://celeryproject.org
  1554. * New Sphinx theme by Armin Ronacher: http://docs.celeryproject.org/
  1555. * Fixed "pending_xref" errors shown in the HTML rendering of the
  1556. documentation. Apparently this was caused by new changes in Sphinx 1.0b2.
  1557. * Router classes in :setting:`CELERY_ROUTES` are now imported lazily.
  1558. Importing a router class in a module that also loads the Celery
  1559. environment would cause a circular dependency. This is solved
  1560. by importing it when needed after the environment is set up.
  1561. * :setting:`CELERY_ROUTES` was broken if set to a single dict.
  1562. This example in the docs should now work again::
  1563. CELERY_ROUTES = {"feed.tasks.import_feed": "feeds"}
  1564. * `CREATE_MISSING_QUEUES` was not honored by apply_async.
  1565. * New remote control command: `stats`
  1566. Dumps information about the worker, like pool process ids, and
  1567. total number of tasks executed by type.
  1568. Example reply::
  1569. [{'worker.local':
  1570. 'total': {'tasks.sleeptask': 6},
  1571. 'pool': {'timeouts': [None, None],
  1572. 'processes': [60376, 60377],
  1573. 'max-concurrency': 2,
  1574. 'max-tasks-per-child': None,
  1575. 'put-guarded-by-semaphore': True}}]
  1576. * New remote control command: `dump_active`
  1577. Gives a list of tasks currently being executed by the worker.
  1578. By default arguments are passed through repr in case there
  1579. are arguments that is not JSON encodable. If you know
  1580. the arguments are JSON safe, you can pass the argument `safe=True`.
  1581. Example reply::
  1582. >>> broadcast("dump_active", arguments={"safe": False}, reply=True)
  1583. [{'worker.local': [
  1584. {'args': '(1,)',
  1585. 'time_start': 1278580542.6300001,
  1586. 'name': 'tasks.sleeptask',
  1587. 'delivery_info': {
  1588. 'consumer_tag': '30',
  1589. 'routing_key': 'celery',
  1590. 'exchange': 'celery'},
  1591. 'hostname': 'casper.local',
  1592. 'acknowledged': True,
  1593. 'kwargs': '{}',
  1594. 'id': '802e93e9-e470-47ed-b913-06de8510aca2',
  1595. }
  1596. ]}]
  1597. * Added experimental support for persistent revokes.
  1598. Use the `-S|--statedb` argument to celeryd to enable it::
  1599. $ celeryd --statedb=/var/run/celeryd
  1600. This will use the file: `/var/run/celeryd.db`,
  1601. as the `shelve` module automatically adds the `.db` suffix.
  1602. .. _version-2.0.0:
  1603. 2.0.0
  1604. =====
  1605. :release-date: 2010-07-02 02:30 P.M CEST
  1606. Foreword
  1607. --------
  1608. Celery 2.0 contains backward incompatible changes, the most important
  1609. being that the Django dependency has been removed so Celery no longer
  1610. supports Django out of the box, but instead as an add-on package
  1611. called `django-celery`_.
  1612. We're very sorry for breaking backwards compatibility, but there's
  1613. also many new and exciting features to make up for the time you lose
  1614. upgrading, so be sure to read the :ref:`News <v200-news>` section.
  1615. Quite a lot of potential users have been upset about the Django dependency,
  1616. so maybe this is a chance to get wider adoption by the Python community as
  1617. well.
  1618. Big thanks to all contributors, testers and users!
  1619. .. _v200-django-upgrade:
  1620. Upgrading for Django-users
  1621. --------------------------
  1622. Django integration has been moved to a separate package: `django-celery`_.
  1623. * To upgrade you need to install the `django-celery`_ module and change::
  1624. INSTALLED_APPS = "celery"
  1625. to::
  1626. INSTALLED_APPS = "djcelery"
  1627. * If you use `mod_wsgi` you need to add the following line to your `.wsgi`
  1628. file::
  1629. import os
  1630. os.environ["CELERY_LOADER"] = "django"
  1631. * The following modules has been moved to `django-celery`_:
  1632. ===================================== =====================================
  1633. **Module name** **Replace with**
  1634. ===================================== =====================================
  1635. `celery.models` `djcelery.models`
  1636. `celery.managers` `djcelery.managers`
  1637. `celery.views` `djcelery.views`
  1638. `celery.urls` `djcelery.urls`
  1639. `celery.management` `djcelery.management`
  1640. `celery.loaders.djangoapp` `djcelery.loaders`
  1641. `celery.backends.database` `djcelery.backends.database`
  1642. `celery.backends.cache` `djcelery.backends.cache`
  1643. ===================================== =====================================
  1644. Importing :mod:`djcelery` will automatically setup Celery to use Django loader.
  1645. loader. It does this by setting the :envvar:`CELERY_LOADER` environment variable to
  1646. `"django"` (it won't change it if a loader is already set.)
  1647. When the Django loader is used, the "database" and "cache" result backend
  1648. aliases will point to the :mod:`djcelery` backends instead of the built-in backends,
  1649. and configuration will be read from the Django settings.
  1650. .. _`django-celery`: http://pypi.python.org/pypi/django-celery
  1651. .. _v200-upgrade:
  1652. Upgrading for others
  1653. --------------------
  1654. .. _v200-upgrade-database:
  1655. Database result backend
  1656. ~~~~~~~~~~~~~~~~~~~~~~~
  1657. The database result backend is now using `SQLAlchemy`_ instead of the
  1658. Django ORM, see `Supported Databases`_ for a table of supported databases.
  1659. The `DATABASE_*` settings has been replaced by a single setting:
  1660. :setting:`CELERY_RESULT_DBURI`. The value here should be an
  1661. `SQLAlchemy Connection String`_, some examples include:
  1662. .. code-block:: python
  1663. # sqlite (filename)
  1664. CELERY_RESULT_DBURI = "sqlite:///celerydb.sqlite"
  1665. # mysql
  1666. CELERY_RESULT_DBURI = "mysql://scott:tiger@localhost/foo"
  1667. # postgresql
  1668. CELERY_RESULT_DBURI = "postgresql://scott:tiger@localhost/mydatabase"
  1669. # oracle
  1670. CELERY_RESULT_DBURI = "oracle://scott:tiger@127.0.0.1:1521/sidname"
  1671. See `SQLAlchemy Connection Strings`_ for more information about connection
  1672. strings.
  1673. To specify additional SQLAlchemy database engine options you can use
  1674. the :setting:`CELERY_RESULT_ENGINE_OPTIONS` setting::
  1675. # echo enables verbose logging from SQLAlchemy.
  1676. CELERY_RESULT_ENGINE_OPTIONS = {"echo": True}
  1677. .. _`SQLAlchemy`:
  1678. http://www.sqlalchemy.org
  1679. .. _`Supported Databases`:
  1680. http://www.sqlalchemy.org/docs/core/engines.html#supported-databases
  1681. .. _`SQLAlchemy Connection String`:
  1682. http://www.sqlalchemy.org/docs/core/engines.html#database-urls
  1683. .. _`SQLAlchemy Connection Strings`:
  1684. http://www.sqlalchemy.org/docs/core/engines.html#database-urls
  1685. .. _v200-upgrade-cache:
  1686. Cache result backend
  1687. ~~~~~~~~~~~~~~~~~~~~
  1688. The cache result backend is no longer using the Django cache framework,
  1689. but it supports mostly the same configuration syntax::
  1690. CELERY_CACHE_BACKEND = "memcached://A.example.com:11211;B.example.com"
  1691. To use the cache backend you must either have the `pylibmc`_ or
  1692. `python-memcached`_ library installed, of which the former is regarded
  1693. as the best choice.
  1694. .. _`pylibmc`: http://pypi.python.org/pypi/pylibmc
  1695. .. _`python-memcached`: http://pypi.python.org/pypi/python-memcached
  1696. The support backend types are `memcached://` and `memory://`,
  1697. we haven't felt the need to support any of the other backends
  1698. provided by Django.
  1699. .. _v200-incompatible:
  1700. Backward incompatible changes
  1701. -----------------------------
  1702. * Default (python) loader now prints warning on missing `celeryconfig.py`
  1703. instead of raising :exc:`ImportError`.
  1704. celeryd raises :exc:`~celery.exceptions.ImproperlyConfigured` if the configuration
  1705. is not set up. This makes it possible to use `--help` etc., without having a
  1706. working configuration.
  1707. Also this makes it possible to use the client side of celery without being
  1708. configured::
  1709. >>> from carrot.connection import BrokerConnection
  1710. >>> conn = BrokerConnection("localhost", "guest", "guest", "/")
  1711. >>> from celery.execute import send_task
  1712. >>> r = send_task("celery.ping", args=(), kwargs={}, connection=conn)
  1713. >>> from celery.backends.amqp import AMQPBackend
  1714. >>> r.backend = AMQPBackend(connection=conn)
  1715. >>> r.get()
  1716. 'pong'
  1717. * The following deprecated settings has been removed (as scheduled by
  1718. the `deprecation timeline`_):
  1719. ===================================== =====================================
  1720. **Setting name** **Replace with**
  1721. ===================================== =====================================
  1722. `CELERY_AMQP_CONSUMER_QUEUES` `CELERY_QUEUES`
  1723. `CELERY_AMQP_EXCHANGE` `CELERY_DEFAULT_EXCHANGE`
  1724. `CELERY_AMQP_EXCHANGE_TYPE` `CELERY_DEFAULT_EXCHANGE_TYPE`
  1725. `CELERY_AMQP_CONSUMER_ROUTING_KEY` `CELERY_QUEUES`
  1726. `CELERY_AMQP_PUBLISHER_ROUTING_KEY` `CELERY_DEFAULT_ROUTING_KEY`
  1727. ===================================== =====================================
  1728. .. _`deprecation timeline`:
  1729. http://ask.github.com/celery/internals/deprecation.html
  1730. * The `celery.task.rest` module has been removed, use :mod:`celery.task.http`
  1731. instead (as scheduled by the `deprecation timeline`_).
  1732. * It's no longer allowed to skip the class name in loader names.
  1733. (as scheduled by the `deprecation timeline`_):
  1734. Assuming the implicit `Loader` class name is no longer supported,
  1735. if you use e.g.::
  1736. CELERY_LOADER = "myapp.loaders"
  1737. You need to include the loader class name, like this::
  1738. CELERY_LOADER = "myapp.loaders.Loader"
  1739. * :setting:`CELERY_TASK_RESULT_EXPIRES` now defaults to 1 day.
  1740. Previous default setting was to expire in 5 days.
  1741. * AMQP backend: Don't use different values for `auto_delete`.
  1742. This bug became visible with RabbitMQ 1.8.0, which no longer
  1743. allows conflicting declarations for the auto_delete and durable settings.
  1744. If you've already used celery with this backend chances are you
  1745. have to delete the previous declaration::
  1746. $ camqadm exchange.delete celeryresults
  1747. * Now uses pickle instead of cPickle on Python versions <= 2.5
  1748. cPickle is broken in Python <= 2.5.
  1749. It unsafely and incorrectly uses relative instead of absolute imports,
  1750. so e.g.::
  1751. exceptions.KeyError
  1752. becomes::
  1753. celery.exceptions.KeyError
  1754. Your best choice is to upgrade to Python 2.6,
  1755. as while the pure pickle version has worse performance,
  1756. it is the only safe option for older Python versions.
  1757. .. _v200-news:
  1758. News
  1759. ----
  1760. * **celeryev**: Curses Celery Monitor and Event Viewer.
  1761. This is a simple monitor allowing you to see what tasks are
  1762. executing in real-time and investigate tracebacks and results of ready
  1763. tasks. It also enables you to set new rate limits and revoke tasks.
  1764. Screenshot:
  1765. .. figure:: images/celeryevshotsm.jpg
  1766. If you run `celeryev` with the `-d` switch it will act as an event
  1767. dumper, simply dumping the events it receives to standard out::
  1768. $ celeryev -d
  1769. -> celeryev: starting capture...
  1770. casper.local [2010-06-04 10:42:07.020000] heartbeat
  1771. casper.local [2010-06-04 10:42:14.750000] task received:
  1772. tasks.add(61a68756-27f4-4879-b816-3cf815672b0e) args=[2, 2] kwargs={}
  1773. eta=2010-06-04T10:42:16.669290, retries=0
  1774. casper.local [2010-06-04 10:42:17.230000] task started
  1775. tasks.add(61a68756-27f4-4879-b816-3cf815672b0e) args=[2, 2] kwargs={}
  1776. casper.local [2010-06-04 10:42:17.960000] task succeeded:
  1777. tasks.add(61a68756-27f4-4879-b816-3cf815672b0e)
  1778. args=[2, 2] kwargs={} result=4, runtime=0.782663106918
  1779. The fields here are, in order: *sender hostname*, *timestamp*, *event type* and
  1780. *additional event fields*.
  1781. * AMQP result backend: Now supports `.ready()`, `.successful()`,
  1782. `.result`, `.status`, and even responds to changes in task state
  1783. * New user guides:
  1784. * :doc:`userguide/workers`
  1785. * :doc:`userguide/tasksets`
  1786. * :doc:`userguide/routing`
  1787. * celeryd: Standard out/error is now being redirected to the log file.
  1788. * :mod:`billiard` has been moved back to the celery repository.
  1789. ===================================== =====================================
  1790. **Module name** **celery equivalent**
  1791. ===================================== =====================================
  1792. `billiard.pool` `celery.concurrency.processes.pool`
  1793. `billiard.serialization` `celery.serialization`
  1794. `billiard.utils.functional` `celery.utils.functional`
  1795. ===================================== =====================================
  1796. The :mod:`billiard` distribution may be maintained, depending on interest.
  1797. * now depends on :mod:`carrot` >= 0.10.5
  1798. * now depends on :mod:`pyparsing`
  1799. * celeryd: Added `--purge` as an alias to `--discard`.
  1800. * celeryd: Ctrl+C (SIGINT) once does warm shutdown, hitting Ctrl+C twice
  1801. forces termination.
  1802. * Added support for using complex crontab-expressions in periodic tasks. For
  1803. example, you can now use::
  1804. >>> crontab(minute="*/15")
  1805. or even::
  1806. >>> crontab(minute="*/30", hour="8-17,1-2", day_of_week="thu-fri")
  1807. See :doc:`userguide/periodic-tasks`.
  1808. * celeryd: Now waits for available pool processes before applying new
  1809. tasks to the pool.
  1810. This means it doesn't have to wait for dozens of tasks to finish at shutdown
  1811. because it has applied prefetched tasks without having any pool
  1812. processes available to immediately accept them.
  1813. See issue #122.
  1814. * New built-in way to do task callbacks using
  1815. :class:`~celery.task.sets.subtask`.
  1816. See :doc:`userguide/tasksets` for more information.
  1817. * TaskSets can now contain several types of tasks.
  1818. :class:`~celery.task.sets.TaskSet` has been refactored to use
  1819. a new syntax, please see :doc:`userguide/tasksets` for more information.
  1820. The previous syntax is still supported, but will be deprecated in
  1821. version 1.4.
  1822. * TaskSet failed() result was incorrect.
  1823. See issue #132.
  1824. * Now creates different loggers per task class.
  1825. See issue #129.
  1826. * Missing queue definitions are now created automatically.
  1827. You can disable this using the :setting:`CELERY_CREATE_MISSING_QUEUES`
  1828. setting.
  1829. The missing queues are created with the following options::
  1830. CELERY_QUEUES[name] = {"exchange": name,
  1831. "exchange_type": "direct",
  1832. "routing_key": "name}
  1833. This feature is added for easily setting up routing using the `-Q`
  1834. option to `celeryd`::
  1835. $ celeryd -Q video, image
  1836. See the new routing section of the User Guide for more information:
  1837. :doc:`userguide/routing`.
  1838. * New Task option: `Task.queue`
  1839. If set, message options will be taken from the corresponding entry
  1840. in :setting:`CELERY_QUEUES`. `exchange`, `exchange_type` and `routing_key`
  1841. will be ignored
  1842. * Added support for task soft and hard time limits.
  1843. New settings added:
  1844. * :setting:`CELERYD_TASK_TIME_LIMIT`
  1845. Hard time limit. The worker processing the task will be killed and
  1846. replaced with a new one when this is exceeded.
  1847. * :setting:`CELERYD_SOFT_TASK_TIME_LIMIT`
  1848. Soft time limit. The :exc:`celery.exceptions.SoftTimeLimitExceeded`
  1849. exception will be raised when this is exceeded. The task can catch
  1850. this to e.g. clean up before the hard time limit comes.
  1851. New command line arguments to celeryd added:
  1852. `--time-limit` and `--soft-time-limit`.
  1853. What's left?
  1854. This won't work on platforms not supporting signals (and specifically
  1855. the `SIGUSR1` signal) yet. So an alternative the ability to disable
  1856. the feature all together on nonconforming platforms must be implemented.
  1857. Also when the hard time limit is exceeded, the task result should
  1858. be a `TimeLimitExceeded` exception.
  1859. * Test suite is now passing without a running broker, using the carrot
  1860. in-memory backend.
  1861. * Log output is now available in colors.
  1862. ===================================== =====================================
  1863. **Log level** **Color**
  1864. ===================================== =====================================
  1865. `DEBUG` Blue
  1866. `WARNING` Yellow
  1867. `CRITICAL` Magenta
  1868. `ERROR` Red
  1869. ===================================== =====================================
  1870. This is only enabled when the log output is a tty.
  1871. You can explicitly enable/disable this feature using the
  1872. :setting:`CELERYD_LOG_COLOR` setting.
  1873. * Added support for task router classes (like the django multi-db routers)
  1874. * New setting: :setting:`CELERY_ROUTES`
  1875. This is a single, or a list of routers to traverse when
  1876. sending tasks. Dictionaries in this list converts to a
  1877. :class:`celery.routes.MapRoute` instance.
  1878. Examples:
  1879. >>> CELERY_ROUTES = {"celery.ping": "default",
  1880. "mytasks.add": "cpu-bound",
  1881. "video.encode": {
  1882. "queue": "video",
  1883. "exchange": "media"
  1884. "routing_key": "media.video.encode"}}
  1885. >>> CELERY_ROUTES = ("myapp.tasks.Router",
  1886. {"celery.ping": "default})
  1887. Where `myapp.tasks.Router` could be:
  1888. .. code-block:: python
  1889. class Router(object):
  1890. def route_for_task(self, task, args=None, kwargs=None):
  1891. if task == "celery.ping":
  1892. return "default"
  1893. route_for_task may return a string or a dict. A string then means
  1894. it's a queue name in :setting:`CELERY_QUEUES`, a dict means it's a custom route.
  1895. When sending tasks, the routers are consulted in order. The first
  1896. router that doesn't return `None` is the route to use. The message options
  1897. is then merged with the found route settings, where the routers settings
  1898. have priority.
  1899. Example if :func:`~celery.execute.apply_async` has these arguments::
  1900. >>> Task.apply_async(immediate=False, exchange="video",
  1901. ... routing_key="video.compress")
  1902. and a router returns::
  1903. {"immediate": True,
  1904. "exchange": "urgent"}
  1905. the final message options will be::
  1906. immediate=True, exchange="urgent", routing_key="video.compress"
  1907. (and any default message options defined in the
  1908. :class:`~celery.task.base.Task` class)
  1909. * New Task handler called after the task returns:
  1910. :meth:`~celery.task.base.Task.after_return`.
  1911. * :class:`~celery.datastructures.ExceptionInfo` now passed to
  1912. :meth:`~celery.task.base.Task.on_retry`/
  1913. :meth:`~celery.task.base.Task.on_failure` as einfo keyword argument.
  1914. * celeryd: Added :setting:`CELERYD_MAX_TASKS_PER_CHILD` /
  1915. :option:`--maxtasksperchild`
  1916. Defines the maximum number of tasks a pool worker can process before
  1917. the process is terminated and replaced by a new one.
  1918. * Revoked tasks now marked with state :state:`REVOKED`, and `result.get()`
  1919. will now raise :exc:`~celery.exceptions.TaskRevokedError`.
  1920. * :func:`celery.task.control.ping` now works as expected.
  1921. * `apply(throw=True)` / :setting:`CELERY_EAGER_PROPAGATES_EXCEPTIONS`:
  1922. Makes eager execution re-raise task errors.
  1923. * New signal: :signal:`~celery.signals.worker_process_init`: Sent inside the
  1924. pool worker process at init.
  1925. * celeryd :option:`-Q` option: Ability to specify list of queues to use,
  1926. disabling other configured queues.
  1927. For example, if :setting:`CELERY_QUEUES` defines four
  1928. queues: `image`, `video`, `data` and `default`, the following
  1929. command would make celeryd only consume from the `image` and `video`
  1930. queues::
  1931. $ celeryd -Q image,video
  1932. * celeryd: New return value for the `revoke` control command:
  1933. Now returns::
  1934. {"ok": "task $id revoked"}
  1935. instead of `True`.
  1936. * celeryd: Can now enable/disable events using remote control
  1937. Example usage:
  1938. >>> from celery.task.control import broadcast
  1939. >>> broadcast("enable_events")
  1940. >>> broadcast("disable_events")
  1941. * Removed top-level tests directory. Test config now in celery.tests.config
  1942. This means running the unit tests doesn't require any special setup.
  1943. `celery/tests/__init__` now configures the :envvar:`CELERY_CONFIG_MODULE`
  1944. and :envvar:`CELERY_LOADER` environment variables, so when `nosetests`
  1945. imports that, the unit test environment is all set up.
  1946. Before you run the tests you need to install the test requirements::
  1947. $ pip install -r contrib/requirements/test.txt
  1948. Running all tests::
  1949. $ nosetests
  1950. Specifying the tests to run::
  1951. $ nosetests celery.tests.test_task
  1952. Producing HTML coverage::
  1953. $ nosetests --with-coverage3
  1954. The coverage output is then located in `celery/tests/cover/index.html`.
  1955. * celeryd: New option `--version`: Dump version info and exit.
  1956. * :mod:`celeryd-multi <celeryd.bin.celeryd_multi>`: Tool for shell scripts
  1957. to start multiple workers.
  1958. Some examples::
  1959. # Advanced example with 10 workers:
  1960. # * Three of the workers processes the images and video queue
  1961. # * Two of the workers processes the data queue with loglevel DEBUG
  1962. # * the rest processes the default' queue.
  1963. $ celeryd-multi start 10 -l INFO -Q:1-3 images,video -Q:4,5:data
  1964. -Q default -L:4,5 DEBUG
  1965. # get commands to start 10 workers, with 3 processes each
  1966. $ celeryd-multi start 3 -c 3
  1967. celeryd -n celeryd1.myhost -c 3
  1968. celeryd -n celeryd2.myhost -c 3
  1969. celeryd- n celeryd3.myhost -c 3
  1970. # start 3 named workers
  1971. $ celeryd-multi start image video data -c 3
  1972. celeryd -n image.myhost -c 3
  1973. celeryd -n video.myhost -c 3
  1974. celeryd -n data.myhost -c 3
  1975. # specify custom hostname
  1976. $ celeryd-multi start 2 -n worker.example.com -c 3
  1977. celeryd -n celeryd1.worker.example.com -c 3
  1978. celeryd -n celeryd2.worker.example.com -c 3
  1979. # Additionl options are added to each celeryd',
  1980. # but you can also modify the options for ranges of or single workers
  1981. # 3 workers: Two with 3 processes, and one with 10 processes.
  1982. $ celeryd-multi start 3 -c 3 -c:1 10
  1983. celeryd -n celeryd1.myhost -c 10
  1984. celeryd -n celeryd2.myhost -c 3
  1985. celeryd -n celeryd3.myhost -c 3
  1986. # can also specify options for named workers
  1987. $ celeryd-multi start image video data -c 3 -c:image 10
  1988. celeryd -n image.myhost -c 10
  1989. celeryd -n video.myhost -c 3
  1990. celeryd -n data.myhost -c 3
  1991. # ranges and lists of workers in options is also allowed:
  1992. # (-c:1-3 can also be written as -c:1,2,3)
  1993. $ celeryd-multi start 5 -c 3 -c:1-3 10
  1994. celeryd-multi -n celeryd1.myhost -c 10
  1995. celeryd-multi -n celeryd2.myhost -c 10
  1996. celeryd-multi -n celeryd3.myhost -c 10
  1997. celeryd-multi -n celeryd4.myhost -c 3
  1998. celeryd-multi -n celeryd5.myhost -c 3
  1999. # lists also works with named workers
  2000. $ celeryd-multi start foo bar baz xuzzy -c 3 -c:foo,bar,baz 10
  2001. celeryd-multi -n foo.myhost -c 10
  2002. celeryd-multi -n bar.myhost -c 10
  2003. celeryd-multi -n baz.myhost -c 10
  2004. celeryd-multi -n xuzzy.myhost -c 3
  2005. * The worker now calls the result backends `process_cleanup` method
  2006. *after* task execution instead of before.
  2007. * AMQP result backend now supports Pika.
  2008. .. _version-1.0.6:
  2009. 1.0.6
  2010. =====
  2011. :release-date: 2010-06-30 09:57 A.M CEST
  2012. * RabbitMQ 1.8.0 has extended their exchange equivalence tests to
  2013. include `auto_delete` and `durable`. This broke the AMQP backend.
  2014. If you've already used the AMQP backend this means you have to
  2015. delete the previous definitions::
  2016. $ camqadm exchange.delete celeryresults
  2017. or::
  2018. $ python manage.py camqadm exchange.delete celeryresults
  2019. .. _version-1.0.5:
  2020. 1.0.5
  2021. =====
  2022. :release-date: 2010-06-01 02:36 P.M CEST
  2023. .. _v105-critical:
  2024. Critical
  2025. --------
  2026. * SIGINT/Ctrl+C killed the pool, abruptly terminating the currently executing
  2027. tasks.
  2028. Fixed by making the pool worker processes ignore :const:`SIGINT`.
  2029. * Should not close the consumers before the pool is terminated, just cancel
  2030. the consumers.
  2031. See issue #122.
  2032. * Now depends on :mod:`billiard` >= 0.3.1
  2033. * celeryd: Previously exceptions raised by worker components could stall startup,
  2034. now it correctly logs the exceptions and shuts down.
  2035. * celeryd: Prefetch counts was set too late. QoS is now set as early as possible,
  2036. so celeryd can't slurp in all the messages at start-up.
  2037. .. _v105-changes:
  2038. Changes
  2039. -------
  2040. * :mod:`celery.contrib.abortable`: Abortable tasks.
  2041. Tasks that defines steps of execution, the task can then
  2042. be aborted after each step has completed.
  2043. * :class:`~celery.events.EventDispatcher`: No longer creates AMQP channel
  2044. if events are disabled
  2045. * Added required RPM package names under `[bdist_rpm]` section, to support building RPMs
  2046. from the sources using setup.py
  2047. * Running unit tests: :envvar:`NOSE_VERBOSE` environment var now enables verbose output from Nose.
  2048. * :func:`celery.execute.apply`: Pass log file/log level arguments as task kwargs.
  2049. See issue #110.
  2050. * celery.execute.apply: Should return exception, not :class:`~celery.datastructures.ExceptionInfo`
  2051. on error.
  2052. See issue #111.
  2053. * Added new entries to the :doc:`FAQs <faq>`:
  2054. * Should I use retry or acks_late?
  2055. * Can I execute a task by name?
  2056. .. _version-1.0.4:
  2057. 1.0.4
  2058. =====
  2059. :release-date: 2010-05-31 09:54 A.M CEST
  2060. * Changelog merged with 1.0.5 as the release was never announced.
  2061. .. _version-1.0.3:
  2062. 1.0.3
  2063. =====
  2064. :release-date: 2010-05-15 03:00 P.M CEST
  2065. .. _v103-important:
  2066. Important notes
  2067. ---------------
  2068. * Messages are now acknowledged *just before* the task function is executed.
  2069. This is the behavior we've wanted all along, but couldn't have because of
  2070. limitations in the multiprocessing module.
  2071. The previous behavior was not good, and the situation worsened with the
  2072. release of 1.0.1, so this change will definitely improve
  2073. reliability, performance and operations in general.
  2074. For more information please see http://bit.ly/9hom6T
  2075. * Database result backend: result now explicitly sets `null=True` as
  2076. `django-picklefield` version 0.1.5 changed the default behavior
  2077. right under our noses :(
  2078. See: http://bit.ly/d5OwMr
  2079. This means those who created their celery tables (via syncdb or
  2080. celeryinit) with picklefield versions >= 0.1.5 has to alter their tables to
  2081. allow the result field to be `NULL` manually.
  2082. MySQL::
  2083. ALTER TABLE celery_taskmeta MODIFY result TEXT NULL
  2084. PostgreSQL::
  2085. ALTER TABLE celery_taskmeta ALTER COLUMN result DROP NOT NULL
  2086. * Removed `Task.rate_limit_queue_type`, as it was not really useful
  2087. and made it harder to refactor some parts.
  2088. * Now depends on carrot >= 0.10.4
  2089. * Now depends on billiard >= 0.3.0
  2090. .. _v103-news:
  2091. News
  2092. ----
  2093. * AMQP backend: Added timeout support for `result.get()` /
  2094. `result.wait()`.
  2095. * New task option: `Task.acks_late` (default: :setting:`CELERY_ACKS_LATE`)
  2096. Late ack means the task messages will be acknowledged **after** the task
  2097. has been executed, not *just before*, which is the default behavior.
  2098. .. note::
  2099. This means the tasks may be executed twice if the worker
  2100. crashes in mid-execution. Not acceptable for most
  2101. applications, but desirable for others.
  2102. * Added crontab-like scheduling to periodic tasks.
  2103. Like a cron job, you can specify units of time of when
  2104. you would like the task to execute. While not a full implementation
  2105. of cron's features, it should provide a fair degree of common scheduling
  2106. needs.
  2107. You can specify a minute (0-59), an hour (0-23), and/or a day of the
  2108. week (0-6 where 0 is Sunday, or by names: sun, mon, tue, wed, thu, fri,
  2109. sat).
  2110. Examples:
  2111. .. code-block:: python
  2112. from celery.schedules import crontab
  2113. from celery.decorators import periodic_task
  2114. @periodic_task(run_every=crontab(hour=7, minute=30))
  2115. def every_morning():
  2116. print("Runs every morning at 7:30a.m")
  2117. @periodic_task(run_every=crontab(hour=7, minute=30, day_of_week="mon"))
  2118. def every_monday_morning():
  2119. print("Run every monday morning at 7:30a.m")
  2120. @periodic_task(run_every=crontab(minutes=30))
  2121. def every_hour():
  2122. print("Runs every hour on the clock. e.g. 1:30, 2:30, 3:30 etc.")
  2123. .. note::
  2124. This a late addition. While we have unittests, due to the
  2125. nature of this feature we haven't been able to completely test this
  2126. in practice, so consider this experimental.
  2127. * `TaskPool.apply_async`: Now supports the `accept_callback` argument.
  2128. * `apply_async`: Now raises :exc:`ValueError` if task args is not a list,
  2129. or kwargs is not a tuple (Issue #95).
  2130. * `Task.max_retries` can now be `None`, which means it will retry forever.
  2131. * Celerybeat: Now reuses the same connection when publishing large
  2132. sets of tasks.
  2133. * Modified the task locking example in the documentation to use
  2134. `cache.add` for atomic locking.
  2135. * Added experimental support for a *started* status on tasks.
  2136. If `Task.track_started` is enabled the task will report its status
  2137. as "started" when the task is executed by a worker.
  2138. The default value is `False` as the normal behaviour is to not
  2139. report that level of granularity. Tasks are either pending, finished,
  2140. or waiting to be retried. Having a "started" status can be useful for
  2141. when there are long running tasks and there is a need to report which
  2142. task is currently running.
  2143. The global default can be overridden by the :setting:`CELERY_TRACK_STARTED`
  2144. setting.
  2145. * User Guide: New section `Tips and Best Practices`.
  2146. Contributions welcome!
  2147. .. _v103-remote-control:
  2148. Remote control commands
  2149. -----------------------
  2150. * Remote control commands can now send replies back to the caller.
  2151. Existing commands has been improved to send replies, and the client
  2152. interface in `celery.task.control` has new keyword arguments: `reply`,
  2153. `timeout` and `limit`. Where reply means it will wait for replies,
  2154. timeout is the time in seconds to stop waiting for replies, and limit
  2155. is the maximum number of replies to get.
  2156. By default, it will wait for as many replies as possible for one second.
  2157. * rate_limit(task_name, destination=all, reply=False, timeout=1, limit=0)
  2158. Worker returns `{"ok": message}` on success,
  2159. or `{"failure": message}` on failure.
  2160. >>> from celery.task.control import rate_limit
  2161. >>> rate_limit("tasks.add", "10/s", reply=True)
  2162. [{'worker1': {'ok': 'new rate limit set successfully'}},
  2163. {'worker2': {'ok': 'new rate limit set successfully'}}]
  2164. * ping(destination=all, reply=False, timeout=1, limit=0)
  2165. Worker returns the simple message `"pong"`.
  2166. >>> from celery.task.control import ping
  2167. >>> ping(reply=True)
  2168. [{'worker1': 'pong'},
  2169. {'worker2': 'pong'},
  2170. * revoke(destination=all, reply=False, timeout=1, limit=0)
  2171. Worker simply returns `True`.
  2172. >>> from celery.task.control import revoke
  2173. >>> revoke("419e46eb-cf6a-4271-86a8-442b7124132c", reply=True)
  2174. [{'worker1': True},
  2175. {'worker2'; True}]
  2176. * You can now add your own remote control commands!
  2177. Remote control commands are functions registered in the command
  2178. registry. Registering a command is done using
  2179. :meth:`celery.worker.control.Panel.register`:
  2180. .. code-block:: python
  2181. from celery.task.control import Panel
  2182. @Panel.register
  2183. def reset_broker_connection(panel, **kwargs):
  2184. panel.consumer.reset_connection()
  2185. return {"ok": "connection re-established"}
  2186. With this module imported in the worker, you can launch the command
  2187. using `celery.task.control.broadcast`::
  2188. >>> from celery.task.control import broadcast
  2189. >>> broadcast("reset_broker_connection", reply=True)
  2190. [{'worker1': {'ok': 'connection re-established'},
  2191. {'worker2': {'ok': 'connection re-established'}}]
  2192. **TIP** You can choose the worker(s) to receive the command
  2193. by using the `destination` argument::
  2194. >>> broadcast("reset_broker_connection", destination=["worker1"])
  2195. [{'worker1': {'ok': 'connection re-established'}]
  2196. * New remote control command: `dump_reserved`
  2197. Dumps tasks reserved by the worker, waiting to be executed::
  2198. >>> from celery.task.control import broadcast
  2199. >>> broadcast("dump_reserved", reply=True)
  2200. [{'myworker1': [<TaskRequest ....>]}]
  2201. * New remote control command: `dump_schedule`
  2202. Dumps the workers currently registered ETA schedule.
  2203. These are tasks with an `eta` (or `countdown`) argument
  2204. waiting to be executed by the worker.
  2205. >>> from celery.task.control import broadcast
  2206. >>> broadcast("dump_schedule", reply=True)
  2207. [{'w1': []},
  2208. {'w3': []},
  2209. {'w2': ['0. 2010-05-12 11:06:00 pri0 <TaskRequest
  2210. {name:"opalfeeds.tasks.refresh_feed_slice",
  2211. id:"95b45760-4e73-4ce8-8eac-f100aa80273a",
  2212. args:"(<Feeds freq_max:3600 freq_min:60
  2213. start:2184.0 stop:3276.0>,)",
  2214. kwargs:"{'page': 2}"}>']},
  2215. {'w4': ['0. 2010-05-12 11:00:00 pri0 <TaskRequest
  2216. {name:"opalfeeds.tasks.refresh_feed_slice",
  2217. id:"c053480b-58fb-422f-ae68-8d30a464edfe",
  2218. args:"(<Feeds freq_max:3600 freq_min:60
  2219. start:1092.0 stop:2184.0>,)",
  2220. kwargs:"{\'page\': 1}"}>',
  2221. '1. 2010-05-12 11:12:00 pri0 <TaskRequest
  2222. {name:"opalfeeds.tasks.refresh_feed_slice",
  2223. id:"ab8bc59e-6cf8-44b8-88d0-f1af57789758",
  2224. args:"(<Feeds freq_max:3600 freq_min:60
  2225. start:3276.0 stop:4365>,)",
  2226. kwargs:"{\'page\': 3}"}>']}]
  2227. .. _v103-fixes:
  2228. Fixes
  2229. -----
  2230. * Mediator thread no longer blocks for more than 1 second.
  2231. With rate limits enabled and when there was a lot of remaining time,
  2232. the mediator thread could block shutdown (and potentially block other
  2233. jobs from coming in).
  2234. * Remote rate limits was not properly applied (Issue #98).
  2235. * Now handles exceptions with Unicode messages correctly in
  2236. `TaskRequest.on_failure`.
  2237. * Database backend: `TaskMeta.result`: default value should be `None`
  2238. not empty string.
  2239. .. _version-1.0.2:
  2240. 1.0.2
  2241. =====
  2242. :release-date: 2010-03-31 12:50 P.M CET
  2243. * Deprecated: :setting:`CELERY_BACKEND`, please use
  2244. :setting:`CELERY_RESULT_BACKEND` instead.
  2245. * We now use a custom logger in tasks. This logger supports task magic
  2246. keyword arguments in formats.
  2247. The default format for tasks (:setting:`CELERYD_TASK_LOG_FORMAT`) now
  2248. includes the id and the name of tasks so the origin of task log messages
  2249. can easily be traced.
  2250. Example output::
  2251. [2010-03-25 13:11:20,317: INFO/PoolWorker-1]
  2252. [tasks.add(a6e1c5ad-60d9-42a0-8b24-9e39363125a4)] Hello from add
  2253. To revert to the previous behavior you can set::
  2254. CELERYD_TASK_LOG_FORMAT = """
  2255. [%(asctime)s: %(levelname)s/%(processName)s] %(message)s
  2256. """.strip()
  2257. * Unit tests: Don't disable the django test database tear down,
  2258. instead fixed the underlying issue which was caused by modifications
  2259. to the `DATABASE_NAME` setting (Issue #82).
  2260. * Django Loader: New config :setting:`CELERY_DB_REUSE_MAX` (max number of
  2261. tasks to reuse the same database connection)
  2262. The default is to use a new connection for every task.
  2263. We would very much like to reuse the connection, but a safe number of
  2264. reuses is not known, and we don't have any way to handle the errors
  2265. that might happen, which may even be database dependent.
  2266. See: http://bit.ly/94fwdd
  2267. * celeryd: The worker components are now configurable: :setting:`CELERYD_POOL`,
  2268. :setting:`CELERYD_CONSUMER`, :setting:`CELERYD_MEDIATOR`, and
  2269. :setting:`CELERYD_ETA_SCHEDULER`.
  2270. The default configuration is as follows:
  2271. .. code-block:: python
  2272. CELERYD_POOL = "celery.concurrency.processes.TaskPool"
  2273. CELERYD_MEDIATOR = "celery.worker.controllers.Mediator"
  2274. CELERYD_ETA_SCHEDULER = "celery.worker.controllers.ScheduleController"
  2275. CELERYD_CONSUMER = "celery.worker.consumer.Consumer"
  2276. The :setting:`CELERYD_POOL` setting makes it easy to swap out the
  2277. multiprocessing pool with a threaded pool, or how about a
  2278. twisted/eventlet pool?
  2279. Consider the competition for the first pool plug-in started!
  2280. * Debian init scripts: Use `-a` not `&&` (Issue #82).
  2281. * Debian init scripts: Now always preserves `$CELERYD_OPTS` from the
  2282. `/etc/default/celeryd` and `/etc/default/celerybeat`.
  2283. * celery.beat.Scheduler: Fixed a bug where the schedule was not properly
  2284. flushed to disk if the schedule had not been properly initialized.
  2285. * celerybeat: Now syncs the schedule to disk when receiving the :sig:`SIGTERM`
  2286. and :sig:`SIGINT` signals.
  2287. * Control commands: Make sure keywords arguments are not in Unicode.
  2288. * ETA scheduler: Was missing a logger object, so the scheduler crashed
  2289. when trying to log that a task had been revoked.
  2290. * management.commands.camqadm: Fixed typo `camqpadm` -> `camqadm`
  2291. (Issue #83).
  2292. * PeriodicTask.delta_resolution: Was not working for days and hours, now fixed
  2293. by rounding to the nearest day/hour.
  2294. * Fixed a potential infinite loop in `BaseAsyncResult.__eq__`, although
  2295. there is no evidence that it has ever been triggered.
  2296. * celeryd: Now handles messages with encoding problems by acking them and
  2297. emitting an error message.
  2298. .. _version-1.0.1:
  2299. 1.0.1
  2300. =====
  2301. :release-date: 2010-02-24 07:05 P.M CET
  2302. * Tasks are now acknowledged early instead of late.
  2303. This is done because messages can only be acknowledged within the same
  2304. connection channel, so if the connection is lost we would have to refetch
  2305. the message again to acknowledge it.
  2306. This might or might not affect you, but mostly those running tasks with a
  2307. really long execution time are affected, as all tasks that has made it
  2308. all the way into the pool needs to be executed before the worker can
  2309. safely terminate (this is at most the number of pool workers, multiplied
  2310. by the :setting:`CELERYD_PREFETCH_MULTIPLIER` setting.)
  2311. We multiply the prefetch count by default to increase the performance at
  2312. times with bursts of tasks with a short execution time. If this doesn't
  2313. apply to your use case, you should be able to set the prefetch multiplier
  2314. to zero, without sacrificing performance.
  2315. .. note::
  2316. A patch to :mod:`multiprocessing` is currently being
  2317. worked on, this patch would enable us to use a better solution, and is
  2318. scheduled for inclusion in the `2.0.0` release.
  2319. * celeryd now shutdowns cleanly when receiving the :sig:`SIGTERM` signal.
  2320. * celeryd now does a cold shutdown if the :sig:`SIGINT` signal is received (Ctrl+C),
  2321. this means it tries to terminate as soon as possible.
  2322. * Caching of results now moved to the base backend classes, so no need
  2323. to implement this functionality in the base classes.
  2324. * Caches are now also limited in size, so their memory usage doesn't grow
  2325. out of control.
  2326. You can set the maximum number of results the cache
  2327. can hold using the :setting:`CELERY_MAX_CACHED_RESULTS` setting (the
  2328. default is five thousand results). In addition, you can refetch already
  2329. retrieved results using `backend.reload_task_result` +
  2330. `backend.reload_taskset_result` (that's for those who want to send
  2331. results incrementally).
  2332. * `celeryd` now works on Windows again.
  2333. .. warning::
  2334. If you're using Celery with Django, you can't use `project.settings`
  2335. as the settings module name, but the following should work::
  2336. $ python manage.py celeryd --settings=settings
  2337. * Execution: `.messaging.TaskPublisher.send_task` now
  2338. incorporates all the functionality apply_async previously did.
  2339. Like converting countdowns to eta, so :func:`celery.execute.apply_async` is
  2340. now simply a convenient front-end to
  2341. :meth:`celery.messaging.TaskPublisher.send_task`, using
  2342. the task classes default options.
  2343. Also :func:`celery.execute.send_task` has been
  2344. introduced, which can apply tasks using just the task name (useful
  2345. if the client does not have the destination task in its task registry).
  2346. Example:
  2347. >>> from celery.execute import send_task
  2348. >>> result = send_task("celery.ping", args=[], kwargs={})
  2349. >>> result.get()
  2350. 'pong'
  2351. * `camqadm`: This is a new utility for command line access to the AMQP API.
  2352. Excellent for deleting queues/bindings/exchanges, experimentation and
  2353. testing::
  2354. $ camqadm
  2355. 1> help
  2356. Gives an interactive shell, type `help` for a list of commands.
  2357. When using Django, use the management command instead::
  2358. $ python manage.py camqadm
  2359. 1> help
  2360. * Redis result backend: To conform to recent Redis API changes, the following
  2361. settings has been deprecated:
  2362. * `REDIS_TIMEOUT`
  2363. * `REDIS_CONNECT_RETRY`
  2364. These will emit a `DeprecationWarning` if used.
  2365. A `REDIS_PASSWORD` setting has been added, so you can use the new
  2366. simple authentication mechanism in Redis.
  2367. * The redis result backend no longer calls `SAVE` when disconnecting,
  2368. as this is apparently better handled by Redis itself.
  2369. * If `settings.DEBUG` is on, celeryd now warns about the possible
  2370. memory leak it can result in.
  2371. * The ETA scheduler now sleeps at most two seconds between iterations.
  2372. * The ETA scheduler now deletes any revoked tasks it might encounter.
  2373. As revokes are not yet persistent, this is done to make sure the task
  2374. is revoked even though it's currently being hold because its eta is e.g.
  2375. a week into the future.
  2376. * The `task_id` argument is now respected even if the task is executed
  2377. eagerly (either using apply, or :setting:`CELERY_ALWAYS_EAGER`).
  2378. * The internal queues are now cleared if the connection is reset.
  2379. * New magic keyword argument: `delivery_info`.
  2380. Used by retry() to resend the task to its original destination using the same
  2381. exchange/routing_key.
  2382. * Events: Fields was not passed by `.send()` (fixes the UUID key errors
  2383. in celerymon)
  2384. * Added `--schedule`/`-s` option to celeryd, so it is possible to
  2385. specify a custom schedule filename when using an embedded celerybeat
  2386. server (the `-B`/`--beat`) option.
  2387. * Better Python 2.4 compatibility. The test suite now passes.
  2388. * task decorators: Now preserve docstring as `cls.__doc__`, (was previously
  2389. copied to `cls.run.__doc__`)
  2390. * The `testproj` directory has been renamed to `tests` and we're now using
  2391. `nose` + `django-nose` for test discovery, and `unittest2` for test
  2392. cases.
  2393. * New pip requirements files available in `contrib/requirements`.
  2394. * TaskPublisher: Declarations are now done once (per process).
  2395. * Added `Task.delivery_mode` and the :setting:`CELERY_DEFAULT_DELIVERY_MODE`
  2396. setting.
  2397. These can be used to mark messages non-persistent (i.e. so they are
  2398. lost if the broker is restarted).
  2399. * Now have our own `ImproperlyConfigured` exception, instead of using the
  2400. Django one.
  2401. * Improvements to the Debian init scripts: Shows an error if the program is
  2402. not executable. Does not modify `CELERYD` when using django with
  2403. virtualenv.
  2404. .. _version-1.0.0:
  2405. 1.0.0
  2406. =====
  2407. :release-date: 2010-02-10 04:00 P.M CET
  2408. .. _v100-incompatible:
  2409. Backward incompatible changes
  2410. -----------------------------
  2411. * Celery does not support detaching anymore, so you have to use the tools
  2412. available on your platform, or something like Supervisord to make
  2413. celeryd/celerybeat/celerymon into background processes.
  2414. We've had too many problems with celeryd daemonizing itself, so it was
  2415. decided it has to be removed. Example startup scripts has been added to
  2416. `contrib/`:
  2417. * Debian, Ubuntu, (start-stop-daemon)
  2418. `contrib/debian/init.d/celeryd`
  2419. `contrib/debian/init.d/celerybeat`
  2420. * Mac OS X launchd
  2421. `contrib/mac/org.celeryq.celeryd.plist`
  2422. `contrib/mac/org.celeryq.celerybeat.plist`
  2423. `contrib/mac/org.celeryq.celerymon.plist`
  2424. * Supervisord (http://supervisord.org)
  2425. `contrib/supervisord/supervisord.conf`
  2426. In addition to `--detach`, the following program arguments has been
  2427. removed: `--uid`, `--gid`, `--workdir`, `--chroot`, `--pidfile`,
  2428. `--umask`. All good daemonization tools should support equivalent
  2429. functionality, so don't worry.
  2430. Also the following configuration keys has been removed:
  2431. `CELERYD_PID_FILE`, `CELERYBEAT_PID_FILE`, `CELERYMON_PID_FILE`.
  2432. * Default celeryd loglevel is now `WARN`, to enable the previous log level
  2433. start celeryd with `--loglevel=INFO`.
  2434. * Tasks are automatically registered.
  2435. This means you no longer have to register your tasks manually.
  2436. You don't have to change your old code right away, as it doesn't matter if
  2437. a task is registered twice.
  2438. If you don't want your task to be automatically registered you can set
  2439. the `abstract` attribute
  2440. .. code-block:: python
  2441. class MyTask(Task):
  2442. abstract = True
  2443. By using `abstract` only tasks subclassing this task will be automatically
  2444. registered (this works like the Django ORM).
  2445. If you don't want subclasses to be registered either, you can set the
  2446. `autoregister` attribute to `False`.
  2447. Incidentally, this change also fixes the problems with automatic name
  2448. assignment and relative imports. So you also don't have to specify a task name
  2449. anymore if you use relative imports.
  2450. * You can no longer use regular functions as tasks.
  2451. This change was added
  2452. because it makes the internals a lot more clean and simple. However, you can
  2453. now turn functions into tasks by using the `@task` decorator:
  2454. .. code-block:: python
  2455. from celery.decorators import task
  2456. @task
  2457. def add(x, y):
  2458. return x + y
  2459. .. seealso::
  2460. :ref:`guide-tasks` for more information about the task decorators.
  2461. * The periodic task system has been rewritten to a centralized solution.
  2462. This means `celeryd` no longer schedules periodic tasks by default,
  2463. but a new daemon has been introduced: `celerybeat`.
  2464. To launch the periodic task scheduler you have to run celerybeat::
  2465. $ celerybeat
  2466. Make sure this is running on one server only, if you run it twice, all
  2467. periodic tasks will also be executed twice.
  2468. If you only have one worker server you can embed it into celeryd like this::
  2469. $ celeryd --beat # Embed celerybeat in celeryd.
  2470. * The supervisor has been removed.
  2471. This means the `-S` and `--supervised` options to `celeryd` is
  2472. no longer supported. Please use something like http://supervisord.org
  2473. instead.
  2474. * `TaskSet.join` has been removed, use `TaskSetResult.join` instead.
  2475. * The task status `"DONE"` has been renamed to `"SUCCESS"`.
  2476. * `AsyncResult.is_done` has been removed, use `AsyncResult.successful`
  2477. instead.
  2478. * The worker no longer stores errors if `Task.ignore_result` is set, to
  2479. revert to the previous behaviour set
  2480. :setting:`CELERY_STORE_ERRORS_EVEN_IF_IGNORED` to `True`.
  2481. * The statistics functionality has been removed in favor of events,
  2482. so the `-S` and --statistics` switches has been removed.
  2483. * The module `celery.task.strategy` has been removed.
  2484. * `celery.discovery` has been removed, and it's `autodiscover` function is
  2485. now in `celery.loaders.djangoapp`. Reason: Internal API.
  2486. * The :envvar:`CELERY_LOADER` environment variable now needs loader class name
  2487. in addition to module name,
  2488. E.g. where you previously had: `"celery.loaders.default"`, you now need
  2489. `"celery.loaders.default.Loader"`, using the previous syntax will result
  2490. in a `DeprecationWarning`.
  2491. * Detecting the loader is now lazy, and so is not done when importing
  2492. `celery.loaders`.
  2493. To make this happen `celery.loaders.settings` has
  2494. been renamed to `load_settings` and is now a function returning the
  2495. settings object. `celery.loaders.current_loader` is now also
  2496. a function, returning the current loader.
  2497. So::
  2498. loader = current_loader
  2499. needs to be changed to::
  2500. loader = current_loader()
  2501. .. _v100-deprecations:
  2502. Deprecations
  2503. ------------
  2504. * The following configuration variables has been renamed and will be
  2505. deprecated in v2.0:
  2506. * CELERYD_DAEMON_LOG_FORMAT -> CELERYD_LOG_FORMAT
  2507. * CELERYD_DAEMON_LOG_LEVEL -> CELERYD_LOG_LEVEL
  2508. * CELERY_AMQP_CONNECTION_TIMEOUT -> CELERY_BROKER_CONNECTION_TIMEOUT
  2509. * CELERY_AMQP_CONNECTION_RETRY -> CELERY_BROKER_CONNECTION_RETRY
  2510. * CELERY_AMQP_CONNECTION_MAX_RETRIES -> CELERY_BROKER_CONNECTION_MAX_RETRIES
  2511. * SEND_CELERY_TASK_ERROR_EMAILS -> CELERY_SEND_TASK_ERROR_EMAILS
  2512. * The public API names in celery.conf has also changed to a consistent naming
  2513. scheme.
  2514. * We now support consuming from an arbitrary number of queues.
  2515. To do this we had to rename the configuration syntax. If you use any of
  2516. the custom AMQP routing options (queue/exchange/routing_key, etc.), you
  2517. should read the new FAQ entry: http://bit.ly/aiWoH.
  2518. The previous syntax is deprecated and scheduled for removal in v2.0.
  2519. * `TaskSet.run` has been renamed to `TaskSet.apply_async`.
  2520. `TaskSet.run` has now been deprecated, and is scheduled for
  2521. removal in v2.0.
  2522. .. v100-news:
  2523. News
  2524. ----
  2525. * Rate limiting support (per task type, or globally).
  2526. * New periodic task system.
  2527. * Automatic registration.
  2528. * New cool task decorator syntax.
  2529. * celeryd now sends events if enabled with the `-E` argument.
  2530. Excellent for monitoring tools, one is already in the making
  2531. (http://github.com/ask/celerymon).
  2532. Current events include: worker-heartbeat,
  2533. task-[received/succeeded/failed/retried],
  2534. worker-online, worker-offline.
  2535. * You can now delete (revoke) tasks that has already been applied.
  2536. * You can now set the hostname celeryd identifies as using the `--hostname`
  2537. argument.
  2538. * Cache backend now respects the :setting:`CELERY_TASK_RESULT_EXPIRES` setting.
  2539. * Message format has been standardized and now uses ISO-8601 format
  2540. for dates instead of datetime.
  2541. * `celeryd` now responds to the :sig:`SIGHUP` signal by restarting itself.
  2542. * Periodic tasks are now scheduled on the clock.
  2543. I.e. `timedelta(hours=1)` means every hour at :00 minutes, not every
  2544. hour from the server starts. To revert to the previous behaviour you
  2545. can set `PeriodicTask.relative = True`.
  2546. * Now supports passing execute options to a TaskSets list of args, e.g.:
  2547. >>> ts = TaskSet(add, [([2, 2], {}, {"countdown": 1}),
  2548. ... ([4, 4], {}, {"countdown": 2}),
  2549. ... ([8, 8], {}, {"countdown": 3})])
  2550. >>> ts.run()
  2551. * Got a 3x performance gain by setting the prefetch count to four times the
  2552. concurrency, (from an average task round-trip of 0.1s to 0.03s!).
  2553. A new setting has been added: :setting:`CELERYD_PREFETCH_MULTIPLIER`, which
  2554. is set to `4` by default.
  2555. * Improved support for webhook tasks.
  2556. `celery.task.rest` is now deprecated, replaced with the new and shiny
  2557. :mod:`celery.task.http`. With more reflective names, sensible interface,
  2558. and it's possible to override the methods used to perform HTTP requests.
  2559. * The results of task sets are now cached by storing it in the result
  2560. backend.
  2561. .. _v100-changes:
  2562. Changes
  2563. -------
  2564. * Now depends on carrot >= 0.8.1
  2565. * New dependencies: billiard, python-dateutil, django-picklefield
  2566. * No longer depends on python-daemon
  2567. * The `uuid` distribution is added as a dependency when running Python 2.4.
  2568. * Now remembers the previously detected loader by keeping it in
  2569. the :envvar:`CELERY_LOADER` environment variable.
  2570. This may help on windows where fork emulation is used.
  2571. * ETA no longer sends datetime objects, but uses ISO 8601 date format in a
  2572. string for better compatibility with other platforms.
  2573. * No longer sends error mails for retried tasks.
  2574. * Task can now override the backend used to store results.
  2575. * Refactored the ExecuteWrapper, `apply` and :setting:`CELERY_ALWAYS_EAGER`
  2576. now also executes the task callbacks and signals.
  2577. * Now using a proper scheduler for the tasks with an ETA.
  2578. This means waiting eta tasks are sorted by time, so we don't have
  2579. to poll the whole list all the time.
  2580. * Now also imports modules listed in :setting:`CELERY_IMPORTS` when running
  2581. with django (as documented).
  2582. * Log level for stdout/stderr changed from INFO to ERROR
  2583. * ImportErrors are now properly propagated when autodiscovering tasks.
  2584. * You can now use `celery.messaging.establish_connection` to establish a
  2585. connection to the broker.
  2586. * When running as a separate service the periodic task scheduler does some
  2587. smart moves to not poll too regularly.
  2588. If you need faster poll times you can lower the value
  2589. of :setting:`CELERYBEAT_MAX_LOOP_INTERVAL`.
  2590. * You can now change periodic task intervals at runtime, by making
  2591. `run_every` a property, or subclassing `PeriodicTask.is_due`.
  2592. * The worker now supports control commands enabled through the use of a
  2593. broadcast queue, you can remotely revoke tasks or set the rate limit for
  2594. a task type. See :mod:`celery.task.control`.
  2595. * The services now sets informative process names (as shown in `ps`
  2596. listings) if the :mod:`setproctitle` module is installed.
  2597. * :exc:`celery.exceptions.NotRegistered` now inherits from :exc:`KeyError`,
  2598. and `TaskRegistry.__getitem__`+`pop` raises `NotRegistered` instead
  2599. * You can set the loader via the :envvar:`CELERY_LOADER` environment variable.
  2600. * You can now set :setting:`CELERY_IGNORE_RESULT` to ignore task results by
  2601. default (if enabled, tasks doesn't save results or errors to the backend used).
  2602. * celeryd now correctly handles malformed messages by throwing away and
  2603. acknowledging the message, instead of crashing.
  2604. .. _v100-bugs:
  2605. Bugs
  2606. ----
  2607. * Fixed a race condition that could happen while storing task results in the
  2608. database.
  2609. .. _v100-documentation:
  2610. Documentation
  2611. -------------
  2612. * Reference now split into two sections; API reference and internal module
  2613. reference.
  2614. .. _version-0.8.4:
  2615. 0.8.4
  2616. =====
  2617. :release-date: 2010-02-05 01:52 P.M CEST
  2618. * Now emits a warning if the --detach argument is used.
  2619. --detach should not be used anymore, as it has several not easily fixed
  2620. bugs related to it. Instead, use something like start-stop-daemon,
  2621. Supervisord or launchd (os x).
  2622. * Make sure logger class is process aware, even if running Python >= 2.6.
  2623. * Error emails are not sent anymore when the task is retried.
  2624. .. _version-0.8.3:
  2625. 0.8.3
  2626. =====
  2627. :release-date: 2009-12-22 09:43 A.M CEST
  2628. * Fixed a possible race condition that could happen when storing/querying
  2629. task results using the database backend.
  2630. * Now has console script entry points in the setup.py file, so tools like
  2631. Buildout will correctly install the programs celeryd and celeryinit.
  2632. .. _version-0.8.2:
  2633. 0.8.2
  2634. =====
  2635. :release-date: 2009-11-20 03:40 P.M CEST
  2636. * QOS Prefetch count was not applied properly, as it was set for every message
  2637. received (which apparently behaves like, "receive one more"), instead of only
  2638. set when our wanted value changed.
  2639. .. _version-0.8.1:
  2640. 0.8.1
  2641. =================================
  2642. :release-date: 2009-11-16 05:21 P.M CEST
  2643. .. _v081-very-important:
  2644. Very important note
  2645. -------------------
  2646. This release (with carrot 0.8.0) enables AMQP QoS (quality of service), which
  2647. means the workers will only receive as many messages as it can handle at a
  2648. time. As with any release, you should test this version upgrade on your
  2649. development servers before rolling it out to production!
  2650. .. _v081-important:
  2651. Important changes
  2652. -----------------
  2653. * If you're using Python < 2.6 and you use the multiprocessing backport, then
  2654. multiprocessing version 2.6.2.1 is required.
  2655. * All AMQP_* settings has been renamed to BROKER_*, and in addition
  2656. AMQP_SERVER has been renamed to BROKER_HOST, so before where you had::
  2657. AMQP_SERVER = "localhost"
  2658. AMQP_PORT = 5678
  2659. AMQP_USER = "myuser"
  2660. AMQP_PASSWORD = "mypassword"
  2661. AMQP_VHOST = "celery"
  2662. You need to change that to::
  2663. BROKER_HOST = "localhost"
  2664. BROKER_PORT = 5678
  2665. BROKER_USER = "myuser"
  2666. BROKER_PASSWORD = "mypassword"
  2667. BROKER_VHOST = "celery"
  2668. * Custom carrot backends now need to include the backend class name, so before
  2669. where you had::
  2670. CARROT_BACKEND = "mycustom.backend.module"
  2671. you need to change it to::
  2672. CARROT_BACKEND = "mycustom.backend.module.Backend"
  2673. where `Backend` is the class name. This is probably `"Backend"`, as
  2674. that was the previously implied name.
  2675. * New version requirement for carrot: 0.8.0
  2676. .. _v081-changes:
  2677. Changes
  2678. -------
  2679. * Incorporated the multiprocessing backport patch that fixes the
  2680. `processName` error.
  2681. * Ignore the result of PeriodicTask's by default.
  2682. * Added a Redis result store backend
  2683. * Allow /etc/default/celeryd to define additional options for the celeryd init
  2684. script.
  2685. * MongoDB periodic tasks issue when using different time than UTC fixed.
  2686. * Windows specific: Negate test for available os.fork (thanks miracle2k)
  2687. * Now tried to handle broken PID files.
  2688. * Added a Django test runner to contrib that sets
  2689. `CELERY_ALWAYS_EAGER = True` for testing with the database backend.
  2690. * Added a :setting:`CELERY_CACHE_BACKEND` setting for using something other
  2691. than the django-global cache backend.
  2692. * Use custom implementation of functools.partial (curry) for Python 2.4 support
  2693. (Probably still problems with running on 2.4, but it will eventually be
  2694. supported)
  2695. * Prepare exception to pickle when saving :state:`RETRY` status for all backends.
  2696. * SQLite no concurrency limit should only be effective if the database backend
  2697. is used.
  2698. .. _version-0.8.0:
  2699. 0.8.0
  2700. =====
  2701. :release-date: 2009-09-22 03:06 P.M CEST
  2702. .. _v080-incompatible:
  2703. Backward incompatible changes
  2704. -----------------------------
  2705. * Add traceback to result value on failure.
  2706. .. note::
  2707. If you use the database backend you have to re-create the
  2708. database table `celery_taskmeta`.
  2709. Contact the :ref:`mailing-list` or :ref:`irc-channel` channel
  2710. for help doing this.
  2711. * Database tables are now only created if the database backend is used,
  2712. so if you change back to the database backend at some point,
  2713. be sure to initialize tables (django: `syncdb`, python: `celeryinit`).
  2714. .. note::
  2715. This is only applies if using Django version 1.1 or higher.
  2716. * Now depends on `carrot` version 0.6.0.
  2717. * Now depends on python-daemon 1.4.8
  2718. .. _v080-important:
  2719. Important changes
  2720. -----------------
  2721. * Celery can now be used in pure Python (outside of a Django project).
  2722. This means celery is no longer Django specific.
  2723. For more information see the FAQ entry
  2724. :ref:`faq-is-celery-for-django-only`.
  2725. * Celery now supports task retries.
  2726. See `Cookbook: Retrying Tasks`_ for more information.
  2727. .. _`Cookbook: Retrying Tasks`:
  2728. http://ask.github.com/celery/cookbook/task-retries.html
  2729. * We now have an AMQP result store backend.
  2730. It uses messages to publish task return value and status. And it's
  2731. incredibly fast!
  2732. See issue #6 for more info!
  2733. * AMQP QoS (prefetch count) implemented:
  2734. This to not receive more messages than we can handle.
  2735. * Now redirects stdout/stderr to the celeryd log file when detached
  2736. * Now uses `inspect.getargspec` to only pass default arguments
  2737. the task supports.
  2738. * Add Task.on_success, .on_retry, .on_failure handlers
  2739. See :meth:`celery.task.base.Task.on_success`,
  2740. :meth:`celery.task.base.Task.on_retry`,
  2741. :meth:`celery.task.base.Task.on_failure`,
  2742. * `celery.utils.gen_unique_id`: Workaround for
  2743. http://bugs.python.org/issue4607
  2744. * You can now customize what happens at worker start, at process init, etc.,
  2745. by creating your own loaders. (see :mod:`celery.loaders.default`,
  2746. :mod:`celery.loaders.djangoapp`, :mod:`celery.loaders`.)
  2747. * Support for multiple AMQP exchanges and queues.
  2748. This feature misses documentation and tests, so anyone interested
  2749. is encouraged to improve this situation.
  2750. * celeryd now survives a restart of the AMQP server!
  2751. Automatically re-establish AMQP broker connection if it's lost.
  2752. New settings:
  2753. * AMQP_CONNECTION_RETRY
  2754. Set to `True` to enable connection retries.
  2755. * AMQP_CONNECTION_MAX_RETRIES.
  2756. Maximum number of restarts before we give up. Default: `100`.
  2757. .. _v080-news:
  2758. News
  2759. ----
  2760. * Fix an incompatibility between python-daemon and multiprocessing,
  2761. which resulted in the `[Errno 10] No child processes` problem when
  2762. detaching.
  2763. * Fixed a possible DjangoUnicodeDecodeError being raised when saving pickled
  2764. data to Django`s memcached cache backend.
  2765. * Better Windows compatibility.
  2766. * New version of the pickled field (taken from
  2767. http://www.djangosnippets.org/snippets/513/)
  2768. * New signals introduced: `task_sent`, `task_prerun` and
  2769. `task_postrun`, see :mod:`celery.signals` for more information.
  2770. * `TaskSetResult.join` caused `TypeError` when `timeout=None`.
  2771. Thanks Jerzy Kozera. Closes #31
  2772. * `views.apply` should return `HttpResponse` instance.
  2773. Thanks to Jerzy Kozera. Closes #32
  2774. * `PeriodicTask`: Save conversion of `run_every` from `int`
  2775. to `timedelta` to the class attribute instead of on the instance.
  2776. * Exceptions has been moved to `celery.exceptions`, but are still
  2777. available in the previous module.
  2778. * Try to rollback transaction and retry saving result if an error happens
  2779. while setting task status with the database backend.
  2780. * jail() refactored into :class:`celery.execute.ExecuteWrapper`.
  2781. * `views.apply` now correctly sets mime-type to "application/json"
  2782. * `views.task_status` now returns exception if state is :state:`RETRY`
  2783. * `views.task_status` now returns traceback if state is :state:`FAILURE`
  2784. or :state:`RETRY`
  2785. * Documented default task arguments.
  2786. * Add a sensible __repr__ to ExceptionInfo for easier debugging
  2787. * Fix documentation typo `.. import map` -> `.. import dmap`.
  2788. Thanks to mikedizon
  2789. .. _version-0.6.0:
  2790. 0.6.0
  2791. =====
  2792. :release-date: 2009-08-07 06:54 A.M CET
  2793. .. _v060-important:
  2794. Important changes
  2795. -----------------
  2796. * Fixed a bug where tasks raising unpickleable exceptions crashed pool
  2797. workers. So if you've had pool workers mysteriously disappearing, or
  2798. problems with celeryd stopping working, this has been fixed in this
  2799. version.
  2800. * Fixed a race condition with periodic tasks.
  2801. * The task pool is now supervised, so if a pool worker crashes,
  2802. goes away or stops responding, it is automatically replaced with
  2803. a new one.
  2804. * Task.name is now automatically generated out of class module+name, e.g.
  2805. `"djangotwitter.tasks.UpdateStatusesTask"`. Very convenient. No idea why
  2806. we didn't do this before. Some documentation is updated to not manually
  2807. specify a task name.
  2808. .. _v060-news:
  2809. News
  2810. ----
  2811. * Tested with Django 1.1
  2812. * New Tutorial: Creating a click counter using carrot and celery
  2813. * Database entries for periodic tasks are now created at `celeryd`
  2814. startup instead of for each check (which has been a forgotten TODO/XXX
  2815. in the code for a long time)
  2816. * New settings variable: :setting:`CELERY_TASK_RESULT_EXPIRES`
  2817. Time (in seconds, or a `datetime.timedelta` object) for when after
  2818. stored task results are deleted. For the moment this only works for the
  2819. database backend.
  2820. * `celeryd` now emits a debug log message for which periodic tasks
  2821. has been launched.
  2822. * The periodic task table is now locked for reading while getting
  2823. periodic task status. (MySQL only so far, seeking patches for other
  2824. engines)
  2825. * A lot more debugging information is now available by turning on the
  2826. `DEBUG` log level (`--loglevel=DEBUG`).
  2827. * Functions/methods with a timeout argument now works correctly.
  2828. * New: `celery.strategy.even_time_distribution`:
  2829. With an iterator yielding task args, kwargs tuples, evenly distribute
  2830. the processing of its tasks throughout the time window available.
  2831. * Log message `Unknown task ignored...` now has log level `ERROR`
  2832. * Log message `"Got task from broker"` is now emitted for all tasks, even if
  2833. the task has an ETA (estimated time of arrival). Also the message now
  2834. includes the ETA for the task (if any).
  2835. * Acknowledgement now happens in the pool callback. Can't do ack in the job
  2836. target, as it's not pickleable (can't share AMQP connection, etc.)).
  2837. * Added note about .delay hanging in README
  2838. * Tests now passing in Django 1.1
  2839. * Fixed discovery to make sure app is in INSTALLED_APPS
  2840. * Previously overridden pool behavior (process reap, wait until pool worker
  2841. available, etc.) is now handled by `multiprocessing.Pool` itself.
  2842. * Convert statistics data to Unicode for use as kwargs. Thanks Lucy!
  2843. .. _version-0.4.1:
  2844. 0.4.1
  2845. =====
  2846. :release-date: 2009-07-02 01:42 P.M CET
  2847. * Fixed a bug with parsing the message options (`mandatory`,
  2848. `routing_key`, `priority`, `immediate`)
  2849. .. _version-0.4.0:
  2850. 0.4.0
  2851. =====
  2852. :release-date: 2009-07-01 07:29 P.M CET
  2853. * Adds eager execution. `celery.execute.apply`|`Task.apply` executes the
  2854. function blocking until the task is done, for API compatibility it
  2855. returns an `celery.result.EagerResult` instance. You can configure
  2856. celery to always run tasks locally by setting the
  2857. :setting:`CELERY_ALWAYS_EAGER` setting to `True`.
  2858. * Now depends on `anyjson`.
  2859. * 99% coverage using python `coverage` 3.0.
  2860. .. _version-0.3.20:
  2861. 0.3.20
  2862. ======
  2863. :release-date: 2009-06-25 08:42 P.M CET
  2864. * New arguments to `apply_async` (the advanced version of
  2865. `delay_task`), `countdown` and `eta`;
  2866. >>> # Run 10 seconds into the future.
  2867. >>> res = apply_async(MyTask, countdown=10);
  2868. >>> # Run 1 day from now
  2869. >>> res = apply_async(MyTask,
  2870. ... eta=datetime.now() + timedelta(days=1))
  2871. * Now unlinks stale PID files
  2872. * Lots of more tests.
  2873. * Now compatible with carrot >= 0.5.0.
  2874. * **IMPORTANT** The `subtask_ids` attribute on the `TaskSetResult`
  2875. instance has been removed. To get this information instead use:
  2876. >>> subtask_ids = [subtask.task_id for subtask in ts_res.subtasks]
  2877. * `Taskset.run()` now respects extra message options from the task class.
  2878. * Task: Add attribute `ignore_result`: Don't store the status and
  2879. return value. This means you can't use the
  2880. `celery.result.AsyncResult` to check if the task is
  2881. done, or get its return value. Only use if you need the performance
  2882. and is able live without these features. Any exceptions raised will
  2883. store the return value/status as usual.
  2884. * Task: Add attribute `disable_error_emails` to disable sending error
  2885. emails for that task.
  2886. * Should now work on Windows (although running in the background won't
  2887. work, so using the `--detach` argument results in an exception
  2888. being raised.)
  2889. * Added support for statistics for profiling and monitoring.
  2890. To start sending statistics start `celeryd` with the
  2891. `--statistics option. Then after a while you can dump the results
  2892. by running `python manage.py celerystats`. See
  2893. `celery.monitoring` for more information.
  2894. * The celery daemon can now be supervised (i.e. it is automatically
  2895. restarted if it crashes). To use this start celeryd with the
  2896. --supervised` option (or alternatively `-S`).
  2897. * views.apply: View applying a task. Example
  2898. ::
  2899. http://e.com/celery/apply/task_name/arg1/arg2//?kwarg1=a&kwarg2=b
  2900. .. warning::
  2901. Use with caution! Do not expose this URL to the public
  2902. without first ensuring that your code is safe!
  2903. * Refactored `celery.task`. It's now split into three modules:
  2904. * celery.task
  2905. Contains `apply_async`, `delay_task`, `discard_all`, and task
  2906. shortcuts, plus imports objects from `celery.task.base` and
  2907. `celery.task.builtins`
  2908. * celery.task.base
  2909. Contains task base classes: `Task`, `PeriodicTask`,
  2910. `TaskSet`, `AsynchronousMapTask`, `ExecuteRemoteTask`.
  2911. * celery.task.builtins
  2912. Built-in tasks: `PingTask`, `DeleteExpiredTaskMetaTask`.
  2913. .. _version-0.3.7:
  2914. 0.3.7
  2915. =====
  2916. :release-date: 2008-06-16 11:41 P.M CET
  2917. * **IMPORTANT** Now uses AMQP`s `basic.consume` instead of
  2918. `basic.get`. This means we're no longer polling the broker for
  2919. new messages.
  2920. * **IMPORTANT** Default concurrency limit is now set to the number of CPUs
  2921. available on the system.
  2922. * **IMPORTANT** `tasks.register`: Renamed `task_name` argument to
  2923. `name`, so
  2924. >>> tasks.register(func, task_name="mytask")
  2925. has to be replaced with:
  2926. >>> tasks.register(func, name="mytask")
  2927. * The daemon now correctly runs if the pidlock is stale.
  2928. * Now compatible with carrot 0.4.5
  2929. * Default AMQP connection timeout is now 4 seconds.
  2930. * `AsyncResult.read()` was always returning `True`.
  2931. * Only use README as long_description if the file exists so easy_install
  2932. doesn't break.
  2933. * `celery.view`: JSON responses now properly set its mime-type.
  2934. * `apply_async` now has a `connection` keyword argument so you
  2935. can re-use the same AMQP connection if you want to execute
  2936. more than one task.
  2937. * Handle failures in task_status view such that it won't throw 500s.
  2938. * Fixed typo `AMQP_SERVER` in documentation to `AMQP_HOST`.
  2939. * Worker exception emails sent to administrators now works properly.
  2940. * No longer depends on `django`, so installing `celery` won't affect
  2941. the preferred Django version installed.
  2942. * Now works with PostgreSQL (psycopg2) again by registering the
  2943. `PickledObject` field.
  2944. * `celeryd`: Added `--detach` option as an alias to `--daemon`, and
  2945. it's the term used in the documentation from now on.
  2946. * Make sure the pool and periodic task worker thread is terminated
  2947. properly at exit. (So `Ctrl-C` works again).
  2948. * Now depends on `python-daemon`.
  2949. * Removed dependency to `simplejson`
  2950. * Cache Backend: Re-establishes connection for every task process
  2951. if the Django cache backend is memcached/libmemcached.
  2952. * Tyrant Backend: Now re-establishes the connection for every task
  2953. executed.
  2954. .. _version-0.3.3:
  2955. 0.3.3
  2956. =====
  2957. :release-date: 2009-06-08 01:07 P.M CET
  2958. * The `PeriodicWorkController` now sleeps for 1 second between checking
  2959. for periodic tasks to execute.
  2960. .. _version-0.3.2:
  2961. 0.3.2
  2962. =====
  2963. :release-date: 2009-06-08 01:07 P.M CET
  2964. * celeryd: Added option `--discard`: Discard (delete!) all waiting
  2965. messages in the queue.
  2966. * celeryd: The `--wakeup-after` option was not handled as a float.
  2967. .. _version-0.3.1:
  2968. 0.3.1
  2969. =====
  2970. :release-date: 2009-06-08 01:07 P.M CET
  2971. * The `PeriodicTask` worker is now running in its own thread instead
  2972. of blocking the `TaskController` loop.
  2973. * Default `QUEUE_WAKEUP_AFTER` has been lowered to `0.1` (was `0.3`)
  2974. .. _version-0.3.0:
  2975. 0.3.0
  2976. =====
  2977. :release-date: 2009-06-08 12:41 P.M CET
  2978. .. warning::
  2979. This is a development version, for the stable release, please
  2980. see versions 0.2.x.
  2981. **VERY IMPORTANT:** Pickle is now the encoder used for serializing task
  2982. arguments, so be sure to flush your task queue before you upgrade.
  2983. * **IMPORTANT** TaskSet.run() now returns a celery.result.TaskSetResult
  2984. instance, which lets you inspect the status and return values of a
  2985. taskset as it was a single entity.
  2986. * **IMPORTANT** Celery now depends on carrot >= 0.4.1.
  2987. * The celery daemon now sends task errors to the registered admin emails.
  2988. To turn off this feature, set `SEND_CELERY_TASK_ERROR_EMAILS` to
  2989. `False` in your `settings.py`. Thanks to Grégoire Cachet.
  2990. * You can now run the celery daemon by using `manage.py`::
  2991. $ python manage.py celeryd
  2992. Thanks to Grégoire Cachet.
  2993. * Added support for message priorities, topic exchanges, custom routing
  2994. keys for tasks. This means we have introduced
  2995. `celery.task.apply_async`, a new way of executing tasks.
  2996. You can use `celery.task.delay` and `celery.Task.delay` like usual, but
  2997. if you want greater control over the message sent, you want
  2998. `celery.task.apply_async` and `celery.Task.apply_async`.
  2999. This also means the AMQP configuration has changed. Some settings has
  3000. been renamed, while others are new::
  3001. CELERY_AMQP_EXCHANGE
  3002. CELERY_AMQP_PUBLISHER_ROUTING_KEY
  3003. CELERY_AMQP_CONSUMER_ROUTING_KEY
  3004. CELERY_AMQP_CONSUMER_QUEUE
  3005. CELERY_AMQP_EXCHANGE_TYPE
  3006. See the entry `Can I send some tasks to only some servers?`_ in the
  3007. `FAQ`_ for more information.
  3008. .. _`Can I send some tasks to only some servers?`:
  3009. http://bit.ly/celery_AMQP_routing
  3010. .. _`FAQ`: http://ask.github.com/celery/faq.html
  3011. * Task errors are now logged using log level `ERROR` instead of `INFO`,
  3012. and stacktraces are dumped. Thanks to Grégoire Cachet.
  3013. * Make every new worker process re-establish it's Django DB connection,
  3014. this solving the "MySQL connection died?" exceptions.
  3015. Thanks to Vitaly Babiy and Jirka Vejrazka.
  3016. * **IMPORTANT** Now using pickle to encode task arguments. This means you
  3017. now can pass complex python objects to tasks as arguments.
  3018. * Removed dependency to `yadayada`.
  3019. * Added a FAQ, see `docs/faq.rst`.
  3020. * Now converts any Unicode keys in task `kwargs` to regular strings.
  3021. Thanks Vitaly Babiy.
  3022. * Renamed the `TaskDaemon` to `WorkController`.
  3023. * `celery.datastructures.TaskProcessQueue` is now renamed to
  3024. `celery.pool.TaskPool`.
  3025. * The pool algorithm has been refactored for greater performance and
  3026. stability.
  3027. .. _version-0.2.0:
  3028. 0.2.0
  3029. =====
  3030. :release-date: 2009-05-20 05:14 P.M CET
  3031. * Final release of 0.2.0
  3032. * Compatible with carrot version 0.4.0.
  3033. * Fixes some syntax errors related to fetching results
  3034. from the database backend.
  3035. .. _version-0.2.0-pre3:
  3036. 0.2.0-pre3
  3037. ==========
  3038. :release-date: 2009-05-20 05:14 P.M CET
  3039. * *Internal release*. Improved handling of unpickleable exceptions,
  3040. `get_result` now tries to recreate something looking like the
  3041. original exception.
  3042. .. _version-0.2.0-pre2:
  3043. 0.2.0-pre2
  3044. ==========
  3045. :release-date: 2009-05-20 01:56 P.M CET
  3046. * Now handles unpickleable exceptions (like the dynamically generated
  3047. subclasses of `django.core.exception.MultipleObjectsReturned`).
  3048. .. _version-0.2.0-pre1:
  3049. 0.2.0-pre1
  3050. ==========
  3051. :release-date: 2009-05-20 12:33 P.M CET
  3052. * It's getting quite stable, with a lot of new features, so bump
  3053. version to 0.2. This is a pre-release.
  3054. * `celery.task.mark_as_read()` and `celery.task.mark_as_failure()` has
  3055. been removed. Use `celery.backends.default_backend.mark_as_read()`,
  3056. and `celery.backends.default_backend.mark_as_failure()` instead.
  3057. .. _version-0.1.15:
  3058. 0.1.15
  3059. ======
  3060. :release-date: 2009-05-19 04:13 P.M CET
  3061. * The celery daemon was leaking AMQP connections, this should be fixed,
  3062. if you have any problems with too many files open (like `emfile`
  3063. errors in `rabbit.log`, please contact us!
  3064. .. _version-0.1.14:
  3065. 0.1.14
  3066. ======
  3067. :release-date: 2009-05-19 01:08 P.M CET
  3068. * Fixed a syntax error in the `TaskSet` class. (No such variable
  3069. `TimeOutError`).
  3070. .. _version-0.1.13:
  3071. 0.1.13
  3072. ======
  3073. :release-date: 2009-05-19 12:36 P.M CET
  3074. * Forgot to add `yadayada` to install requirements.
  3075. * Now deletes all expired task results, not just those marked as done.
  3076. * Able to load the Tokyo Tyrant backend class without django
  3077. configuration, can specify tyrant settings directly in the class
  3078. constructor.
  3079. * Improved API documentation
  3080. * Now using the Sphinx documentation system, you can build
  3081. the html documentation by doing ::
  3082. $ cd docs
  3083. $ make html
  3084. and the result will be in `docs/.build/html`.
  3085. .. _version-0.1.12:
  3086. 0.1.12
  3087. ======
  3088. :release-date: 2009-05-18 04:38 P.M CET
  3089. * `delay_task()` etc. now returns `celery.task.AsyncResult` object,
  3090. which lets you check the result and any failure that might have
  3091. happened. It kind of works like the `multiprocessing.AsyncResult`
  3092. class returned by `multiprocessing.Pool.map_async`.
  3093. * Added dmap() and dmap_async(). This works like the
  3094. `multiprocessing.Pool` versions except they are tasks
  3095. distributed to the celery server. Example:
  3096. >>> from celery.task import dmap
  3097. >>> import operator
  3098. >>> dmap(operator.add, [[2, 2], [4, 4], [8, 8]])
  3099. >>> [4, 8, 16]
  3100. >>> from celery.task import dmap_async
  3101. >>> import operator
  3102. >>> result = dmap_async(operator.add, [[2, 2], [4, 4], [8, 8]])
  3103. >>> result.ready()
  3104. False
  3105. >>> time.sleep(1)
  3106. >>> result.ready()
  3107. True
  3108. >>> result.result
  3109. [4, 8, 16]
  3110. * Refactored the task metadata cache and database backends, and added
  3111. a new backend for Tokyo Tyrant. You can set the backend in your django
  3112. settings file. E.g.::
  3113. CELERY_RESULT_BACKEND = "database"; # Uses the database
  3114. CELERY_RESULT_BACKEND = "cache"; # Uses the django cache framework
  3115. CELERY_RESULT_BACKEND = "tyrant"; # Uses Tokyo Tyrant
  3116. TT_HOST = "localhost"; # Hostname for the Tokyo Tyrant server.
  3117. TT_PORT = 6657; # Port of the Tokyo Tyrant server.
  3118. .. _version-0.1.11:
  3119. 0.1.11
  3120. ======
  3121. :release-date: 2009-05-12 02:08 P.M CET
  3122. * The logging system was leaking file descriptors, resulting in
  3123. servers stopping with the EMFILES (too many open files) error. (fixed)
  3124. .. _version-0.1.10:
  3125. 0.1.10
  3126. ======
  3127. :release-date: 2009-05-11 12:46 P.M CET
  3128. * Tasks now supports both positional arguments and keyword arguments.
  3129. * Requires carrot 0.3.8.
  3130. * The daemon now tries to reconnect if the connection is lost.
  3131. .. _version-0.1.8:
  3132. 0.1.8
  3133. =====
  3134. :release-date: 2009-05-07 12:27 P.M CET
  3135. * Better test coverage
  3136. * More documentation
  3137. * celeryd doesn't emit `Queue is empty` message if
  3138. `settings.CELERYD_EMPTY_MSG_EMIT_EVERY` is 0.
  3139. .. _version-0.1.7:
  3140. 0.1.7
  3141. =====
  3142. :release-date: 2009-04-30 01:50 P.M CET
  3143. * Added some unit tests
  3144. * Can now use the database for task metadata (like if the task has
  3145. been executed or not). Set `settings.CELERY_TASK_META`
  3146. * Can now run `python setup.py test` to run the unit tests from
  3147. within the `tests` project.
  3148. * Can set the AMQP exchange/routing key/queue using
  3149. `settings.CELERY_AMQP_EXCHANGE`, `settings.CELERY_AMQP_ROUTING_KEY`,
  3150. and `settings.CELERY_AMQP_CONSUMER_QUEUE`.
  3151. .. _version-0.1.6:
  3152. 0.1.6
  3153. =====
  3154. :release-date: 2009-04-28 02:13 P.M CET
  3155. * Introducing `TaskSet`. A set of subtasks is executed and you can
  3156. find out how many, or if all them, are done (excellent for progress
  3157. bars and such)
  3158. * Now catches all exceptions when running `Task.__call__`, so the
  3159. daemon doesn't die. This doesn't happen for pure functions yet, only
  3160. `Task` classes.
  3161. * `autodiscover()` now works with zipped eggs.
  3162. * celeryd: Now adds current working directory to `sys.path` for
  3163. convenience.
  3164. * The `run_every` attribute of `PeriodicTask` classes can now be a
  3165. `datetime.timedelta()` object.
  3166. * celeryd: You can now set the `DJANGO_PROJECT_DIR` variable
  3167. for `celeryd` and it will add that to `sys.path` for easy launching.
  3168. * Can now check if a task has been executed or not via HTTP.
  3169. * You can do this by including the celery `urls.py` into your project,
  3170. >>> url(r'^celery/$', include("celery.urls"))
  3171. then visiting the following url,::
  3172. http://mysite/celery/$task_id/done/
  3173. this will return a JSON dictionary like e.g:
  3174. >>> {"task": {"id": $task_id, "executed": true}}
  3175. * `delay_task` now returns string id, not `uuid.UUID` instance.
  3176. * Now has `PeriodicTasks`, to have `cron` like functionality.
  3177. * Project changed name from `crunchy` to `celery`. The details of
  3178. the name change request is in `docs/name_change_request.txt`.
  3179. .. _version-0.1.0:
  3180. 0.1.0
  3181. =====
  3182. :release-date: 2009-04-24 11:28 A.M CET
  3183. * Initial release