aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-07-24 23:12:46 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2011-07-24 23:12:46 -0500
commit6b9ee0ca13b99ee20f9d0c680a950c6a7494a5a0 (patch)
tree66a96c0d5b14892eb35d6ab186dc249f1574d0f7
parent2684f341f5111fb831fb80e2b3b7ea7401cefc1c (diff)
downloadmediagoblin-6b9ee0ca13b99ee20f9d0c680a950c6a7494a5a0.tar.lz
mediagoblin-6b9ee0ca13b99ee20f9d0c680a950c6a7494a5a0.tar.xz
mediagoblin-6b9ee0ca13b99ee20f9d0c680a950c6a7494a5a0.zip
Store the task id of a processing action in the database.
-rw-r--r--mediagoblin/db/migrations.py12
-rw-r--r--mediagoblin/db/models.py3
-rw-r--r--mediagoblin/submit/views.py3
3 files changed, 17 insertions, 1 deletions
diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py
index 6a8ebcf9..797d39de 100644
--- a/mediagoblin/db/migrations.py
+++ b/mediagoblin/db/migrations.py
@@ -52,3 +52,15 @@ def mediaentry_mediafiles_main_to_original(database):
document['media_files']['original'] = original
collection.save(document)
+
+
+@RegisterMigration(3)
+def mediaentry_add_queued_task_id(database):
+ """
+ Add the 'queued_task_id' field for entries that don't have it.
+ """
+ collection = database['media_entries']
+ collection.update(
+ {'queued_task_id': {'$exists': False}},
+ {'$set': {'queued_task_id': None}},
+ multi=True)
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index bad15aca..e97dc537 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -162,6 +162,8 @@ class MediaEntry(Document):
queued for processing. This is stored in the mg_globals.queue_store
storage system.
+ - queued_task_id: celery task id. Use this to fetch the task state.
+
- media_files: Files relevant to this that have actually been processed
and are available for various types of display. Stored like:
{'thumb': ['dir1', 'dir2', 'pic.png'}
@@ -190,6 +192,7 @@ class MediaEntry(Document):
# For now let's assume there can only be one main file queued
# at a time
'queued_media_file': [unicode],
+ 'queued_task_id': unicode,
# A dictionary of logical names to filepaths
'media_files': dict,
diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py
index 1848f5e5..f19bf22e 100644
--- a/mediagoblin/submit/views.py
+++ b/mediagoblin/submit/views.py
@@ -84,7 +84,8 @@ def submit_start(request):
entry.save(validate=True)
# queue it for processing
- process_media_initial.delay(unicode(entry['_id']))
+ result = process_media_initial.delay(unicode(entry['_id']))
+ entry['queued_task_id'] = result.task_id
add_message(request, SUCCESS, 'Woohoo! Submitted!')