forked from realfastvla/realfast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
queue_ctl.py
executable file
·36 lines (29 loc) · 893 Bytes
/
queue_ctl.py
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
35
36
#!/usr/bin/env python2.7
#
# Control queue
from rq import Queue, Connection
import os, glob, time, argparse, pickle, string
parser = argparse.ArgumentParser()
parser.add_argument("mode", help="'clear', 'failed', 'restart'")
args = parser.parse_args(); mode = args.mode
if __name__ == '__main__':
# connect
with Connection():
if mode == 'clear':
q = Queue('high')
q.empty()
q = Queue('low')
q.empty()
q = Queue('failed')
q.empty()
q = Queue('default')
q.empty()
elif mode == 'failed':
q = Queue('failed')
print 'Failed queue:'
print q.jobs
for i in range(len(q.jobs)):
print 'Failure %d' % i
print q.jobs[i].exc_info
elif mode == 'restart':
raise NotImplementedError