Skip to content

Commit

Permalink
revivied Craig s code to resolved the issue that uuid has extra chars…
Browse files Browse the repository at this point in the history
… when using vctl status
  • Loading branch information
kefeimo committed Oct 20, 2023
1 parent bc46890 commit de5cf74
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions volttron/platform/control/control_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,25 @@
# 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
for agent1 in agents:
for agent2 in agents:
if agent1 is agent2:
continue
common_len = len(os.path.commonprefix([agent1.uuid, agent2.uuid]))
if common_len > n:
n = common_len
return n + 1


Expand Down

0 comments on commit de5cf74

Please sign in to comment.