-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathworker.py
More file actions
executable file
·36 lines (25 loc) · 776 Bytes
/
worker.py
File metadata and controls
executable file
·36 lines (25 loc) · 776 Bytes
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
27
28
29
30
31
32
33
34
#!/usr/bin/env python
"""
could be used to add handling for errors
currently doesn't do anything
author: Tim Tregubov, 12/2014
"""
import sys
from rq import Queue, Connection, Worker
# Preload libraries
# import library_that_you_want_preloaded
# Provide queue names to listen to as arguments to this script,
# similar to rqworker
def exc_handler(job, exc_type, exc_value, traceback):
# progressfile_path = job.meta['progressfile']
# progressfile = open(progressfile_path, "w+")
# progressfile.seek(0)
# progressfile.write(str(traceback))
# progressfile.truncate()
# progressfile.flush()
return True
with Connection():
qs = map(Queue, sys.argv[1:]) or [Queue()]
w = Worker(qs)
# w.push_exc_handler(exc_handler)
w.work()