Minor improvements to the processing panel

- It is now possible to actually see what's processing, due to a bug fix
  where __getitem__ was called on the db model.
- Removed DEPRECATED message from the docstring, it wasn't true.
This commit is contained in:
Joar Wandborg 2012-07-10 17:53:37 +02:00
parent 81d3c4cf1c
commit 51eb0267d9
4 changed files with 33 additions and 8 deletions

View File

@ -116,8 +116,8 @@ class MediaEntryMixin(object):
""" """
Get the exception that's appropriate for this error Get the exception that's appropriate for this error
""" """
if self['fail_error']: if self.fail_error:
return common.import_component(self['fail_error']) return common.import_component(self.fail_error)
def get_license_data(self): def get_license_data(self):
"""Return license dict for requested license""" """Return license dict for requested license"""

View File

@ -19,13 +19,22 @@ import logging
from mediagoblin import mg_globals as mgg from mediagoblin import mg_globals as mgg
from mediagoblin.processing import \ from mediagoblin.processing import \
create_pub_filepath, FilenameBuilder create_pub_filepath, FilenameBuilder, BaseProcessingFail
from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
from . import transcoders from . import transcoders
_log = logging.getLogger(__name__) _log = logging.getLogger(__name__)
_log.setLevel(logging.DEBUG) _log.setLevel(logging.DEBUG)
class VideoTranscodingFail(BaseProcessingFail):
'''
Error raised if video transcoding fails
'''
general_message = _(u'Video transcoding failed')
def sniff_handler(media_file, **kw): def sniff_handler(media_file, **kw):
transcoder = transcoders.VideoTranscoder() transcoder = transcoders.VideoTranscoder()
data = transcoder.discover(media_file.name) data = transcoder.discover(media_file.name)

View File

@ -24,6 +24,8 @@ from mediagoblin.media_types import get_media_manager
from mediagoblin.processing import mark_entry_failed, BaseProcessingFail from mediagoblin.processing import mark_entry_failed, BaseProcessingFail
_log = logging.getLogger(__name__) _log = logging.getLogger(__name__)
logging.basicConfig()
_log.setLevel(logging.DEBUG)
################################ ################################
@ -32,8 +34,6 @@ _log = logging.getLogger(__name__)
class ProcessMedia(Task): class ProcessMedia(Task):
""" """
DEPRECATED -- This now resides in the individual media plugins
Pass this entry off for processing. Pass this entry off for processing.
""" """
def run(self, media_id): def run(self, media_id):
@ -44,16 +44,21 @@ class ProcessMedia(Task):
entry = mgg.database.MediaEntry.one( entry = mgg.database.MediaEntry.one(
{'_id': ObjectId(media_id)}) {'_id': ObjectId(media_id)})
_log.info('Running task {0} on media {1}: {2}'.format(
self.name,
entry._id,
entry.title))
# Try to process, and handle expected errors. # Try to process, and handle expected errors.
try: try:
#__import__(entry.media_type) #__import__(entry.media_type)
manager = get_media_manager(entry.media_type) manager = get_media_manager(entry.media_type)
_log.debug('Processing {0}'.format(entry)) _log.debug('Processing {0}'.format(entry))
manager['processor'](entry) manager['processor'](entry)
except BaseProcessingFail, exc: except BaseProcessingFail as exc:
mark_entry_failed(entry._id, exc) mark_entry_failed(entry._id, exc)
return return
except ImportError, exc: except ImportError as exc:
_log.error( _log.error(
'Entry {0} failed to process due to an import error: {1}'\ 'Entry {0} failed to process due to an import error: {1}'\
.format( .format(

View File

@ -30,12 +30,14 @@
{% if processing_entries.count() %} {% if processing_entries.count() %}
<table class="media_panel processing"> <table class="media_panel processing">
<tr> <tr>
<th>ID</th>
<th>Title</th> <th>Title</th>
<th>When submitted</th> <th>When submitted</th>
<th>Status</th> <th>Status</th>
</tr> </tr>
{% for media_entry in processing_entries %} {% for media_entry in processing_entries %}
<tr> <tr>
<td>{{ media_entry._id }}</td>
<td>{{ media_entry.title }}</td> <td>{{ media_entry.title }}</td>
<td>{{ media_entry.created.strftime("%m-%d-%Y %I:%M %p") }}</td> <td>{{ media_entry.created.strftime("%m-%d-%Y %I:%M %p") }}</td>
<td></td> <td></td>
@ -51,15 +53,24 @@
<table class="media_panel failed"> <table class="media_panel failed">
<tr> <tr>
<th>ID</th>
<th>Title</th> <th>Title</th>
<th>When submitted</th> <th>When submitted</th>
<th>Reason for failure</th> <th>Reason for failure</th>
<th>Failure metadata</th>
</tr> </tr>
{% for media_entry in failed_entries %} {% for media_entry in failed_entries %}
<tr> <tr>
<td>{{ media_entry._id }}</td>
<td>{{ media_entry.title }}</td> <td>{{ media_entry.title }}</td>
<td>{{ media_entry['created'].strftime("%m-%d-%Y %I:%M %p") }}</td> <td>{{ media_entry.created.strftime("%m-%d-%Y %I:%M %p") }}</td>
{% if media_entry.get_fail_exception() %}
<td>{{ media_entry.get_fail_exception().general_message }}</td> <td>{{ media_entry.get_fail_exception().general_message }}</td>
<td>{{ media_entry.fail_metadata }}</td>
{% else %}
<td>&nbsp;</td>
<td>&nbsp;</td>
{% endif %}
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>