aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/processing/task.py
diff options
context:
space:
mode:
authorElrond <elrond+mediagoblin.org@samba-tng.org>2013-01-23 19:44:28 +0100
committerElrond <elrond+mediagoblin.org@samba-tng.org>2013-02-08 10:05:42 +0100
commit93b14fc300618e8b2c4ebfd54b9c59369ce0f417 (patch)
tree6c2c73bd2ce5a1671884913f12bab5cf2aec3abd /mediagoblin/processing/task.py
parent9d7c69fb74283d15589d8ed970d5b3bd1cfee2f0 (diff)
downloadmediagoblin-93b14fc300618e8b2c4ebfd54b9c59369ce0f417.tar.lz
mediagoblin-93b14fc300618e8b2c4ebfd54b9c59369ce0f417.tar.xz
mediagoblin-93b14fc300618e8b2c4ebfd54b9c59369ce0f417.zip
Implement ProcessingState class and use for images
The idea is to have a class that has the knowledge of the currently being processed media and also has tools for that. The long term idea is to make reprocessing easier by for example hiding the way the original comes into the processing code.
Diffstat (limited to 'mediagoblin/processing/task.py')
-rw-r--r--mediagoblin/processing/task.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/mediagoblin/processing/task.py b/mediagoblin/processing/task.py
index e9bbe084..8614c673 100644
--- a/mediagoblin/processing/task.py
+++ b/mediagoblin/processing/task.py
@@ -22,7 +22,7 @@ from celery import registry, task
from mediagoblin import mg_globals as mgg
from mediagoblin.db.models import MediaEntry
-from mediagoblin.processing import mark_entry_failed, BaseProcessingFail
+from . import mark_entry_failed, BaseProcessingFail, ProcessingState
from mediagoblin.tools.processing import json_processing_callback
_log = logging.getLogger(__name__)
@@ -85,8 +85,11 @@ class ProcessMedia(task.Task):
_log.debug('Processing {0}'.format(entry))
- # run the processing code
- entry.media_manager['processor'](entry)
+ proc_state = ProcessingState(entry)
+ with mgg.workbench_manager.create() as workbench:
+ proc_state.set_workbench(workbench)
+ # run the processing code
+ entry.media_manager['processor'](entry)
# We set the state to processed and save the entry here so there's
# no need to save at the end of the processing stage, probably ;)