Store the task id of a processing action in the database.
This commit is contained in:
parent
2684f341f5
commit
6b9ee0ca13
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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!')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user