Merge lp:~greglange/swift/lp745965 into lp:~hudson-openstack/swift/trunk

Proposed by Greg Lange
Status: Merged
Approved by: gholt
Approved revision: 259
Merged at revision: 260
Proposed branch: lp:~greglange/swift/lp745965
Merge into: lp:~hudson-openstack/swift/trunk
Diff against target: 41 lines (+14/-1)
2 files modified
bin/swift-log-stats-collector (+10/-1)
swift/stats/log_processor.py (+4/-0)
To merge this branch: bzr merge lp:~greglange/swift/lp745965
Reviewer Review Type Date Requested Status
Swift Core security contacts Pending
Review via email: mp+55630@code.launchpad.net

Description of the change

Added two command line options to bin/swift-log-stats-collector.

To post a comment you must log in.
lp:~greglange/swift/lp745965 updated
259. By Greg Lange <email address hidden>

changed None check to use not and is

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/swift-log-stats-collector'
2--- bin/swift-log-stats-collector 2011-03-24 22:51:44 +0000
3+++ bin/swift-log-stats-collector 2011-03-30 21:11:32 +0000
4@@ -14,12 +14,21 @@
5 # See the License for the specific language governing permissions and
6 # limitations under the License.
7
8+from optparse import OptionParser
9+
10 from swift.stats.log_processor import LogProcessorDaemon
11 from swift.common.utils import parse_options
12 from swift.common.daemon import run_daemon
13
14 if __name__ == '__main__':
15- conf_file, options = parse_options()
16+ parser = OptionParser(usage='Usage: %prog [options] <conf_file>')
17+
18+ parser.add_option('--lookback_hours', type='int', dest='lookback_hours',
19+ help='Hours in the past to start looking for log files')
20+ parser.add_option('--lookback_window', type='int', dest='lookback_window',
21+ help='Hours past lookback_hours to stop looking for log files')
22+
23+ conf_file, options = parse_options(parser)
24 # currently the LogProcessorDaemon only supports run_once
25 options['once'] = True
26 run_daemon(LogProcessorDaemon, conf_file, section_name=None,
27
28=== modified file 'swift/stats/log_processor.py'
29--- swift/stats/log_processor.py 2011-03-15 15:32:27 +0000
30+++ swift/stats/log_processor.py 2011-03-30 21:11:32 +0000
31@@ -236,6 +236,10 @@
32 self.worker_count = int(c.get('worker_count', '1'))
33
34 def run_once(self, *args, **kwargs):
35+ for k in 'lookback_hours lookback_window'.split():
36+ if kwargs[k] is not None:
37+ setattr(self, k, kwargs[k])
38+
39 self.logger.info(_("Beginning log processing"))
40 start = time.time()
41 if self.lookback_hours == 0: