๐Ÿ”— Django & Celery in production

DjangoCon JP 2021 ็™บ่กจ่ณ‡ๆ–™

Djangoใง้žๅŒๆœŸๅ‡ฆ็†ใ‚’ๅฎŸ็พใ™ใ‚‹ใŸใ‚ใซใ€ใ‚ˆใไฝฟใ‚ใ‚Œใฆใ„ใ‚‹Celeryใ€‚ใŸใ Djangoใปใฉ็Ÿฅ่ฆ‹ใŒๅ…ฑๆœ‰ใ•ใ‚Œใฆใ„ใชใ„ใŸใ‚ใ€ใชใ‚“ใจใชใไฝฟใฃใฆใ„ใ‚‹ใจใ„ใ†ๆ–นใ‚‚ๅคšใ„ใฎใงใฏใชใ„ใ‹ใจๆ€ใ„ใพใ™ใ€‚ใใฎใ‚ˆใ†ใชๅ ดๅˆCeleryใ‚’ไฝฟใˆใ‚‹ใ‚ˆใ†ใซใ™ใ‚‹ใพใงใฏ้ †่ชฟใงใ‚‚ใ€ๅฎŸ้š›ใซ้‹็”จใŒใฏใ˜ใพใฃใŸใ‚ใจใซๅ›ฐใ‚‹ใ“ใจใŒๅ‡บใฆใใพใ™ใ€‚ไพ‹ใˆใฐใ€ใƒญใ‚ฐใฎไฟๅญ˜ใ€ใƒชใƒˆใƒฉใ‚คใฎ่จญ่จˆใ€ใƒ‡ใƒ—ใƒญใ‚คๆˆฆ็•ฅใชใฉใ€‚
ใ“ใฎใƒˆใƒผใ‚ฏใงใฏใ€Celeryใ‚’Djangoใƒ—ใƒญใ‚ธใ‚งใ‚ฏใƒˆใงๅฎŸ้š›ใซ้‹็”จใ™ใ‚‹ใ†ใˆใงใฎๅฝน็ซ‹ใคTipsใ‚’ใŠไผใˆใ—ใพใ™ใ€‚
Some good tips about Celery Production tips from Django Congress 2021 in Nagano this year (I couldn't attend). Most of the information is in the docs in English, but it's handy to see it condensed, even if it's in Japanese. A couple key points:

  • Use **kwargs for your tasks input. This makes it easier to make updates to your tasks once they're already running in production if your input needs to change.ย 
  • Reminders about all of the handy kwargs you can pass to tasks in regards to retry. Especially handy autoretry_for where you can pass a tuple of exceptions that will cause the task to automatically retry
  1. Tagged with
  2. python
  3. django