~james-w/udd/management-commands

« back to all changes in this revision

Viewing changes to udd/scripts/add_import_jobs.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 import lpapi
3
 
from udd.paths import paths
 
1
from udd import (
 
2
    icommon,
 
3
    iconfig,
 
4
    lpapi,
 
5
    )
4
6
 
5
7
 
6
8
def main():
7
 
    lock = icommon.lock_add_import_jobs()
 
9
    conf = iconfig.ImporterStack()
 
10
    lock = icommon.lock_path(conf.get('pi.script_locks_dir'), 'add_import_jobs')
8
11
    if lock is None:
9
12
        print "Another instance of add_import_jobs is already running."
10
13
        return
11
14
    try:
12
15
        lp = lpapi.get_lp()
13
 
        status_db = icommon.StatusDatabase(paths.sqlite_file)
 
16
        status_db = icommon.StatusDatabase(conf.get('pi.sqlite_file'))
14
17
        icommon.create_import_jobs(lp, status_db)
15
18
    finally:
16
19
        lock.close()