diff --git a/volttron/platform/control/control_utils.py b/volttron/platform/control/control_utils.py index a4300e6603..8aad804fd7 100644 --- a/volttron/platform/control/control_utils.py +++ b/volttron/platform/control/control_utils.py @@ -36,23 +36,20 @@ # under Contract DE-AC05-76RL01830 # }}} import collections -import itertools import sys import re from volttron.platform import jsonapi from volttron.platform.agent.utils import is_secure_mode +import os _stdout = sys.stdout _stderr = sys.stderr def _calc_min_uuid_length(agents): - n = 0 - for agent1, agent2 in itertools.combinations(agents, 2): - common_len = sum(1 for a, b in zip(agent1.uuid, agent2.uuid) if a == b) - if common_len > n: - n = common_len - return n + 1 + agent_ids = [agent.uuid for agent in agents] + common_len = len(os.path.commonprefix(agent_ids)) + return common_len + 1 def _list_agents(aip):