{"id":158961,"date":"2012-11-16T20:42:03","date_gmt":"2012-11-16T16:42:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=158961"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=158961","title":{"rendered":"<span class=\"post_title\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 RabbitMQ \u0432 django \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0431\u0435\u0437 Celery, \u0438 \u0447\u0442\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0432 Celery 3.0<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0414\u0443\u043c\u0430\u044e \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e python \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u0443\u0436\u0435 \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 Celery. \u0412 1-\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c RabbitMQ \u0431\u0435\u0437 celery, \u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u2014 \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u043e\u0431\u0437\u043e\u0440 \u043d\u043e\u0432\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 celery 3.0. <br \/>  \u041e\u0431 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0441\u0432\u044f\u0437\u043a\u0438 Django-Celery-RabbitMQ \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"http:\/\/docs.celeryproject.org\/en\/latest\/getting-started\/first-steps-with-celery.html\">\u0442\u0443\u0442<\/a>.<br \/>  \u041f\u0440\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 RabbitMQ \u0445\u043e\u0440\u043e\u0448\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"http:\/\/habrahabr.ru\/post\/149694\/\">\u0442\u0443\u0442<\/a>, \u0438 <a href=\"http:\/\/habrahabr.ru\/post\/150134\/\">\u0442\u0443\u0442<\/a>, \u043d\u0443 \u0438 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 RabbitMQ.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041a\u043e\u0440\u043e\u0442\u043a\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u044e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443: <br \/>  RabbitMQ:<br \/>  <code>sudo apt-get install rabbitmq-server<\/code><br \/>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:   <\/p>\n<pre><code class=\"bash\">$ rabbitmqctl add_user myuser mypassword $ rabbitmqctl add_vhost '\/' $ rabbitmqctl set_permissions -p myvhost myuser &quot;.*&quot; &quot;.*&quot; &quot;.*&quot; <\/code><\/pre>\n<p>  \u041a\u043e\u0440\u043e\u0442\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Celery, RabbitMQ:<br \/>  in settings.py  <\/p>\n<pre><code class=\"python\">import djcelery  os.environ[&quot;CELERY_LOADER&quot;] = &quot;django&quot; djcelery.setup_loader() AMQP_HOST = 'localhost' BROKER_HOST='localhost' BROKER_PORT = 5672 BROKER_VHOST = &quot;\/&quot; BROKER_USER = &quot;myuser&quot; BROKER_PASSWORD = &quot;mypassword&quot;  INSTALLED_APPS+='djcelery' <\/code><\/pre>\n<p>  \u0423\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435: \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c celery. \u0412\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c RabbitMQ. <br \/>  \u0414\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e:<br \/>  \u041d\u0430\u0447\u043d\u0451\u043c \u043e\u0442 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u0433\u043e:<br \/>  \u0417\u0430\u0434\u0430\u0447\u0430: \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c email \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u0438\u0441\u044c\u043c\u0430 \u043e\u0442 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f, \u0435\u0441\u043b\u0438 \u043f\u0438\u0441\u044c\u043c\u0430 \u043d\u0435\u0442, \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 \u043c\u0438\u043d\u0443\u0442\u0443, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u2014 \u043f\u043e\u0439\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435 ( \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440&#8230;)<br \/>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c poplib, email.<br \/>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0443\u044e email \u043e\u0442 \u043d\u0430\u043f\u0435\u0440\u0451\u0434 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f \u0438 \u043e\u0431\u0435\u0440\u043d\u0451\u043c \u0435\u0451 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u043c task<br \/>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 email \u0430\u0434\u0440\u0435\u0441, \u043f\u0430\u0440\u043e\u043b\u044c \u0438 email \u0430\u0434\u0440\u0435\u0441, \u043e\u0442 \u043a\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0438\u0439\u0442\u0438 \u043f\u0438\u0441\u044c\u043c\u043e \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0442\u0430\u0442\u0443\u0441 (Ok, Error) \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435<br \/>  in tasks.py  <\/p>\n<pre><code class=\"python\">from celery.task import task, periodic_task from celery.task.schedules import crontab  import poplib import email  @task def mail_content(user_mail, mail_pass, mail_from):     mail_server = 'pop.'+user_mail.split('@')[1]     mail_login = user_mail.split('@')[0]     p = poplib.POP3(mail_server)     print p.getwelcome()     try:         p.user(mail_login)         p.pass_(mail_pass)     except poplib.error_proto:         return 'Error', 'Email is blocked'        try:         print p.list()     except:         return 'Error', 'dont receive list of mails'     numMessages = len(p.list()[1])     print numMessages     for i in range(numMessages):         m = email.message_from_string(&quot;\\n&quot;.join(p.top(i+1, 1)[1]))         try:             this_email_from = m['From']             if this_email_from.find(mail_from) &gt;= 0:                 print this_email_from                 m = email.message_from_string('\\n'.join(p.retr(i+1)[1]))                 content = get_text_body(m)                 print content                 return 'Ok', content             else:                 pass         except Exception, e:             return 'Error', unicode(e, 'utf8')     raise mail_content.retry(exc=e, countdown=30) <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u043a\u043e\u0434\u0430 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u0442\u0430\u0441\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 30 \u0441\u0435\u043a\u0443\u043d\u0434, \u0435\u0441\u043b\u0438 \u043f\u0438\u0441\u044c\u043c\u043e \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e. <br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0430\u0441\u043a \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"python\">&gt;&gt;&gt;res = mail_content.delay('user@domen', 'password', 'email_from@domen.email.from') <\/code><\/pre>\n<p>  \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0447\u043d\u0451\u0442\u0441\u044f \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u0438\u043b\u0438 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"python\">&gt;&gt;&gt;res = mail_content.apply_async(('user@domen', 'password', 'email_from@domen.email.from'), countdown=30) <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0447\u043d\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 30 \u0441\u0435\u043a\u0443\u043d\u0434.<br \/>  (\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 celery: <br \/>  python manage.py celeryd<br \/>  \u0438 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043e\u043a\u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c shell:<br \/>  python manage.py shell,<br \/>  \u0410 \u0443\u0436\u0435 \u0438\u0437 \u0448\u0435\u043b\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b)<br \/>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432   <\/p>\n<pre><code class=\"python\">&gt;&gt;&gt;res.get() (\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e) &gt;&gt;&gt;res.info <\/code><\/pre>\n<p>  (\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 None, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0435\u0449\u0451 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0435\u0441\u043b\u0438 \u043e\u043d \u0435\u0441\u0442\u044c)<br \/>  \u041d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0435\u0441\u0442\u044c \u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0434\u043e\u0431\u043d\u043e \u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043b\u0438\u0448\u043d\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<br \/>  \u0414\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c callback. \u0415\u0441\u043b\u0438 \u0443 \u0412\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 celery \u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0443\u044e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0435\u0439 (task), \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043f\u043e\u0434\u0440\u0430\u0437\u0434\u0435\u043b\u0443. \u041a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 celery \u2014 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 callback \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 pika \u0438 rabbitMQ.<br \/>  \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 AMQP \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043f\u0430\u043a\u0435\u0442 pika:  <\/p>\n<pre><code class=\"python\">$ sudo pip install pika==0.9.5 <\/code><\/pre>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e Hello world \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 RabbitMQ \u043e\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"http:\/\/www.rabbitmq.com\/tutorials\/tutorial-one-python.html\"> \u0442\u0443\u0442<\/a><br \/>  in decorators.py:  <\/p>\n<pre><code class=\"python\">import pika import pickle import time  importr settings   def callback(function_to_decorate):     user = settings.BROKER_USER     broker_host = settings.BROKER_HOST     password = settings.BROKER_PASSWORD     credentials = pika.PlainCredentials(user, password)     parameters = pika.ConnectionParameters(host=broker_host, credentials=credentials)     def receiver(*args, **kw):         (backend_function, data) = function_to_decorate(*args, **kw)         pickled_obj = pickle.dumps(data)         queue_name = str(time.time())         print &quot;call_backend&quot;, backend_function.__name__         connection = pika.BlockingConnection(parameters)         channel = connection.channel()         channel.queue_declare( queue = queue_name)         channel.basic_publish(exchange='', routing_key=queue_name, body=pickled_obj)         channel.basic_consume( backend_function, queue=queue_name, no_ack = True)         channel.queue_delete(queue=queue_name)         connection.close()     return receiver <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u043e\u0431\u0435\u0440\u043d\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e mail_content \u043f\u0435\u0440\u0435\u0434(!) \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u043c @task<br \/>  \u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u0448\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e mail_content \u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 rabbitmq<br \/>  \u041d\u0435 \u0431\u0443\u0434\u0443 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 tasks.py, \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c<br \/>  in tasks.py:  <\/p>\n<pre><code class=\"python\">from decorators import * from tasks_backend import mail_analizer, mail_error  @task @callback def mail_content(...):     ...     if (...):         ...         return mail_analizer, (content,)     return mail_error, ('error',) <\/code><\/pre>\n<p>  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432\u0442\u043e\u0440\u044b\u043c \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0442\u0438\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e<br \/>  in tasks_backend.py  <\/p>\n<pre><code class=\"python\">import tasks def mail_analizer(ch, method, properties, body):     email_text = pickle.loads(body)     if emai_text.find(u'Hello'):         tasks.send_emails.delay(email_text)     else:         tasks.send_twitter_status.delay(email_text) <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043d\u044f\u043b\u0438 email, \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043b\u0438 \u0435\u0433\u043e \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438.<br \/>  \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0435, \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043c \u044d\u0442\u043e:<br \/>  in decorators.py  <\/p>\n<pre><code class=\"python\">def backend(function_to_decorate):     def receive(ch, method, properties, body):         data=pickle.loads(body)         args = data         function_to_decorate(*args)     return receive <\/code><\/pre>\n<p>  \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e mail_analizer \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"python\">@backend def mail_analizer(email_text):      if emai_text.find(u'Hello'):         tasks.send_emails.delay(email_text)     else:         tasks.send_twitter_status.delay(email_text) <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <\/p>\n<pre><code class=\"python\">@callback <\/code><\/pre>\n<p> \u0442\u0430\u043a-\u0436\u0435 \u043a\u0430\u043a \u0438 \u0432 mail_content:  <\/p>\n<pre><code class=\"python\">@backend @callback def mail_analizer(cont):     print cont     return send_twitter_status, (cont,) <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c:  <\/p>\n<pre><code class=\"python\">@callback def first(*args):     print first.__name__     print args     return senders, args @backend @callback def senders(*args):     print args     return analizer, args @backend @callback def analizer( *args):     print args     return ended_fun, args @backend def ended_fun(*args):     print ended_fun.__name__     print args <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0451\u0440\u043d\u0443\u0442\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u043c <\/p>\n<pre><code class=\"python\">@callback <\/code><\/pre>\n<p>, \u0442.\u043a. \u043e\u043d\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0438\u0437 \u043a\u0440\u043e\u043b\u0438\u043a\u0430, \u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u2014 \u0442\u043e\u043b\u044c\u043a\u043e <\/p>\n<pre><code class=\"python\">@backend <\/code><\/pre>\n<p> \u2014 \u0442.\u043a. \u043e\u043d\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442. <br \/>  \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u0430 \u0441\u0435\u0431\u044f. \u0422\u0430\u043a\u0436\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043c \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u044f \u043e\u0431\u0451\u0440\u043d\u0443\u0442\u0430 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u043c backend \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 rabbitmq.<br \/>  \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0451\u0440\u043d\u0443\u0442\u0430 \u0442\u043e\u043b\u044c\u043a\u043e callback.  <\/p>\n<pre><code class=\"python\">@callback def runer(*args):     return test_func, (args) @backend @callback def test_func( *args):     print args     return test_func, args <\/code><\/pre>\n<p>   \u041e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 mail_content, email_analizer, run_email:  <\/p>\n<pre><code class=\"python\">@backend @call_backend def mail_content(user_mail, mail_pass, mail_from):     mail_server = 'pop.'+user_mail.split('@')[1]     mail_login = user_mail.split('@')[0]     p = poplib.POP3(mail_server)     print p.getwelcome()     try:         p.user(mail_login)         p.pass_(mail_pass)     except poplib.error_proto:         return mail_error, 'Email is blocked'     try:         print p.list()     except:         return mail_error, 'dont receive list of mails'     numMessages = len(p.list()[1])     print numMessages     for i in range(numMessages):         m = email.message_from_string(&quot;\\n&quot;.join(p.top(i+1, 1)[1]))         try:             this_from = m['From']             this_from = this_from.decode('cp1251').split('&lt;'.decode('cp1251'))[1]             if this_from.find(mail_from) &gt;= 0:                 print m['From']                 m = email.message_from_string('\\n'.join(p.retr(i+1)[1]))                 content = get_text_body(m)                 print content                 return email_analizer, (content, email_from)             else:                 pass         except Exception, e:             return email_error, (unicode(e, 'utf8'),)     return mail_content, (user_mail, mail_pass, mail_from)  @backend @call_backend def email_analizer(content, email_from):     if content.find(u'Hello'):         email_to = email_from         text=u'Hello, my dear friend'         return send_mail, (email_to, text)     return send_twitter_status, (cont,)      @call_backend def run_email():     '''\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437 \u0431\u0430\u0437\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, email, password, email_from '''     return  mail_content, (email, password, email_from) <\/code><\/pre>\n<p>  <\/p>\n<h5>\u041f\u043e\u0434\u0438\u0442\u043e\u0433: <\/h5>\n<p>\u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0432\u043c\u0435\u0441\u0442\u043e celery, \u0435\u0441\u043b\u0438 \u0443 \u0412\u0430\u0441 \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u043e\u0434\u043d\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 (task).<\/p>\n<h4>\u041a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 celery 3.0<\/h4>\n<p>  \u0412 celery 3.0 \u0432 \u0437\u0430\u0434\u0430\u0447\u0443 (task) \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u043c\u044f \u0437\u0430\u0434\u0430\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:  <\/p>\n<pre><code class=\"python\">@celery.task def add(x, y):     return x + y add.apply_async((2, 2), link=add.s(16)) <\/code><\/pre>\n<p>  \u0433\u0434\u0435 add \u2014 \u043d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 (task), add.s \u2014 \u043f\u043e\u0434\u0437\u0430\u0434\u0430\u0447\u0430( subtask), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f add(2, 2), \u043f\u0435\u0440\u0432\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0432 \u043f\u043e\u0434\u0437\u0430\u0434\u0430\u0447\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f add(2, 2), \u0432\u0442\u043e\u0440\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 16. \u0418\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f (2+2)+16=20. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 subtask <a href=\"http:\/\/docs.celeryproject.org\/en\/latest\/userguide\/canvas.html#id1\">\u0442\u0443\u0442<\/a><br \/>  \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0434\u0435\u043b\u0430\u0435\u043c \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 mail_analizer task, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0434\u0438\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u2014 content, \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 @call_backend \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u0430\u043a:<\/p>\n<p>  &gt;&gt;&gt;mail_content.apply_async(mail_addres, mail_password, email_from, link=mail_analizer.s()) <br \/>  \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f link_error \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u00ab\u0440\u044d\u0439\u0437\u0438\u0442\u00bb \u043e\u0448\u0438\u0431\u043a\u0443.<br \/>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c <a href=\"http:\/\/docs.celeryproject.org\/en\/latest\/userguide\/calling.html#calling-links\">\u0442\u0443\u0442<\/a><br \/>  \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e \u0432 celery 3.0 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c:  <\/p>\n<h5>Group<\/h5>\n<p>  \u0433\u0440\u0443\u043f\u043f\u0430, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0434\u0430\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u044b \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e:<br \/>  \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:  <\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; from celery import group &gt;&gt;&gt; res = group(add.s(i, i) for i in xrange(10))() &gt;&gt;&gt; res.get(timeout=1) [0, 2, 4, 6, 8, 10, 12, 14, 16, 18] \u0438\u043b\u0438 \u0442\u0430\u043a &gt;&gt;&gt; g = group(add.s(i, i) for i in xrange(10)) &gt;&gt;&gt; g.apply_async() <\/code><\/pre>\n<p>  <\/p>\n<h5>chain:<\/h5>\n<p>  \u0426\u0435\u043f\u043e\u0447\u043a\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0446\u0435\u043f\u043e\u0447\u043a\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; from celery import chain @task def mul(x,y):     return x*y @task def div(x,y):     return x\/y # (2 + 2) * 8 \/ 2 &gt;&gt;&gt; res = chain(add.subtask((2, 2)),                 mul.subtask((8, )),                 div.subtask((2,))).apply_async() &gt;&gt;&gt; res.get() == 16  &gt;&gt;&gt; res.parent.get() == 32  &gt;&gt;&gt; res.parent.parent.get() == 4 \u043a\u043e\u0440\u043e\u0442\u043a\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c &gt;&gt;&gt; (add.s(2, 2) | add.s(4) | add.s(8))().get() 16 &lt;\/source  &lt;h5&gt;immutable&lt;\/h5&gt; \u041f\u043e\u0434\u0437\u0430\u0434\u0430\u0447\u0443 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u0430\u043a \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u0443\u044e,  \u0442\u043e\u0433\u0434\u0430 \u044d\u0442\u0430 \u043f\u043e\u0434\u0437\u0430\u0434\u0430\u0447\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 &lt;source lang=&quot;python&quot;&gt; &gt;&gt;&gt; add.subtask((2, 2), immutable=True) \u0438\u043b\u0438 &gt;&gt;&gt; add.si(2, 2) <\/code><\/pre>\n<p>  <\/p>\n<h5>chord <\/h5>\n<p>  \u0410\u043a\u043a\u043e\u0440\u0434:<br \/>  \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0434\u0430\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0438 \u0437\u0430\u0434\u0430\u0447\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0437\u0430\u0434\u0430\u0447. \u0412\u043e\u0442 \u044d\u0442\u043e \u0437\u0430\u0433\u043d\u0443\u043b.  <\/p>\n<pre><code class=\"python\">@task def xsum(res_list):     return sum(res_list) &gt;&gt;&gt; from celery import chord &gt;&gt;&gt; res = chord((add.s(i, i) for i in xrange(10)), xsum.s())() &gt;&gt;&gt; res.get() 90 <\/code><\/pre>\n<p>  \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f chain(group) \u043f\u043e\u043b\u0443\u0447\u0438\u043c chord:  <\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; c3 = (group(add.s(i, i) for i in xrange(10) | xsum.s())) &gt;&gt;&gt; res = c3() &gt;&gt;&gt; res.get() 90 <\/code><\/pre>\n<p>  <\/p>\n<h5>map <\/h5>\n<p>  \u041a\u0430\u043a map(fun, [1,2,3])  <\/p>\n<pre><code class=\"python\">res=task.map([1,2]) \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 res=[task(1), task(2)] <\/code><\/pre>\n<p>  <\/p>\n<h5>starmap<\/h5>\n<p>  <\/p>\n<pre><code class=\"python\">res=add.starmap([(1,2), (2,4)]) \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 res=[add(1,2), add(2,4)] <\/code><\/pre>\n<p>  <\/p>\n<h5>chuncs<\/h5>\n<p>  \u0420\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0441\u043f\u0438\u0441\u043a\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0430\u0441\u043a\u0438,   <\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; from proj.tasks import add  &gt;&gt;&gt; res = add.chunks(zip(range(100), range(100)), 10)() &gt;&gt;&gt; res.get() [[0, 2, 4, 6, 8, 10, 12, 14, 16, 18],  [20, 22, 24, 26, 28, 30, 32, 34, 36, 38],  [40, 42, 44, 46, 48, 50, 52, 54, 56, 58],  [60, 62, 64, 66, 68, 70, 72, 74, 76, 78],  [80, 82, 84, 86, 88, 90, 92, 94, 96, 98],  [100, 102, 104, 106, 108, 110, 112, 114, 116, 118],  [120, 122, 124, 126, 128, 130, 132, 134, 136, 138],  [140, 142, 144, 146, 148, 150, 152, 154, 156, 158],  [160, 162, 164, 166, 168, 170, 172, 174, 176, 178],  [180, 182, 184, 186, 188, 190, 192, 194, 196, 198]] <\/code><\/pre>\n<p>  <\/p>\n<h5>\u041f\u043e\u0434\u0438\u0442\u043e\u0433:<\/h5>\n<p>  Celery 3.0 \u0434\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0445 \u043f\u043b\u044e\u0448\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u043e \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435, \u0435\u0441\u043b\u0438 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.  <\/p>\n<h5>\u0418\u0442\u043e\u0433: <\/h5>\n<p>  Celery \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043d\u043e \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0437\u0430\u0434\u0430\u0447, \u0433\u0434\u0435 90% \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043d\u0435 \u043d\u0430\u0434\u043e, \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u044c\u044e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (rabbit), \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c celery, \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u0441\u044f \u043e\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<br \/>  <b>\u0412\u0441\u0435\u043c \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/b> \t\t\t \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/158961\/\"> http:\/\/habrahabr.ru\/post\/158961\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0414\u0443\u043c\u0430\u044e \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e python \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u0443\u0436\u0435 \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 Celery. \u0412 1-\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c RabbitMQ \u0431\u0435\u0437 celery, \u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u2014 \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u043e\u0431\u0437\u043e\u0440 \u043d\u043e\u0432\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 celery 3.0. <br \/>  \u041e\u0431 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0441\u0432\u044f\u0437\u043a\u0438 Django-Celery-RabbitMQ \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"http:\/\/docs.celeryproject.org\/en\/latest\/getting-started\/first-steps-with-celery.html\">\u0442\u0443\u0442<\/a>.<br \/>  \u041f\u0440\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 RabbitMQ \u0445\u043e\u0440\u043e\u0448\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"http:\/\/habrahabr.ru\/post\/149694\/\">\u0442\u0443\u0442<\/a>, \u0438 <a href=\"http:\/\/habrahabr.ru\/post\/150134\/\">\u0442\u0443\u0442<\/a>, \u043d\u0443 \u0438 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 RabbitMQ.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-158961","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/158961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=158961"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/158961\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=158961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=158961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=158961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}