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
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."""
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:
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