예제 #1
0
 def run(self, queues, *args, **kwargs):
     """
     Accepts a list of queues to run python manage.py workers default high low
     Otherwise will just start on default
     --seperate-threads (-t) for a seperate thread per worker
     """
     get_worker(*queues.split(' ')).work(False)
예제 #2
0
파일: app.py 프로젝트: FlorinaR/mptracker
 def worker():
     """ run a worker process """
     worker = get_worker()
     sentry = flask.current_app.extensions.get('sentry')
     if sentry is not None:
         from rq.contrib.sentry import register_sentry
         register_sentry(sentry.client, worker)
     worker.work()
예제 #3
0
파일: app.py 프로젝트: mgax/hambar109
 def worker():
     from flask.ext.rq import get_worker
     get_worker().work()
예제 #4
0
파일: app.py 프로젝트: ianisfmi/mptracker
 def worker():
     from flask.ext.rq import get_worker
     get_worker().work()
예제 #5
0
from ghinbox import app


def exception_handler(job, *exc_info):
    """
    Called by RQ when there is a failure in a worker.
    NOTE: Make sure that in your RQ worker process, rollbar.init() has been called with
    handler='blocking'. The default handler, 'thread', does not work from inside an RQ worker.
    """
    # Report data about the job with the exception.
    job_info = job.to_dict()
    # job_info['data'] is the pickled representation of the job, and doesn't json-serialize well.
    # repr() works nicely.
    job_info['data'] = repr(job_info['data'])

    extra_data = {'job': job_info}
    payload_data = {'framework': 'rq'}

    rollbar.report_exc_info(exc_info, extra_data=extra_data, payload_data=payload_data)

    # continue to the next handler
    return True


if __name__ == '__main__':
    rollbar.init(app.config['ROLLBAR_ACCESS_TOKEN'], 'production', handler='blocking')
    with app.app_context():
        worker = get_worker()
        worker.push_exc_handler(exception_handler)
        worker.work()
예제 #6
0
파일: manage.py 프로젝트: patseng/Testing
def work():
    """Process the queue."""
    get_worker().work()