mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-08 22:18:13 +08:00
Removes old rollbar support - relies on the pluggable error reporters now
This commit is contained in:
+1
-5
@@ -23,7 +23,7 @@ from multiprocessing import Event, Process, Value, current_process
|
|||||||
# Local
|
# Local
|
||||||
from django_q import tasks
|
from django_q import tasks
|
||||||
from django_q.brokers import get_broker
|
from django_q.brokers import get_broker
|
||||||
from django_q.conf import Conf, logger, psutil, get_ppid, error_reporter, rollbar
|
from django_q.conf import Conf, logger, psutil, get_ppid, error_reporter
|
||||||
from django_q.models import Task, Success, Schedule
|
from django_q.models import Task, Success, Schedule
|
||||||
from django_q.queues import Queue
|
from django_q.queues import Queue
|
||||||
from django_q.signals import pre_execute
|
from django_q.signals import pre_execute
|
||||||
@@ -365,8 +365,6 @@ def worker(task_queue, result_queue, timer, timeout=Conf.TIMEOUT):
|
|||||||
result = (e, False)
|
result = (e, False)
|
||||||
if error_reporter:
|
if error_reporter:
|
||||||
error_reporter.report()
|
error_reporter.report()
|
||||||
if rollbar:
|
|
||||||
rollbar.report_exc_info()
|
|
||||||
# We're still going
|
# We're still going
|
||||||
if not result:
|
if not result:
|
||||||
db.close_old_connections()
|
db.close_old_connections()
|
||||||
@@ -382,8 +380,6 @@ def worker(task_queue, result_queue, timer, timeout=Conf.TIMEOUT):
|
|||||||
result = ('{} : {}'.format(e, traceback.format_exc()), False)
|
result = ('{} : {}'.format(e, traceback.format_exc()), False)
|
||||||
if error_reporter:
|
if error_reporter:
|
||||||
error_reporter.report()
|
error_reporter.report()
|
||||||
if rollbar:
|
|
||||||
rollbar.report_exc_info()
|
|
||||||
# Process result
|
# Process result
|
||||||
task['result'] = result[0]
|
task['result'] = result[0]
|
||||||
task['success'] = result[1]
|
task['success'] = result[1]
|
||||||
|
|||||||
@@ -150,9 +150,6 @@ class Conf(object):
|
|||||||
# The redis stats key
|
# The redis stats key
|
||||||
Q_STAT = 'django_q:{}:cluster'.format(PREFIX)
|
Q_STAT = 'django_q:{}:cluster'.format(PREFIX)
|
||||||
|
|
||||||
# Optional rollbar key
|
|
||||||
ROLLBAR = conf.get('rollbar', {})
|
|
||||||
|
|
||||||
# Optional error reporting setup
|
# Optional error reporting setup
|
||||||
ERROR_REPORTER = conf.get('error_reporter', {})
|
ERROR_REPORTER = conf.get('error_reporter', {})
|
||||||
|
|
||||||
@@ -190,19 +187,6 @@ if not logger.handlers:
|
|||||||
logger.addHandler(handler)
|
logger.addHandler(handler)
|
||||||
|
|
||||||
|
|
||||||
# rollbar
|
|
||||||
if Conf.ROLLBAR:
|
|
||||||
rollbar_conf = deepcopy(Conf.ROLLBAR)
|
|
||||||
try:
|
|
||||||
import rollbar
|
|
||||||
rollbar.init(rollbar_conf.pop('access_token'), environment=rollbar_conf.pop('environment'), **rollbar_conf)
|
|
||||||
except ImportError:
|
|
||||||
rollbar = None
|
|
||||||
|
|
||||||
else:
|
|
||||||
rollbar = None
|
|
||||||
|
|
||||||
|
|
||||||
# Error Reporting Interface
|
# Error Reporting Interface
|
||||||
class ErrorReporter(object):
|
class ErrorReporter(object):
|
||||||
|
|
||||||
|
|||||||
@@ -380,25 +380,6 @@ To enable installed error reporters, you must provide the configuration settings
|
|||||||
|
|
||||||
For more information on error reporters and developing error reporting plugins for Django Q, see :doc:`errors<errors>`.
|
For more information on error reporters and developing error reporting plugins for Django Q, see :doc:`errors<errors>`.
|
||||||
|
|
||||||
rollbar
|
|
||||||
~~~~~~~
|
|
||||||
You can redirect worker exceptions directly to your `Rollbar <https://rollbar.com/>`__ dashboard by installing the python notifier with ``pip install rollbar`` and adding this configuration dictionary to your config::
|
|
||||||
|
|
||||||
# rollbar config
|
|
||||||
Q_CLUSTER = {
|
|
||||||
'rollbar': {
|
|
||||||
'access_token': '32we33a92a5224jiww8982',
|
|
||||||
'environment': 'Django-Q'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Please check the Pyrollbar `configuration reference <https://github.com/rollbar/pyrollbar#configuration-reference>`__ for more options.
|
|
||||||
Note that you will need a `Rollbar <https://rollbar.com/>`__ account and access token to use this feature.
|
|
||||||
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
The ``rollbar`` setting is included for backwards compatibility, for those who utilized rollbar configuration before the ``error_reporter`` interface was introduced. Note that Rollbar support can be configured either via the ``rollbar`` setting, or via the ``django-q-rollbar`` package and enabled via the ``error_reporter`` setting above.
|
|
||||||
|
|
||||||
cpu_affinity
|
cpu_affinity
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@@ -8,4 +8,3 @@ django-redis
|
|||||||
iron-mq
|
iron-mq
|
||||||
boto3
|
boto3
|
||||||
pymongo
|
pymongo
|
||||||
rollbar
|
|
||||||
|
|||||||
+2
-3
@@ -24,9 +24,8 @@ pymongo==3.7.1
|
|||||||
python-dateutil==2.7.3 # via arrow, botocore, iron-core
|
python-dateutil==2.7.3 # via arrow, botocore, iron-core
|
||||||
pytz==2018.5 # via django
|
pytz==2018.5 # via django
|
||||||
redis==2.10.6
|
redis==2.10.6
|
||||||
requests==2.19.1 # via iron-core, rollbar
|
requests==2.19.1 # via iron-core
|
||||||
rollbar==0.14.2
|
|
||||||
s3transfer==0.1.13 # via boto3
|
s3transfer==0.1.13 # via boto3
|
||||||
six==1.11.0 # via blessed, python-dateutil, rollbar
|
six==1.11.0 # via blessed, python-dateutil
|
||||||
urllib3==1.23 # via requests
|
urllib3==1.23 # via requests
|
||||||
wcwidth==0.1.7 # via blessed
|
wcwidth==0.1.7 # via blessed
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ setup(
|
|||||||
test_requires=['pytest', 'pytest-django', ],
|
test_requires=['pytest', 'pytest-django', ],
|
||||||
cmdclass={'test': PyTest},
|
cmdclass={'test': PyTest},
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 4 - Beta',
|
'Development Status :: 5 - Production/Stable',
|
||||||
'Environment :: Web Environment',
|
'Environment :: Web Environment',
|
||||||
'Framework :: Django',
|
'Framework :: Django',
|
||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
|
|||||||
Reference in New Issue
Block a user