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)
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'}
# 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,
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!')