You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
Background Tasks with Celery¶ If your application has a long running task, such as processing some uploaded data or sending email, you don’t want to wait for it to finish during a request. Instead, use a task queue to send the necessary data to another process that will run the task in the background while the request returns immediately. Celery is a powerful task queue that can be used for simple
celerydのメインプロセスは、タスクのメッセージをブローカーから受け取った後、ワーカープロセスに処理を実行させる。 メッセージをブローカーから受け取る際、実行中のものとは別に、事前にメッセージを取得(プリフェッチ)するようになっている。 全てのワーカープロセスが処理中であってもプリフェッチは行われる。 それぞれのタスクの処理に長い時間がかかる場合、複数のマシンでcelerydを動かしていても、このプリフェッチによってタスクが待ち状態になってしまう状況が発生する。 このプリフェッチ数は CELERYD_PREFETCH_MULTIPLIER の値を設定することで変更できる。デフォルト値は4。これは1ワーカーごとの値となる。(例: concurrencyを3に設定した場合は12) http://docs.celeryproject.org/en/latest/configuration.h
ソーシャルゲームとバッチサーバー ソーシャルゲームには、バッチキューサーバーがかなり重要かと思います。 そのへん、みなさんどうやってるんでしょうね‥ あまり話に上がらないです。 ソーシャルゲームで求められる要件としては、こんな感じでしょうか。 時間指定で予約実行出来る。 レイドボスの終了処理や、イベントのランキング集計など、積み上げ型のキューバッチシステムではなく、時間指定で任意の処理を行う必要があります。 冗長性 バッチサーバーが死ぬと一大事です。レイドボスが終わらなかったりしかねません。サーバーを2重化するなど、冗長性の確保が必要です。 スケールアウト 負荷が増大してきた時、スケールアップでも良いんですが、サーバーを付け足せば負荷対策できるのがベストです。 積み上げ型のキューシステムはいくつかあるのですが、上記のような要件に答えてくれそうなシステムがなかなか見つかりませんでした。 (探
This document describes the current stable version of Celery (5.4). For development docs, go here. Celery - Distributed Task Queue¶ Celery is a simple, flexible, and reliable distributed system to process vast amounts of messages, while providing operations with the tools required to maintain such a system. It’s a task queue with focus on real-time processing, while also supporting task scheduling
This document describes the current stable version of Celery (5.4). For development docs, go here. Tasks¶ Tasks are the building blocks of Celery applications. A task is a class that can be created out of any callable. It performs dual roles in that it defines both what happens when a task is called (sends a message), and what happens when a worker receives that message. Every task class has a uni
先ほどの記事の続きです。Celeryでcronの代わりにタスクのスケジュールをしたいという話です。 先ほどの記事でも使ったtasks.pyが以下です。myappの中に配置しています。 # myapp/tasks.py from celery.task import task from celery.log import get_default_logger @task def add(x, y): logger = get_default_logger() logger.info('add called') return x + y 早速このタスクをスケジュールしてみましょう。settings.pyに以下を追記します。CELERYBEAT_SCHEDULEに登録したいタスクを記述していく感じです。簡単ですね。この例では30秒置きにタスクを実行します。 from celery.schedul
Djangoでタスクをスケジュールしたいなっていう時に、今まではcronで処理してたんですけど、cronで処理するとシェルから叩けるようにコマンド用意する必要があったり、処理が散らばったりして気持ちが悪いなと思ってたんですけど、何気なくStackOverflow見てたらいい感じの質問が見つかりました。 一番人気の回答はcron使えや!っていう残念なものなんですけど、2番目の回答にCelery使ったら良いよって書かれてて、セロリか…などと思いながら調べてみるといい感じだったので使ってみる事にしました。CeleryはPythonで書かれたジョブキューで、バックエンドにはRedisとかMongoDBとか他にも色々使えるみたいですが、デフォルトにはRabbitMQが採用されています。Celery単体でも使えるのですが、DjangoやPylonsなどに組み込むためのモジュールも用意されていて、タスク
This document describes the current stable version of Celery (5.4). For development docs, go here. Periodic Tasks¶ Introduction¶ celery beat is a scheduler; It kicks off tasks at regular intervals, that are then executed by available worker nodes in the cluster. By default the entries are taken from the beat_schedule setting, but custom stores can also be used, like storing the entries in a SQL da
This document describes the current stable version of Celery (5.3). For development docs, go here. Celery - Distributed Task Queue¶ Celery is a simple, flexible, and reliable distributed system to process vast amounts of messages, while providing operations with the tools required to maintain such a system. It’s a task queue with focus on real-time processing, while also supporting task scheduling
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く