Add workflow method to VideoProcessingManager
authorvijeth-aradhya <vijthaaa@gmail.com>
Sun, 4 Jun 2017 20:28:00 +0000 (01:58 +0530)
committervijeth-aradhya <vijthaaa@gmail.com>
Sun, 4 Jun 2017 20:28:00 +0000 (01:58 +0530)
This commit makes sure the old celery call works perfectly
when workflow method is introduced.

mediagoblin/media_types/video/processing.py
mediagoblin/processing/__init__.py
mediagoblin/submit/lib.py

index e6b4a0b2c0d53dfe3dd7d9c4c84616e15aa56aa5..d3fa9d5fff724532f3909690a8e21ff8d0de9979 100644 (file)
@@ -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)
index 7e05b242efcc6d20a508a31928135f7972ab244d..4e5853c113384645cbfbcf72fc20b13852243151 100644 (file)
@@ -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*
index 08a603e9aa317cc9b41e25156db9967a2aa4a07a..402eb8515bfd3bcce41619c329034e91ec83e10b 100644 (file)
@@ -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