~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to database/replication/slon_ctl.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-06-25 08:55:37 UTC
  • mfrom: (13287.1.8 bug-800652)
  • Revision ID: launchpad@pqm.canonical.com-20110625085537-moikyoo2pe98zs7r
[r=jcsackett, julian-edwards][bug=800634,
        800652] Enable and display overrides on sync package uploads.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python -S
2
2
#
3
 
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 
3
# Copyright 2009 Canonical Ltd.  This software is licensed under the
4
4
# GNU Affero General Public License version 3 (see the file LICENSE).
5
5
 
6
6
"""Startup and shutdown slon processes.
11
11
 
12
12
import _pythonpath
13
13
 
14
 
from optparse import OptionParser
15
14
import os.path
16
15
import subprocess
17
16
import sys
 
17
from optparse import OptionParser
18
18
 
19
 
from lp.services.config import config
20
 
from lp.services.database.sqlbase import connect
21
 
from lp.services.scripts import (
22
 
    logger,
23
 
    logger_options,
24
 
    )
 
19
from canonical.config import config
 
20
from canonical.database.postgresql import ConnectionString
 
21
from canonical.database.sqlbase import connect
 
22
from canonical.launchpad.scripts import logger, logger_options
25
23
import replication.helpers
26
24
 
27
 
 
28
25
__metaclass__ = type
29
26
__all__ = []
30
27
 
76
73
    if explicit is not None:
77
74
        nodes = [explicit]
78
75
    else:
79
 
        nodes = replication.helpers.get_all_cluster_nodes(
80
 
            connect(user='slony'))
 
76
        nodes = replication.helpers.get_all_cluster_nodes(connect('slony'))
81
77
 
82
78
    if command == 'start':
83
79
        return start(log, nodes, options.lag)
108
104
        log.debug("Logging to %s" % logfile)
109
105
        log.debug("PID file %s" % pidfile)
110
106
        # Hard code suitable command line arguments for development.
111
 
        slon_args = "-d 2 -s 500 -t 2500"
 
107
        slon_args = "-d 2 -s 2000 -t 10000"
112
108
        if lag is not None:
113
109
            slon_args = "%s -l '%s'" % (slon_args, lag)
114
110
        cmd = [
135
131
def stop(log, nodes):
136
132
    for node in nodes:
137
133
        pidfile = get_pidfile(node.nickname)
 
134
        logfile = get_logfile(node.nickname)
138
135
 
139
136
        if not os.path.exists(pidfile):
140
137
            log.info(