def send_notifications(self, query, task_status, retval, einfo):
        from panda.models import Export

        export = None
        extra_context = { 'query': query }
        url = None

        if einfo:
            if isinstance(einfo, tuple):
                tb = '\n'.join(format_tb(einfo[2]))
            else:
                tb = einfo.traceback

            task_status.exception(
                ugettext('Export failed'),
                u'%s\n\nTraceback:\n%s' % (unicode(retval), tb)
            )
            
            template_prefix = 'export_search_failed'
            extra_context['error'] = unicode(retval)
            extra_context['traceback'] = tb
            notification_type = 'Error'
        elif self.is_aborted():
            template_prefix = 'export_search_aborted'
            notification_type = 'Info'
        else:
            task_status.complete(ugettext('Export complete'))

            export = Export.objects.create(
                filename=retval,
                original_filename=retval,
                size=os.path.getsize(os.path.join(settings.EXPORT_ROOT, retval)),
                creator=task_status.creator,
                creation_date=task_status.start,
                dataset=None)

            extra_context['related_export'] = export

            url = '#export/%i' % export.id

            template_prefix = 'export_search_complete'
            notification_type = 'Info'

        if task_status.creator:
            notify(
                task_status.creator,
                template_prefix,
                notification_type,
                url,
                extra_context=extra_context
            )
Send user notifications this task has finished.
dataset/ETHPy150Open pandaproject/panda/panda/tasks/export_search.py/ExportSearchTask.send_notifications