Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions swift/account/auditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def _one_audit_pass(self, reported):
for path, device, partition in all_locs:
self.account_audit(path)
if time.time() - reported >= self.logging_interval:
self.logger.info(_('Since %(time)s: Account audits: '
'%(passed)s passed audit,'
'%(failed)s failed audit'),
self.logger.info('Since %(time)s: Account audits: '
'%(passed)s passed audit,'
'%(failed)s failed audit',
{'time': time.ctime(reported),
'passed': self.account_passes,
'failed': self.account_failures})
Expand All @@ -79,29 +79,29 @@ def run_forever(self, *args, **kwargs):
reported = time.time()
time.sleep(random() * self.interval)
while True:
self.logger.info(_('Begin account audit pass.'))
self.logger.info('Begin account audit pass.')
begin = time.time()
try:
reported = self._one_audit_pass(reported)
except (Exception, Timeout):
self.logger.increment('errors')
self.logger.exception(_('ERROR auditing'))
self.logger.exception('ERROR auditing')
elapsed = time.time() - begin
if elapsed < self.interval:
time.sleep(self.interval - elapsed)
self.logger.info(
_('Account audit pass completed: %.02fs'), elapsed)
'Account audit pass completed: %.02fs', elapsed)
dump_recon_cache({'account_auditor_pass_completed': elapsed},
self.rcache, self.logger)

def run_once(self, *args, **kwargs):
"""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()
self._one_audit_pass(reported)
elapsed = time.time() - begin
self.logger.info(
_('Account audit "once" mode completed: %.02fs'), elapsed)
'Account audit "once" mode completed: %.02fs', elapsed)
dump_recon_cache({'account_auditor_pass_completed': elapsed},
self.rcache, self.logger)

Expand All @@ -120,9 +120,9 @@ def validate_per_policy_counts(self, broker):
for key in policy_totals:
if policy_totals[key] == info[key]:
continue
raise InvalidAccountInfo(_(
raise InvalidAccountInfo(
'The total %(key)s for the container (%(total)s) does not '
'match the sum of %(key)s across policies (%(sum)s)')
'match the sum of %(key)s across policies (%(sum)s)'
% {'key': key,
'total': info[key],
'sum': policy_totals[key]})
Expand All @@ -140,16 +140,16 @@ def account_audit(self, path):
self.validate_per_policy_counts(broker)
self.logger.increment('passes')
self.account_passes += 1
self.logger.debug(_('Audit passed for %s'), broker)
self.logger.debug('Audit passed for %s', broker)
except InvalidAccountInfo as e:
self.logger.increment('failures')
self.account_failures += 1
self.logger.error(
_('Audit Failed for %(path)s: %(err)s'),
'Audit Failed for %(path)s: %(err)s',
{'path': path, 'err': str(e)})
except (Exception, Timeout):
self.logger.increment('failures')
self.account_failures += 1
self.logger.exception(_('ERROR Could not get account info %s'),
self.logger.exception('ERROR Could not get account info %s',
path)
self.logger.timing_since('timing', start_time)
51 changes: 25 additions & 26 deletions swift/account/reaper.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ def run_once(self, *args, **kwargs):
os.path.join(self.devices, device)):
self.logger.increment('errors')
self.logger.debug(
_('Skipping %s as it is not mounted'), device)
'Skipping %s as it is not mounted', device)
continue
self.reap_device(device)
except (Exception, Timeout):
self.logger.exception(_("Exception in top-level account reaper "
"loop"))
self.logger.exception("Exception in top-level account reaper "
"loop")
elapsed = time() - begin
self.logger.info(_('Devices pass completed: %.02fs'), elapsed)
self.logger.info('Devices pass completed: %.02fs', elapsed)

def reap_device(self, device):
"""
Expand Down Expand Up @@ -254,7 +254,7 @@ def reap_account(self, broker, partition, nodes, container_shard=None):
self.delay_reaping:
return False
account = info['account']
self.logger.info(_('Beginning pass on account %s'), account)
self.logger.info('Beginning pass on account %s', account)
self.reset_stats()
container_limit = 1000
if container_shard is not None:
Expand All @@ -279,43 +279,43 @@ def reap_account(self, broker, partition, nodes, container_shard=None):
self.container_pool.waitall()
except (Exception, Timeout):
self.logger.exception(
_('Exception with containers for account %s'), account)
'Exception with containers for account %s', account)
marker = containers[-1][0]
if marker == '':
break
log = 'Completed pass on account %s' % account
except (Exception, Timeout):
self.logger.exception(
_('Exception with account %s'), account)
log = _('Incomplete pass on account %s') % account
'Exception with account %s', account)
log = 'Incomplete pass on account %s' % account
if self.stats_containers_deleted:
log += _(', %s containers deleted') % self.stats_containers_deleted
log += ', %s containers deleted' % self.stats_containers_deleted
if self.stats_objects_deleted:
log += _(', %s objects deleted') % self.stats_objects_deleted
log += ', %s objects deleted' % self.stats_objects_deleted
if self.stats_containers_remaining:
log += _(', %s containers remaining') % \
log += ', %s containers remaining' % \
self.stats_containers_remaining
if self.stats_objects_remaining:
log += _(', %s objects remaining') % self.stats_objects_remaining
log += ', %s objects remaining' % self.stats_objects_remaining
if self.stats_containers_possibly_remaining:
log += _(', %s containers possibly remaining') % \
log += ', %s containers possibly remaining' % \
self.stats_containers_possibly_remaining
if self.stats_objects_possibly_remaining:
log += _(', %s objects possibly remaining') % \
log += ', %s objects possibly remaining' % \
self.stats_objects_possibly_remaining
if self.stats_return_codes:
log += _(', return codes: ')
log += ', return codes: '
for code in sorted(self.stats_return_codes):
log += '%s %sxxs, ' % (self.stats_return_codes[code], code)
log = log[:-2]
log += _(', elapsed: %.02fs') % (time() - begin)
log += ', elapsed: %.02fs' % (time() - begin)
self.logger.info(log)
self.logger.timing_since('timing', self.start_time)
delete_timestamp = Timestamp(info['delete_timestamp'])
if self.stats_containers_remaining and \
begin - float(delete_timestamp) >= self.reap_not_done_after:
self.logger.warning(
_('Account %(account)s has not been reaped since %(time)s') %
'Account %(account)s has not been reaped since %(time)s' %
{'account': account, 'time': delete_timestamp.isoformat})
return True

Expand Down Expand Up @@ -374,14 +374,14 @@ def reap_container(self, account, account_partition, account_nodes,
except ClientException as err:
if self.logger.getEffectiveLevel() <= DEBUG:
self.logger.exception(
_('Exception with %(ip)s:%(port)s/%(device)s'), node)
'Exception with %(ip)s:%(port)s/%(device)s', node)
self.stats_return_codes[err.http_status // 100] = \
self.stats_return_codes.get(err.http_status // 100, 0) + 1
self.logger.increment(
'return_codes.%d' % (err.http_status // 100,))
except (Timeout, socket.error) as err:
self.logger.error(
_('Timeout Exception with %(ip)s:%(port)s/%(device)s'),
'Timeout Exception with %(ip)s:%(port)s/%(device)s',
node)
if not objects:
break
Expand All @@ -398,9 +398,8 @@ def reap_container(self, account, account_partition, account_nodes,
nodes, obj['name'], policy_index)
pool.waitall()
except (Exception, Timeout):
self.logger.exception(_('Exception with objects for container '
'%(container)s for account %(account)s'
),
self.logger.exception('Exception with objects for container '
'%(container)s for account %(account)s',
{'container': container,
'account': account})
marker = objects[-1]['name']
Expand Down Expand Up @@ -428,7 +427,7 @@ def reap_container(self, account, account_partition, account_nodes,
except ClientException as err:
if self.logger.getEffectiveLevel() <= DEBUG:
self.logger.exception(
_('Exception with %(ip)s:%(port)s/%(device)s'), node)
'Exception with %(ip)s:%(port)s/%(device)s', node)
failures += 1
self.logger.increment('containers_failures')
self.stats_return_codes[err.http_status // 100] = \
Expand All @@ -437,7 +436,7 @@ def reap_container(self, account, account_partition, account_nodes,
'return_codes.%d' % (err.http_status // 100,))
except (Timeout, socket.error) as err:
self.logger.error(
_('Timeout Exception with %(ip)s:%(port)s/%(device)s'),
'Timeout Exception with %(ip)s:%(port)s/%(device)s',
node)
failures += 1
self.logger.increment('containers_failures')
Expand Down Expand Up @@ -504,7 +503,7 @@ def reap_object(self, account, container, container_partition,
except ClientException as err:
if self.logger.getEffectiveLevel() <= DEBUG:
self.logger.exception(
_('Exception with %(ip)s:%(port)s/%(device)s'), node)
'Exception with %(ip)s:%(port)s/%(device)s', node)
failures += 1
self.logger.increment('objects_failures')
self.stats_return_codes[err.http_status // 100] = \
Expand All @@ -515,7 +514,7 @@ def reap_object(self, account, container, container_partition,
failures += 1
self.logger.increment('objects_failures')
self.logger.error(
_('Timeout Exception with %(ip)s:%(port)s/%(device)s'),
'Timeout Exception with %(ip)s:%(port)s/%(device)s',
node)
if successes > failures:
self.stats_objects_deleted += 1
Expand Down
4 changes: 2 additions & 2 deletions swift/account/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ def __call__(self, env, start_response):
except HTTPException as error_response:
res = error_response
except (Exception, Timeout):
self.logger.exception(_('ERROR __call__ error with %(method)s'
' %(path)s '),
self.logger.exception('ERROR __call__ error with %(method)s'
' %(path)s ',
{'method': req.method, 'path': req.path})
res = HTTPInternalServerError(body=traceback.format_exc())
if self.log_requests:
Expand Down
8 changes: 4 additions & 4 deletions swift/common/container_sync_realms.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _reload(self):
log_func = self.logger.debug
else:
log_func = self.logger.error
log_func(_('Could not load %(conf)r: %(error)s') % {
log_func('Could not load %(conf)r: %(error)s' % {
'conf': self.conf_path, 'error': err})
else:
if mtime != self.conf_path_mtime:
Expand All @@ -67,7 +67,7 @@ def _reload(self):
conf.read(self.conf_path)
except configparser.ParsingError as err:
self.logger.error(
_('Could not load %(conf)r: %(error)s')
'Could not load %(conf)r: %(error)s'
% {'conf': self.conf_path, 'error': err})
else:
try:
Expand All @@ -81,8 +81,8 @@ def _reload(self):
now + self.mtime_check_interval
except (configparser.ParsingError, ValueError) as err:
self.logger.error(
_('Error in %(conf)r with '
'mtime_check_interval: %(error)s')
'Error in %(conf)r with '
'mtime_check_interval: %(error)s'
% {'conf': self.conf_path, 'error': err})
realms = {}
for section in conf.sections():
Expand Down
8 changes: 4 additions & 4 deletions swift/common/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ def possibly_quarantine(self, exc_type, exc_value, exc_traceback):
raise
quar_path = "%s-%s" % (quar_path, uuid4().hex)
renamer(self.db_dir, quar_path, fsync=False)
detail = _('Quarantined %(db_dir)s to %(quar_path)s due to '
'%(exc_hint)s database') % {'db_dir': self.db_dir,
detail = 'Quarantined %(db_dir)s to %(quar_path)s due to '
'%(exc_hint)s database' % {'db_dir': self.db_dir,
'quar_path': quar_path,
'exc_hint': exc_hint}
self.logger.error(detail)
Expand Down Expand Up @@ -410,7 +410,7 @@ def lock(self):
self.conn = conn
except (Exception, Timeout):
logging.exception(
_('Broker error trying to rollback locked connection'))
'Broker error trying to rollback locked connection')
conn.close()

def newid(self, remote_id):
Expand Down Expand Up @@ -613,7 +613,7 @@ def _commit_puts(self, item_list=None):
self._commit_puts_load(item_list, entry)
except Exception:
self.logger.exception(
_('Invalid pending entry %(file)s: %(entry)s'),
'Invalid pending entry %(file)s: %(entry)s',
{'file': self.pending_file, 'entry': entry})
if item_list:
self.merge_items(item_list)
Expand Down
Loading