Eventlet uses monotonic clocks by default since 0.21, hence no need
to patch that anymore.
Closes-Bug: #1906262
Co-Authored-By: Dimitri John Ledkov <xnox@ubuntu.com>
Co-Authored-By: Michael Hudson-Doyle <michael.hudson@ubuntu.com>
Change-Id: I72106068d99cc174412aa3026082ec63f1d895fe
The LOG instance is not being used and there is no need to import
"oslo_log". This will also prevent the circular import detected
in the related bug.
Change-Id: Id560ba80472b9efbcfbc289a18d4df312961fdb1
Related-Bug: #1888213
The monotonic package was needed for monotonic time operations when
running under Python runtimes older than 3.3. Since we now only support
versions higher than this, this third party package requirement can now
be removed.
Change-Id: Ie99411882822a5db47462fcb2748c6e978587b8c
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Resolves the following warnings seen in the likes of nova:
DeprecationWarning: Please provide `is_available()` function in your
custom Eventlet hub <module 'oslo_service' from
'../oslo_service/__init__.py'>."
It must return bool: whether hub supports current platform. See
eventlet/hubs/{epoll,kqueue} for example.
Since we're simply taking the default hub provided by eventlet and
overriding a single attribute, we will always have support so set the
attribute.
Change-Id: I219cf652526802b8212fe8a8f6c499e9aa24a3cf
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
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
Eventlet has used at least three different clock implementations by
default over the past couple of years (time.time, vendored monotonic,
and plain monotonic). Since we're forcing use of monotonic anyway,
this is all irrelevant to us outside of the fact that once we depend
on a new enough version of eventlet we can remove our monkey patching
of the hub. Asserting on the particular module that eventlet uses by
default is just breaking our unit tests on newer eventlet for no
good reason.
Change-Id: I0f5135567a16dde4c34cee35baa2054091dce728
Partial-Bug: 1788959
eventlet's hub mechanism defaults to using time.time for figuring
out how long to sleep, when to wake up etc:
https://github.com/eventlet/eventlet/blob/master/eventlet/hubs/epolls.py#L37https://github.com/eventlet/eventlet/blob/master/eventlet/hubs/hub.py#L344
So if you mess with the system time, anything using loopingcall
will stop working. Best example as described in the bug is
`nova-manage service list` which fails for some services when
the clock is advanced.
If we use a monotonic timer, then we can get past this problem.
In this review we use the EVENTLET_HUB hook to specify
a custom Hub. In our custom Hub, we just delegate to the
existing hub mechanism (get_default_hub()) to create an
instance of the Hub and override the clock with one based
on monotonic.
Note that use_hub() mechanism will not work because that sets
the Hub just for the current thread and will not work for other
threads that may be started later. In order to set this
environment variable early, we set it in the __init__.py so
anyone who uses oslo service will enable this support just
by a simple import referencing anything in oslo.service
Co-Authored-By: Victor Stinner <vstinner@redhat.com>
Closes-Bug: 1510234
Change-Id: I4c1cf223e9f6faa1e6dcaf432be1aa709072a343