2

I am doing data migration which deals with images/videos and such being downloaded and then sent to dropbox by using its api.

I'm using python-django for the entire web app but I imagine this will take a lot of bandwidth and there might be lot of issues where a failure of one image being saved shouldn't stop the entire migration.

Thus, is celery a good idea? Or Twisted?

I'm a bit confused about how this would help me. What I've in mind is to spawn a server/thread for the process of dealing with a single image or a small set of images and thus being able to do it on multiple threads.

4

1 に答える 1

1

「セロリは良い考えですか?」という質問に対する短い答えです。は「はい」です。Celery を使用して同様のプロセスを実現しました。これにより、ユーザーがフォームを送信すると、特に Twitter API への非同期呼び出しが開始され、データベースに保存されたオブジェクトに書き戻されます。Celery がこのタスクに優れていることがわかりました (しゃれは意図されていません)。

Celery を使用すると、事前に定義されたタスク (部分的には、@task デコレータが追加された「通常の」Python 関数と考えることができます) を開始できます。ユーザーが画像をダウンロードしたいことを示すたびに、または画像。Celery を使用すると、エラーや再試行をタスクごとに細かく制御できます。また、タスクを個別に、またはチェーン、コード、またはグループとして送信できます。つまり、単一のイメージのダウンロードに失敗した場合でも移行を継続するという要件を確実に達成できます。 .

Celery のチュートリアル (こちら) と Celery-Django のチュートリアル(こちら) に時間を費やすことをお勧めします。ここでは、Celery と Django の基本的なワークフローを紹介します。

私は Twisted のメリットについて話すことはできませんが、それぞれの相対的な長所と短所についての意見を探しているなら、これらは良い出発点のように見えます:

于 2012-12-30T14:15:37.307 に答える