Limit monotonic to py2

A recent requirements change [1] restricted monotonic to <py3.3, meaning
that any subsequent change triggering the requirements-check job will
fail until that's synced. Do that.

In order to make this sane, we need to be sure we're only using
monotonic if it's available. In oslo_service.__init__.py, we're using
the actual library if eventlet is. In periodic_task.py we're using the
actual library if the monotonic() method isn't available in the time
module.

[1] Ib8c1bf08f5fa7463911602b0df19315907c81e04

Change-Id: I3b24a089b780aac2746f48f7d5b538546ccce982
This commit is contained in:
Eric Fried 2018-11-06 15:45:13 -06:00
parent 3e08f3375e
commit 643578c899
3 changed files with 7 additions and 3 deletions

View File

@ -13,7 +13,6 @@
import os
import eventlet.patcher
import monotonic
from oslo_log import log as logging
time = eventlet.patcher.original('time')
@ -27,6 +26,7 @@ if hasattr(time, 'monotonic'):
# Use builtin monotonic clock, Python 3.3+
_monotonic = time.monotonic
else:
import monotonic
_monotonic = monotonic.monotonic

View File

@ -16,7 +16,11 @@ import logging
import random
import time
from monotonic import monotonic as now # noqa
if hasattr(time, 'monotonic'):
now = time.monotonic
else:
from monotonic import monotonic as now # noqa
from oslo_utils import reflection
import six

View File

@ -5,7 +5,7 @@
WebOb>=1.7.1 # MIT
eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT
greenlet>=0.4.10 # MIT
monotonic>=0.6 # Apache-2.0
monotonic>=0.6;python_version<'3.3' # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
oslo.concurrency>=3.25.0 # Apache-2.0
oslo.config>=5.1.0 # Apache-2.0