Merge tag '3.2.0' into debian/mitaka
oslo.concurrency 3.2.0 release meta:version: 3.2.0 meta:series: mitaka meta:release-type: release
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
include AUTHORS
|
||||
include ChangeLog
|
||||
exclude .gitignore
|
||||
exclude .gitreview
|
||||
|
||||
global-exclude *.pyc
|
||||
@@ -310,6 +310,34 @@ def synchronized_with_prefix(lock_file_prefix):
|
||||
return functools.partial(synchronized, lock_file_prefix=lock_file_prefix)
|
||||
|
||||
|
||||
def remove_external_lock_file_with_prefix(lock_file_prefix):
|
||||
"""Partial object generator for the remove lock file function.
|
||||
|
||||
Redefine remove_external_lock_file_with_prefix in each project like so::
|
||||
|
||||
(in nova/utils.py)
|
||||
from nova.openstack.common import lockutils
|
||||
|
||||
synchronized = lockutils.synchronized_with_prefix('nova-')
|
||||
synchronized_remove = lockutils.remove_external_lock_file_with_prefix(
|
||||
'nova-')
|
||||
|
||||
(in nova/foo.py)
|
||||
from nova import utils
|
||||
|
||||
@utils.synchronized('mylock')
|
||||
def bar(self, *args):
|
||||
...
|
||||
|
||||
<eventually call synchronized_remove('mylock') to cleanup>
|
||||
|
||||
The lock_file_prefix argument is used to provide lock files on disk with a
|
||||
meaningful prefix.
|
||||
"""
|
||||
return functools.partial(remove_external_lock_file,
|
||||
lock_file_prefix=lock_file_prefix)
|
||||
|
||||
|
||||
def _lock_wrapper(argv):
|
||||
"""Create a dir for locks and pass it to command from arguments
|
||||
|
||||
|
||||
@@ -485,8 +485,7 @@ class LockutilsModuleTestCase(test_base.BaseTestCase):
|
||||
cmd = [sys.executable, '-m', 'oslo_concurrency.lockutils']
|
||||
with open(os.devnull, 'w') as devnull:
|
||||
retval = subprocess.call(cmd, stderr=devnull)
|
||||
# 1 for Python 2.7 and 3.x, 255 for 2.6
|
||||
self.assertIn(retval, [1, 255])
|
||||
self.assertEqual(1, retval)
|
||||
|
||||
|
||||
class TestLockFixture(test_base.BaseTestCase):
|
||||
|
||||
@@ -8,7 +8,7 @@ enum34;python_version=='2.7' or python_version=='2.6'
|
||||
iso8601>=0.1.9
|
||||
oslo.config>=2.7.0 # Apache-2.0
|
||||
oslo.i18n>=1.5.0 # Apache-2.0
|
||||
oslo.utils>=2.8.0 # Apache-2.0
|
||||
oslo.utils>=3.2.0 # Apache-2.0
|
||||
six>=1.9.0
|
||||
fasteners>=0.7 # Apache-2.0
|
||||
retrying!=1.3.0,>=1.2.3 # Apache-2.0
|
||||
|
||||
Reference in New Issue
Block a user