Only install monotonic on python2

monotonic is a backport of time.monotonic from python3. Only install it
for python2.

Depends-On: https://review.openstack.org/615441
Change-Id: Id27cd748e883d54dd93dac2e6bd8caee6728f7e1
This commit is contained in:
Jon Schlueter 2019-08-15 10:05:55 -04:00
parent b6896c2400
commit 6c0a982788
2 changed files with 8 additions and 3 deletions

View File

@ -13,8 +13,13 @@
# under the License.
import collections
import six
if six.PY2:
from monotonic import monotonic as now
else:
from time import monotonic as now
import monotonic
from oslo_log import log
from oslo_utils import timeutils
@ -94,7 +99,7 @@ class GenericComputePollster(plugin_base.PollsterBase):
if instance.id not in cache[self.inspector_method]:
result = getattr(self.inspector, self.inspector_method)(
instance, duration)
polled_time = monotonic.monotonic()
polled_time = now()
# Ensure we don't cache an iterator
if isinstance(result, collections.Iterable):
result = list(result)

View File

@ -8,7 +8,7 @@ futures>=3.0;python_version=='2.7' or python_version=='2.6' # BSD
futurist>=1.8.0 # Apache-2.0
jsonpath-rw-ext>=1.1.3 # Apache-2.0
lxml>=3.4.1 # BSD
monotonic>=0.6
monotonic>=0.6;python_version<'3.3' # Apache-2.0
msgpack>=0.5.0 # Apache-2.0
oslo.concurrency>=3.26.0 # Apache-2.0
oslo.config>=5.2.0 # Apache-2.0