From: Michael Still Date: Sat, 16 Nov 2013 11:33:55 +0000 (+1100) Subject: Update openstack/common/periodic_task X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=cb688915028bca58848fc990bd284ca9161e9fdf;p=openstack-build%2Fcinder-build.git Update openstack/common/periodic_task The following commits are in this update: 1771a77 Adjust import order according to PEP8 imports rule 4bfb7a2 Apply six for metaclass 0ea069e Removed calls to locals() Change-Id: Ied20ce735af79b52e7674a3dfe3b097b84b61533 --- diff --git a/cinder/openstack/common/periodic_task.py b/cinder/openstack/common/periodic_task.py index 1693bd8c5..44faab560 100644 --- a/cinder/openstack/common/periodic_task.py +++ b/cinder/openstack/common/periodic_task.py @@ -17,8 +17,9 @@ import datetime import time from oslo.config import cfg +import six -from cinder.openstack.common.gettextutils import _ +from cinder.openstack.common.gettextutils import _ # noqa from cinder.openstack.common import log as logging from cinder.openstack.common import timeutils @@ -150,8 +151,8 @@ class _PeriodicTasksMeta(type): cls._periodic_last_run[name] = task._periodic_last_run +@six.add_metaclass(_PeriodicTasksMeta) class PeriodicTasks(object): - __metaclass__ = _PeriodicTasksMeta def run_periodic_tasks(self, context, raise_on_error=False): """Tasks to be run at a periodic interval.""" @@ -173,7 +174,8 @@ class PeriodicTasks(object): if spacing is not None: idle_for = min(idle_for, spacing) - LOG.debug(_("Running periodic task %(full_task_name)s"), locals()) + LOG.debug(_("Running periodic task %(full_task_name)s"), + {"full_task_name": full_task_name}) self._periodic_last_run[task_name] = timeutils.utcnow() try: @@ -182,7 +184,7 @@ class PeriodicTasks(object): if raise_on_error: raise LOG.exception(_("Error during %(full_task_name)s: %(e)s"), - locals()) + {"full_task_name": full_task_name, "e": e}) time.sleep(0) return idle_for