Separate gather and object errors in reports. Add info about guid and object id in the object ones
This commit is contained in:
parent
c36d9bdd8e
commit
31c1ea1c21
|
@ -28,7 +28,7 @@ def _get_source_status(source, detailed=True):
|
||||||
out = {'next_harvest':'',
|
out = {'next_harvest':'',
|
||||||
'last_harvest_request':'',
|
'last_harvest_request':'',
|
||||||
'last_harvest_statistics':{'added':0,'updated':0,'errors':0},
|
'last_harvest_statistics':{'added':0,'updated':0,'errors':0},
|
||||||
'last_harvest_errors':[],
|
'last_harvest_errors':{'gather':[],'object':[]},
|
||||||
'overall_statistics':{'added':0, 'errors':0},
|
'overall_statistics':{'added':0, 'errors':0},
|
||||||
'packages':[]}
|
'packages':[]}
|
||||||
# Get next scheduled job
|
# Get next scheduled job
|
||||||
|
@ -79,11 +79,11 @@ def _get_source_status(source, detailed=True):
|
||||||
+ object_errors.count()
|
+ object_errors.count()
|
||||||
if detailed:
|
if detailed:
|
||||||
for gather_error in last_job.gather_errors:
|
for gather_error in last_job.gather_errors:
|
||||||
out['last_harvest_errors'].append(gather_error.message)
|
out['last_harvest_errors']['gather'].append(gather_error.message)
|
||||||
|
|
||||||
for object_error in object_errors:
|
for object_error in object_errors:
|
||||||
msg = 'GUID %s: %s' % (object_error.object.guid, object_error.message)
|
err = {'object_id':object_error.object.id,'object_guid':object_error.object.guid,'message': object_error.message}
|
||||||
out['last_harvest_errors'].append(msg)
|
out['last_harvest_errors']['object'].append(err)
|
||||||
|
|
||||||
# Overall statistics
|
# Overall statistics
|
||||||
packages = Session.query(distinct(HarvestObject.package_id),Package.name) \
|
packages = Session.query(distinct(HarvestObject.package_id),Package.name) \
|
||||||
|
|
|
@ -55,12 +55,33 @@
|
||||||
<td>
|
<td>
|
||||||
Last Harvest Errors: ${c.source.status.last_harvest_statistics.errors}<br/>
|
Last Harvest Errors: ${c.source.status.last_harvest_statistics.errors}<br/>
|
||||||
<py:choose>
|
<py:choose>
|
||||||
<py:when test="len(c.source.status.last_harvest_errors)>0">
|
<py:when test="len(c.source.status.last_harvest_errors.gather)>0">
|
||||||
|
<i>Gathering errors</i>
|
||||||
<ul>
|
<ul>
|
||||||
<li py:for="error in c.source.status.last_harvest_errors">${error}</li>
|
<li py:for="error in c.source.status.last_harvest_errors.gather">
|
||||||
|
<?python
|
||||||
|
lines = error.split('\n')
|
||||||
|
?>
|
||||||
|
<div py:for="line in lines">${line}</div>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</py:when>
|
</py:when>
|
||||||
</py:choose>
|
</py:choose>
|
||||||
|
<py:choose>
|
||||||
|
<py:when test="len(c.source.status.last_harvest_errors.object)>0">
|
||||||
|
<i>Object errors</i>
|
||||||
|
<ul>
|
||||||
|
<li py:for="error in c.source.status.last_harvest_errors.object">
|
||||||
|
<div>GUID ${error.object_guid}</div>
|
||||||
|
<?python
|
||||||
|
lines = error['message'].split('\n')
|
||||||
|
?>
|
||||||
|
<div py:for="line in lines">${line}</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</py:when>
|
||||||
|
</py:choose>
|
||||||
|
|
||||||
Last Harvest Added: ${c.source.status.last_harvest_statistics.added}<br/>
|
Last Harvest Added: ${c.source.status.last_harvest_statistics.added}<br/>
|
||||||
Last Harvest Updated: ${c.source.status.last_harvest_statistics.updated}<br/>
|
Last Harvest Updated: ${c.source.status.last_harvest_statistics.updated}<br/>
|
||||||
Last Harvest: ${c.source.status.last_harvest_request} <br/>
|
Last Harvest: ${c.source.status.last_harvest_request} <br/>
|
||||||
|
|
Loading…
Reference in New Issue