~james-w/udd/management-commands

« back to all changes in this revision

Viewing changes to udd/scripts/graph_failures.py

  • Committer: James Westby
  • Date: 2011-12-13 21:09:23 UTC
  • mfrom: (557.1.1 drop_email_failures)
  • Revision ID: james.westby@canonical.com-20111213210923-tfrirlx3xbwmi70u
Merged drop_email_failures into management-commands.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from udd import icommon
2
 
from udd.paths import paths
 
1
from udd import (
 
2
    icommon,
 
3
    iconfig,
 
4
    )
3
5
 
4
6
 
5
7
def find_info_where(package_info, clause):
10
12
    return ret
11
13
 
12
14
 
13
 
def get_info():
14
 
    db = icommon.StatusDatabase(paths.sqlite_file)
 
15
def get_info(conf):
 
16
    db = icommon.StatusDatabase(conf.get('pi.sqlite_file'))
15
17
    return db.summarise_failures()[1]
16
18
 
17
19
 
22
24
    cb(len(outstanding), failed)
23
25
 
24
26
 
25
 
def get_main_packages():
26
 
    db = icommon.PackageDatabase(paths.sqlite_package_file)
 
27
def get_main_packages(conf):
 
28
    db = icommon.PackageDatabase(conf.get('pi.sqlite_package_file'))
27
29
    return db.list_packages_in_main()
28
30
 
29
31
 
32
34
 
33
35
 
34
36
def main():
35
 
    package_info = get_info()
36
 
    db = icommon.HistoryDatabase(paths.sqlite_history_file)
 
37
    conf =  iconfig.ImporterStack()
 
38
    package_info = get_info(conf)
 
39
    db = icommon.HistoryDatabase(conf.get('pi.sqlite_history_file'))
37
40
    update_failed_counts(package_info, db.set_counts)
38
 
    main_packages = get_main_packages()
 
41
    main_packages = get_main_packages(conf)
39
42
    main_package_info = filter_packages(main_packages, package_info)
40
43
    update_failed_counts(main_package_info, db.set_main_counts)