¼¿·¯¸®

DjangoÀÇ ºÐ»ê ÀÛ¾÷ ´ë±â¿­
Áö±Ý ´Ù¿î·Îµå

¼¿·¯¸® ¼øÀ§ ¹× ¿ä¾à

±¤°í

  • Rating:
  • ƯÇã:
  • BSD License
  • °¡°Ý:
  • FREE
  • °Ô½ÃÀÚ À̸§:
  • Ask Solem
  • °Ô½ÃÀÚ À¥»çÀÌÆ®:
  • http://search.cpan.org/~asksh/Modwheel-0.3.3/lib/Modwheel.pm

¼¿·¯¸® ű×


¼¿·¯¸® ¼³¸í

DjangoÀÇ ºÐ»ê ÀÛ¾÷ ´ë±â¿­ ¼¿·¯¸®´Â Django.Installationyou¿¡ ´ëÇÑ ºÐ»ê ÀÛ¾÷ ´ë±â¿­ ÇÁ·¹ÀÓ ¿öÅ©ÀÔ´Ï´Ù. Python ÆÐÅ°Áö À妽º (Pypi) ¶Ç´Â PIP¸¦ »ç¿ëÇÏ¿© ¼³Ä¡ÇÏ·Á¸é ¼¿·¯¸®¸¦ ¼³Ä¡ÇÒ ¼ö ÀÖ½À´Ï´Ù : $ PIP Easy_installÀ» »ç¿ëÇÏ¿© ¼¿·¯¸® ¼³Ä¡ ¼¿·¯¸® ¼³Ä¡, $ Easy_install Celeryif ¼Ò½º¸¦ ´Ù¿î·Îµå ÇÑ Celeryif tarballÀº ´ÙÀ½À» ¼öÇàÇÏ¿© ¼³Ä¡ÇÒ ¼ö ÀÖ½À´Ï´Ù : $ python setup.py ºôµå # python setup.py install # rootUsageHave·Î ¸ÚÁø ÀÚ½À¼­¸¦ ÀÛ¼ºÇÏÁö¸¸ °£´ÜÇÑ »ç¿ë¹ý Á¤º¸ÀÔ´Ï´Ù. amqp ¸Þ½ÃÁö ºê·ÎÄ¿¸¦ ½ÇÇàÇؾßÇÕ´Ï´Ù. rabbitmq¿Í ¸¶Âù°¡Áö·Î ´ç±Ù ¹èÆ÷ readme.note¿¡¼­ ¼³¸íÇÑ´ë·Î ¼³Á¤ ÆÄÀÏ¿¡ AMQP ¼­¹ö ¼³Á¤ÀÌ ÇÊ¿äÇÕ´Ï´Ù. CeleryD´Â ÇÑ ¹ø¿¡ ÇϳªÀÇ ¸Þ½ÃÁö¸¦ ó¸® ÇÒ ¼ö ÀÖ½À´Ï´Ù. , ÀÌ°ÍÀº SQLite°¡ Celery.task °¡Á® ¿À±â ÀÛ¾÷ >>>¿¡¼­ celery.log °¡Á® ¿À±â setup_logger (some_arg, ** kwargs)¿¡¼­ celery.task °¡Á® ¿À±â ÀÛ¾÷ >>>¿¡¼­ celery.task °¡Á® ¿À±â ÀÛ¾÷À» Çã¿ëÇÏÁö ¾Ê±â ¶§¹®¿¡. ... logger = setup_logger (** kwargs) ... logger.info ( "¹º°¡¸¦ Çß½À´Ï±î? : % s "% some_arg) >>> task.register (do_something,"do_something ") Âü°í ŽºÅ© ÇÔ¼ö´Â ¼¿·¯¸®¸¦ ½ÇÇàÇÏ´Â ¼¿·¯¸® µ¥¸ó¸¸ÀÌ Å½ºÅ© >>>¿¡¼­ ¼¿·¯¸® µ¥¸óÀ» Áö¿øÇÕ´Ï´Ù. >>> delay_task ( "do_something", some_arg = "foo bar baz") ¼¿·¯¸® µ¥¸óÀ» ½ÇÇàÇÏ´Â $ cd mydjangoproject $ env django_settings_module = ¼³Á¤ ¼¿·¯¸®µå ¹º°¡ : Foo Bar Baz TaskSceleryÀÇ AutoDiscovery´Â Django Admin°ú °°Àº AutoDiscovery ±â´ÉÀÌ ÀÖÀ¸¸ç, ÀÌ´Â ÀÚµ¿À¸·Î ¸ðµç ÀÛ¾÷À» ÀÚµ¿À¸·Î·ÎµåÇÕ´Ï´Ù. settings.Installed_Apps.aÀÌ ¸í·ÉÀ» Ãß°¡ÇÏ´Â ÁÁÀº Àå¼Ò´Â celery.task °¡Á® ¿À±â taskstasks.autodiscover ()¿¡¼­ urls.py¿¡ÀÖÀ» ¼ö ÀÖ½À´Ï´Ù. .log import setup_loggerfrom conctounter.models °¡Á® ¿À±â clickcountdef increment_click (for_url, ** kwargs) : logger = setup_logger (** kwargs ) click_for_url, cr = clickcount.objects.get_or_create (URL = for_URL) clicks_for_url.clicks = clicks_for_url.clicks + 1 clicks_for_url.save () logger.info ( "% s (% d¿¡¼­ % s)"% s (% d) "% (for_url) , clicks_for_url.clicks) tasks.register (increment_click, "increment_click") ÁÖ±âÀû TaskSperiodic ÀÛ¾÷Àº n Ãʸ¶´Ù ½ÇÇàµÇ´Â ŽºÅ©ÀÔ´Ï´Ù. ±×µéÀº Ãß°¡ Àμö¸¦ Áö¿øÇÏÁö ¾Ê½À´Ï´Ù. ´ÙÀ½ÀºÁÖ±âÀûÀÎ ÀÛ¾÷ÀÇ ¿¹ÀÔ´Ï´Ù. >>>¿¡¼­ celery.task °¡Á® ¿À±â ÀÛ¾÷, meightictask >>> datetime import timedelta >>> Ŭ·¡½º myperiodictask (meightickick) : ... name = "foo.my-secondic-task". .. run_every = timedelta (ÃÊ = 30) ... ... DEF ½ÇÇà (ÀÚü, ** kwargs) : ... logger = self.get_logger (** kwargs) ... logger.info ( "ÁÖ±âÀû ÀÛ¾÷ ½ÇÇà ! ") ... >>> Tasks.Register (myperiodictask) ¼¿·¯¸®¸¦ adminstal_apps¿¡ Ãß°¡ÇÏ°í syncdb¸¦ ¹ßÇàÇؾßÇÕ´Ï´Ù. ¿ä±¸ »çÇ× : ¡¤ ÆÄÀ̽㠡¤ Àå°í ÀÌ ¸±¸®½º¿¡¼­´Â »õ·Î¿î ±â´É : ¡¤ »õ·Î¿î ±â´ÉÀÌ ¸¹ÀÌ ÀÖÀ¸¹Ç·Î ²Ï ¾ÈÁ¤ÀûÀ̸ç 0.2·Î ¹üÇÁ ¹öÀüÀÌ ÀÖ½À´Ï´Ù. ÀÌ°ÍÀº »çÀü ¸±¸®½ºÀÔ´Ï´Ù. ¡¤ celery.task.mark_as_read () ¹× celery.task.mark_as_failure ()°¡ Á¦°ÅµÇ¾ú½À´Ï´Ù. celery.backends.default_backend.mark_as_read () ¹× celery.backends.default_backend.backends.default_backend.back_as_failure ()¸¦ ´ë½Å »ç¿ëÇϽʽÿÀ.


¼¿·¯¸® °ü·Ã ¼ÒÇÁÆ®¿þ¾î