~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to database/replication/sync.py

  • Committer: Stuart Bishop
  • Date: 2010-01-06 15:52:31 UTC
  • mto: (7675.1212.22 pending-db-changes)
  • mto: This revision was merged to the branch mainline in revision 10225.
  • Revision ID: stuart.bishop@canonical.com-20100106155231-msakviqdx7q6hm7i
Simple script to block until cluster is synced

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python2.5
 
2
#
 
3
# Copyright 2010 Canonical Ltd.  This software is licensed under the
 
4
# GNU Affero General Public License version 3 (see the file LICENSE).
 
5
 
 
6
"""Block until the replication cluster synchronizes."""
 
7
 
 
8
__metaclass__ = type
 
9
__all__ = []
 
10
 
 
11
import _pythonpath
 
12
 
 
13
from optparse import OptionParser
 
14
 
 
15
from canonical.launchpad.scripts import logger_options, db_options
 
16
from replication.helpers import sync
 
17
 
 
18
if __name__ == '__main__':
 
19
    parser = OptionParser()
 
20
    parser.add_option(
 
21
        "-t", "--timeout", dest="timeout", metavar="SECS", type="int",
 
22
        help="Abort if no sync after SECS seconds.", default=0)
 
23
    logger_options(parser)
 
24
    db_options(parser)
 
25
    options, args = parser.parse_args()
 
26
    sync(options.timeout)