Merge "Added logging to start and end of audit passes."

This commit is contained in:
Jenkins 2012-02-27 16:34:27 +00:00 committed by Gerrit Code Review
commit 963d158afe
2 changed files with 8 additions and 2 deletions

View File

@ -43,6 +43,7 @@ class AccountAuditor(Daemon):
reported = time.time() reported = time.time()
time.sleep(random() * self.interval) time.sleep(random() * self.interval)
while True: while True:
self.logger.info(_('Begin account audit pass'))
begin = time.time() begin = time.time()
try: try:
all_locs = audit_location_generator(self.devices, all_locs = audit_location_generator(self.devices,
@ -64,10 +65,12 @@ class AccountAuditor(Daemon):
elapsed = time.time() - begin elapsed = time.time() - begin
if elapsed < self.interval: if elapsed < self.interval:
time.sleep(self.interval - elapsed) time.sleep(self.interval - elapsed)
self.logger.info(
_('Account audit pass completed: %.02fs'), elapsed)
def run_once(self, *args, **kwargs): def run_once(self, *args, **kwargs):
"""Run the account audit once.""" """Run the account audit once."""
self.logger.info('Begin account audit "once" mode') self.logger.info(_('Begin account audit "once" mode'))
begin = reported = time.time() begin = reported = time.time()
all_locs = audit_location_generator(self.devices, all_locs = audit_location_generator(self.devices,
account_server.DATADIR, account_server.DATADIR,
@ -86,7 +89,7 @@ class AccountAuditor(Daemon):
self.account_failures = 0 self.account_failures = 0
elapsed = time.time() - begin elapsed = time.time() - begin
self.logger.info( self.logger.info(
'Account audit "once" mode completed: %.02fs', elapsed) _('Account audit "once" mode completed: %.02fs'), elapsed)
def account_audit(self, path): def account_audit(self, path):
""" """

View File

@ -44,6 +44,7 @@ class ContainerAuditor(Daemon):
reported = time.time() reported = time.time()
time.sleep(random() * self.interval) time.sleep(random() * self.interval)
while True: while True:
self.logger.info(_('Begin container audit pass.'))
begin = time.time() begin = time.time()
try: try:
all_locs = audit_location_generator(self.devices, all_locs = audit_location_generator(self.devices,
@ -66,6 +67,8 @@ class ContainerAuditor(Daemon):
elapsed = time.time() - begin elapsed = time.time() - begin
if elapsed < self.interval: if elapsed < self.interval:
time.sleep(self.interval - elapsed) time.sleep(self.interval - elapsed)
self.logger.info(
_('Container audit pass completed: %.02fs'), elapsed)
def run_once(self, *args, **kwargs): def run_once(self, *args, **kwargs):
"""Run the container audit once.""" """Run the container audit once."""