~vila/udd/717204-stop-too-fast

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/python

import os
import sys

sys.path.insert(0, os.path.dirname(__file__))
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "python-debian"))
import icommon

conn = icommon.get_sqlite_connection(icommon.sqlite_file)
c = conn.cursor()
try:
    rows = c.execute('select count(*), type from %s where active=1 '
            'group by type' % icommon.StatusDatabase.JOBS_TABLE).fetchall()
    for row in rows:
        print row
except:
    conn.rollback()
    raise
finally:
    c.close()