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

237.1.23 by James Westby
Add a script to get counts of outstanding jobs.
1
#!/usr/bin/python
2
3
import os
4
import sys
5
6
sys.path.insert(0, os.path.dirname(__file__))
237.1.66 by James Westby
Make some scripts run without PYTHONPATH
7
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "python-debian"))
237.1.23 by James Westby
Add a script to get counts of outstanding jobs.
8
import icommon
9
10
conn = icommon.get_sqlite_connection(icommon.sqlite_file)
11
c = conn.cursor()
12
try:
237.1.24 by James Westby
Make sure to substitute table name.
13
    rows = c.execute('select count(*), type from %s where active=1 '
14
            'group by type' % icommon.StatusDatabase.JOBS_TABLE).fetchall()
237.1.23 by James Westby
Add a script to get counts of outstanding jobs.
15
    for row in rows:
16
        print row
17
except:
18
    conn.rollback()
19
    raise
20
finally:
21
    c.close()