affaan-m/ecc

django-celery

DjangoおよびCeleryを使用した非同期タスク処理。タスクキューイング、ワーカー管理、エラー処理、スケジューリング。Redis/RabbitMQ ブローカー統合。

ソースを見る
リポジトリの原文

見出し、例、コード、表、リンク、参照画像を含む原文を表示しています。

Django + Celery 非同期タスク

Django でのバックグラウンドジョブと非同期処理。

使用時期

  • メール送信をバックグラウンドで実行
  • 重い処理をスケジュール
  • 定期的なタスクを実行(日報、クリーンアップ)
  • 外部API呼び出しをキューイング
  • 複雑なワークフローを調整

セットアップ

1. Celery インストール

bash
pip install celery redis

2. タスク定義

python
from celery import shared_task

@shared_task
def send_email(recipient):
    # メール送信ロジック
    pass

3. ワーカー起動

bash
celery -A myapp worker -l info

タスク

非同期実行

python
send_email.delay(recipient)  # すぐにキューに追加、非同期実行

スケジューリング

python
from celery.schedules import crontab

app.conf.beat_schedule = {
    'send-report-daily': {
        'task': 'app.tasks.send_report',
        'schedule': crontab(hour=9, minute=0),
    },
}

エラーハンドリング

  • [ ] リトライロジック実装
  • [ ] デッドレター処理
  • [ ] ロギング構成
  • [ ] モニタリング設定(Flower)

詳細については、ドキュメントを参照してください。

同じリポジトリから

関連する Skills

すべての Skills
affaan-m
コミュニティ

context-and-decisions

- Govern stable domain context with a narrowly scoped CONTEXT.md when needed, and route hard-to-reverse decisions to ECC's existing architecture-decision-records skill. Use when domain terms require repeated explanation, one term has multiple meanings, unclear language causes module-boundary mistakes, or domain semantics must remain separate from architecture decisions.

導入数
5
GitHub Stars
27.8万
更新日
10月12日
affaan-m
コミュニティ

java-coding-standards

Java coding standards for Spring Boot and Quarkus services: naming, immutability, Optional usage, streams, exceptions, generics, CDI, reactive patterns, and project layout. Automatically applies framework-specific conventions. Use when writing or reviewing Java in a Spring Boot or Quarkus service.

導入数
5
GitHub Stars
27.8万
更新日
10月12日
affaan-m
コミュニティ

laravel-security

Laravel security best practices — authentication, authorization, Eloquent safety, CSRF, XSS prevention, API security, and secure deployment configurations. Use when reviewing Laravel auth, Eloquent safety, CSRF, XSS, API security, or deployment configuration.

導入数
7
GitHub Stars
27.8万
更新日
10月12日
affaan-m
コミュニティ

blender-motion-state-inspection

Use this skill when inspecting Blender characters, rigs, poses, animation retargeting, ground contact, facing direction, or model-vs-motion alignment where screenshots alone are not enough.

導入数
6
GitHub Stars
27.8万
更新日
10月12日