~homeworkprod/byceps

ref: c530c71829bb77682a8641c3330c31246eb5fc3f byceps/worker.py -rwxr-xr-x 621 bytes
c530c718 — Jochen Kupperschmidt Test on Python 3.6, too 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""Run a worker for the job queue.

:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""

from rq import Worker

from byceps.util.jobqueue import connection, get_queue
from byceps.util.system import get_config_filename_from_env_or_exit

from bootstrap.util import app_context


if __name__ == '__main__':
    config_filename = get_config_filename_from_env_or_exit()

    with app_context(config_filename):
        with connection():
            queues = [get_queue()]

            worker = Worker(queues)
            worker.work()