From 8245f9e5ec86f38c5ad9211be85a50762530295b Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Wed, 26 Jan 2022 14:17:04 +0100 Subject: [PATCH] Remove unused compatibility code During the development of the any-traits feature the signature of the DB methods are changed and to allow gradual change in the caller sites fallback logic was added to accept the old signature as well. Now that all the call sites uses a new signature such code is removed. Story: 2005345 Story: 2005346 Change-Id: Icdbdbb8e68bba37a2a5c1ffb81df231581c4ae02 --- placement/objects/research_context.py | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/placement/objects/research_context.py b/placement/objects/research_context.py index 64f6ae421..e3e45e58e 100644 --- a/placement/objects/research_context.py +++ b/placement/objects/research_context.py @@ -784,19 +784,6 @@ def _get_trees_with_traits(ctx, rp_ids, required_traits, forbidden_traits): :param forbidden_traits: A list of trait internal IDs that a resource provider tree must not have. """ - # FIXME(gibi): This is a temporary fallback to the old calling convention - # when required_traits was a flat list of trait ids. We translate such - # parameter of the new nested structure with the same meaning. - # This code should be removed once each caller is adapted to call this - # with the new structure - if all(not isinstance(trait, set) for trait in required_traits): - # old value: required_traits = [A, B, C] -> A and B and C - # new value: required_traits = [{A}, {B}, {C}] -> (A) and (B) and (C) - # the () part could be a set of traits with OR relationship but - # the old callers does not support such OR relationship hence the old - # flat structure - required_traits = [{trait} for trait in required_traits] - # TODO(gibi): if somebody can formulate the below three SQL query to a # single one then probably that will improve performance @@ -1074,19 +1061,6 @@ def provider_ids_matching_required_traits( if not required_traits: raise ValueError('required_traits must not be empty') - # FIXME(gibi): This is a temporary fallback to the old calling convention - # when required_traits was a flat list of trait names. We translate such - # parameter of the new nested structure with the same meaning. - # This code should be removed once each caller is adapted to call this - # with the new structure - if all(not isinstance(trait, set) for trait in required_traits): - # old value: required_traits = [A, B, C] -> A and B and C - # new value: required_traits = [{A}, {B}, {C}] -> (A) and (B) and (C) - # the () part could be a set of traits with OR relationship but - # the old callers does not support such OR relationship hence the old - # flat structure - required_traits = [{trait} for trait in required_traits] - # Given a request for the following: # # required = [