Add workflow method to VideoProcessingManager
This commit makes sure the old celery call works perfectly when workflow method is introduced.
This commit is contained in:
parent
d3390c4391
commit
81c59ef06b
@ -28,6 +28,7 @@ from mediagoblin.processing import (
|
||||
ProcessingManager, request_from_args,
|
||||
get_process_filename, store_public,
|
||||
copy_original)
|
||||
from mediagoblin.processing.task import ProcessMedia
|
||||
from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
|
||||
from mediagoblin.media_types import MissingComponents
|
||||
|
||||
@ -503,3 +504,8 @@ class VideoProcessingManager(ProcessingManager):
|
||||
self.add_processor(InitialProcessor)
|
||||
self.add_processor(Resizer)
|
||||
self.add_processor(Transcoder)
|
||||
|
||||
def workflow(self, entry, feed_url, reprocess_action, reprocess_info=None):
|
||||
ProcessMedia().apply_async(
|
||||
[entry.id, feed_url, reprocess_action, reprocess_info], {},
|
||||
task_id=entry.queued_task_id)
|
||||
|
@ -257,7 +257,7 @@ class ProcessingManager(object):
|
||||
|
||||
return processor
|
||||
|
||||
def workflow(self):
|
||||
def workflow(self, entry, feed_url, reprocess_action, reprocess_info=None):
|
||||
"""
|
||||
Returns the Celery command needed to proceed with media processing
|
||||
*This method has to be implemented in all media types*
|
||||
|
@ -28,7 +28,7 @@ from mediagoblin.tools.response import json_response
|
||||
from mediagoblin.tools.text import convert_to_tag_list_of_dicts
|
||||
from mediagoblin.tools.federation import create_activity, create_generator
|
||||
from mediagoblin.db.models import Collection, MediaEntry, ProcessingMetaData
|
||||
from mediagoblin.processing import mark_entry_failed
|
||||
from mediagoblin.processing import mark_entry_failed, get_entry_and_processing_manager
|
||||
from mediagoblin.processing.task import ProcessMedia
|
||||
from mediagoblin.notifications import add_comment_subscription
|
||||
from mediagoblin.media_types import sniff_media
|
||||
@ -262,10 +262,12 @@ def run_process_media(entry, feed_url=None,
|
||||
:param reprocess_action: What particular action should be run.
|
||||
:param reprocess_info: A dict containing all of the necessary reprocessing
|
||||
info for the given media_type"""
|
||||
|
||||
reprocess_info = reprocess_info or {}
|
||||
entry, manager = get_entry_and_processing_manager(entry.id)
|
||||
|
||||
try:
|
||||
ProcessMedia().apply_async(
|
||||
[entry.id, feed_url, reprocess_action, reprocess_info], {},
|
||||
task_id=entry.queued_task_id)
|
||||
manager.workflow(entry, feed_url, reprocess_action, reprocess_info)
|
||||
except BaseException as exc:
|
||||
# The purpose of this section is because when running in "lazy"
|
||||
# or always-eager-with-exceptions-propagated celery mode that
|
||||
|
Loading…
x
Reference in New Issue
Block a user