Skip to content

Commit

Permalink
Remove outdated and deprecated code
Browse files Browse the repository at this point in the history
Change-Id: I0e12f422f52445387be036ca690edce1a4ef1595
  • Loading branch information
andreykurilin committed Feb 21, 2020
1 parent 2b2235f commit 6d7bbe0
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 306 deletions.
33 changes: 26 additions & 7 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ Changelog
[unreleased]
------------

Removed
~~~~~~~

* Python 2.7, Python 3.4 and Python 3.5 support
* Devstack plugin. It was deprecated long time ago. rally-openstack project
should be used instead

Changed
~~~~~~~

Expand All @@ -38,7 +31,33 @@ Changed

* *path_or_url* plugin follows redirects while validating urls now.

Removed
~~~~~~~

* Python 2.7, Python 3.4 and Python 3.5 support

* Devstack plugin. It was deprecated long time ago. rally-openstack project
should be used instead

* *rally.common.utils.distance* method was deprecated since Rally 0.4.1

* *rally.common.utils.format_float_to_str* method was deprecated since
Rally 0.11.2. *rally.utils.strutils.format_float_to_str* should be used
instead.

* *rally.task.atomic.optional_action_timer* decorator was deprecated since
Rally 0.10.0

* *rally.task.hook.Hook* class was deprecated since Rally 0.10.0.
*rally.task.hook.HookAction* should be used instead.

* *rally.task.trigger* module was deprecated since Rally 0.10.0.
*rally.task.hook.HookTrigger* should be used instead.

* *rally.common.i18n* module was deprecated since Rally 0.10.0

Fixed

~~~~~

* inaccurate calculation of 90 and 95 percentiles in case of 10k+ iterations
Expand Down
41 changes: 0 additions & 41 deletions rally/common/i18n.py

This file was deleted.

29 changes: 0 additions & 29 deletions rally/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

from rally.common import logging
from rally import exceptions
from rally.utils import strutils

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -192,27 +191,6 @@ def first_index(lst, predicate):
return None


@logging.log_deprecated(message="Its not used elsewhere in Rally already.",
rally_version="0.4.1")
def distance(s1, s2):
"""Computes the edit distance between two strings.
The edit distance is the Levenshtein distance. The larger the return value,
the more edits are required to transform one string into the other.
:param s1: First string to compare
:param s2: Second string to compare
:returns: Integer distance between two strings
"""
n = range(0, len(s1) + 1)
for y in range(1, len(s2) + 1):
l, n = n, [y]
for x in moves.range(1, len(s1) + 1):
n.append(min(l[x] + 1, n[-1] + 1,
l[x - 1] + (s2[y - 1] != s1[x - 1])))
return n[-1]


def retry(times, func, *args, **kwargs):
"""Try to execute multiple times function mitigating exceptions.
Expand Down Expand Up @@ -686,13 +664,6 @@ def clear(self, *args, **kwargs):
return super(LockedDict, self).clear(*args, **kwargs)


@logging.log_deprecated(message="Its not used elsewhere in Rally already.",
rally_version="0.11.2")
def format_float_to_str(num):
"""DEPRECATED. Use rally.utils.strutils.format_float_to_str instead."""
return strutils.format_float_to_str(num)


class DequeAsQueue(object):
"""Allows to use some of Queue methods on collections.deque."""

Expand Down
37 changes: 0 additions & 37 deletions rally/task/atomic.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,43 +94,6 @@ def func_atomic_actions(self, *args, **kwargs):
return wrap


def optional_action_timer(name, argument_name="atomic_action", default=True):
"""Optionally provide measure of execution time.
Decorates methods of the Scenario class. This provides duration in
seconds of each atomic action. When the decorated function is
called, this inspects the kwarg named by ``argument_name`` and
optionally sets an ActionTimer around the function call.
The ``atomic_action`` keyword argument does not need to be added
to the function; it will be popped from the kwargs dict by the
wrapper.
:param name: The name of the timer
:param argument_name: The name of the kwarg to inspect to
determine if a timer should be set.
:param default: Whether or not to set a timer if ``argument_name``
is not present.
"""
def wrap(func):
@functools.wraps(func)
def func_atomic_actions(self, *args, **kwargs):
LOG.warning("'optional_action_timer' is deprecated "
"since rally v0.10.0."
"Please use action_timer instead, "
"we have improved atomic actions, "
"now do not need to explicitly close "
"original action.")
if kwargs.pop(argument_name, default):
with ActionTimer(self, name):
f = func(self, *args, **kwargs)
else:
f = func(self, *args, **kwargs)
return f
return func_atomic_actions
return wrap


def merge_atomic_actions(atomic_actions, root=None, depth=0,
depth_of_processing=2):
"""Merge duplicates of atomic actions into one atomic action.
Expand Down
11 changes: 0 additions & 11 deletions rally/task/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,3 @@ def get_results(self):
results["summary"].setdefault(action_result["status"], 0)
results["summary"][action_result["status"]] += 1
return results


class Hook(HookAction):
"""DEPRECATED! USE `rally.task.hook.HookAction` instead."""

def __init__(self, *args, **kwargs):
super(Hook, self).__init__(*args, **kwargs)
LOG.warning("Please contact Rally plugin maintainer. The plugin '%s' "
"inherits the deprecated base class(Hook), "
"`rally.task.hook.HookAction` should be used instead."
% self.get_name())
40 changes: 0 additions & 40 deletions rally/task/trigger.py

This file was deleted.

18 changes: 0 additions & 18 deletions tests/unit/common/test_i18.py

This file was deleted.

23 changes: 0 additions & 23 deletions tests/unit/common/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,29 +150,6 @@ def test_list_with_non_existing_matching_element(self):
self.assertIsNone(utils.first_index(lst, lambda e: e == 2))


class EditDistanceTestCase(test.TestCase):

def test_distance_empty_strings(self):
dist = utils.distance("", "")
self.assertEqual(0, dist)

def test_distance_equal_strings(self):
dist = utils.distance("abcde", "abcde")
self.assertEqual(0, dist)

def test_distance_replacement(self):
dist = utils.distance("abcde", "__cde")
self.assertEqual(2, dist)

def test_distance_insertion(self):
dist = utils.distance("abcde", "ab__cde")
self.assertEqual(2, dist)

def test_distance_deletion(self):
dist = utils.distance("abcde", "abc")
self.assertEqual(2, dist)


class TenantIteratorTestCase(test.TestCase):

def test_iterate_per_tenant(self):
Expand Down
36 changes: 0 additions & 36 deletions tests/unit/task/test_atomic.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,42 +112,6 @@ def some_func(self):
"started_at": 1, "finished_at": 3}],
inst.atomic_actions())

@mock.patch("rally.task.atomic.LOG.warning")
@mock.patch("time.time", side_effect=[1, 3, 1, 3])
def test_optional_action_timer_decorator(self, mock_time,
mock_log_warning):

class TestAtomicTimer(atomic.ActionTimerMixin):

@atomic.optional_action_timer("some")
def some_func(self, a, b):
return a + b

@atomic.optional_action_timer("some", argument_name="foo",
default=False)
def other_func(self, a, b):
return a + b

inst = TestAtomicTimer()
self.assertEqual(5, inst.some_func(2, 3))
self.assertEqual([{"name": "some", "children": [],
"started_at": 1, "finished_at": 3}],
inst.atomic_actions())

inst = TestAtomicTimer()
self.assertEqual(5, inst.some_func(2, 3, atomic_action=False))
self.assertEqual([], inst.atomic_actions())

inst = TestAtomicTimer()
self.assertEqual(5, inst.other_func(2, 3))
self.assertEqual([], inst.atomic_actions())

inst = TestAtomicTimer()
self.assertEqual(5, inst.other_func(2, 3, foo=True))
self.assertEqual([{"name": "some", "children": [],
"started_at": 1, "finished_at": 3}],
inst.atomic_actions())

def test_merge_atomic_actions(self):
expected = [("foo", {"duration": 2, "count": 1,
"children": collections.OrderedDict()}),
Expand Down
64 changes: 0 additions & 64 deletions tests/unit/task/test_trigger.py

This file was deleted.

0 comments on commit 6d7bbe0

Please sign in to comment.