Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions st2actions/st2actions/policies/concurrency.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ def __init__(self, policy_ref, policy_type, threshold=0, action="delay"):
action=action,
)

def _get_lock_uid(self, target):
values = {"policy_type": self._policy_type, "action": target.action}
return self._get_lock_name(values=values)

def _apply_before(self, target):
# Get the count of scheduled instances of the action.
scheduled = action_access.LiveAction.count(
Expand Down
10 changes: 0 additions & 10 deletions st2actions/st2actions/policies/concurrency_by_attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from __future__ import absolute_import

import json
import six

from st2common.constants import action as action_constants
Expand All @@ -42,15 +41,6 @@ def __init__(
)
self.attributes = attributes or []

def _get_lock_uid(self, target):
meta = {
"policy_type": self._policy_type,
"action": target.action,
"attributes": self.attributes,
}

return json.dumps(meta)

def _get_filters(self, target):
filters = {
("parameters__%s" % k): v
Expand Down
18 changes: 1 addition & 17 deletions st2common/st2common/policies/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.

from __future__ import absolute_import

import abc
import importlib
import inspect
Expand Down Expand Up @@ -57,23 +58,6 @@ def apply_after(self, target):
"""
return target

def _get_lock_name(self, values):
"""
Return a safe string which can be used as a lock name.

:param values: Dictionary with values to use in the lock name.
:type values: ``dict``

:rtype: ``st``
"""
lock_uid = []

for key, value in six.iteritems(values):
lock_uid.append("%s=%s" % (key, value))

lock_uid = ",".join(lock_uid)
return lock_uid


def get_driver(policy_ref, policy_type, **parameters):
policy_type_db = policy_access.PolicyType.get_by_ref(policy_type)
Expand Down