Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revivied Craig s code to resolved the issue that uuid has extra char when using vctl status #3129

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

kefeimo
Copy link
Contributor

@kefeimo kefeimo commented Oct 20, 2023

Description

Hot fix: uuid has extra char when using vctl status

Before

kefei@ubuntu-22:~/project/volttron$ vctl install examples/ListenerAgent --tag listener
Agent 6e4546f6-2c28-4830-9fab-973097f12ebc installed
kefei@ubuntu-22:~/project/volttron$ vctl status
UUID AGENT             IDENTITY            TAG      STATUS          HEALTH
6 listeneragent-3.3 listeneragent-3.3_1 listener                 
kefei@ubuntu-22:~/project/volttron$ vctl install examples/ListenerAgent --tag listener2
Agent 85c28535-46a1-49e2-8abd-c89c1450e11e installed
kefei@ubuntu-22:~/project/volttron$ vctl status
UUID AGENT             IDENTITY            TAG       STATUS          HEALTH
6e4546 listeneragent-3.3 listeneragent-3.3_1 listener                  
85c285 listeneragent-3.3 listeneragent-3.3_2 listener2   

After (fixed and verified as shown below)

kefei@ubuntu-22:~/project/volttron$ vctl install examples/ListenerAgent --tag listener
Agent c283e2d4-2ec9-4dde-bffa-db3e7b2f5d7c installed
kefei@ubuntu-22:~/project/volttron$ vctl status
UUID AGENT             IDENTITY            TAG      STATUS          HEALTH
c listeneragent-3.3 listeneragent-3.3_1 listener                 
kefei@ubuntu-22:~/project/volttron$ vctl install examples/ListenerAgent --tag listener2
Agent 8453f0f8-f4c8-463f-b756-28d184709a7e installed
kefei@ubuntu-22:~/project/volttron$ vctl status
UUID AGENT             IDENTITY            TAG       STATUS          HEALTH
8 listeneragent-3.3 listeneragent-3.3_2 listener2                 
c listeneragent-3.3 listeneragent-3.3_1 listener        

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Yes, see the description

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@kefeimo kefeimo requested a review from craig8 October 20, 2023 17:45
@craig8 craig8 merged commit 5d96abe into VOLTTRON:develop Oct 23, 2023
13 of 15 checks passed
@craig8
Copy link
Contributor

craig8 commented Nov 3, 2023

This produced bad results
Agent = namedtuple('Agent', ('uuid'))
my_agents = [Agent(x) for x in ['9b171ba5-f69f-4895-a69e-b51cf4d78150',
'2c7c8405-49c8-48eb-86ff-236ebe39da6e',
'd73a71c8-000f-46aa-8e5f-c4436cf847c3',
'da2c1f0d-6ce5-4095-843c-3abc861d5199',
'f5de325c-e723-41e5-9ceb-fae722a40eb6'
]]

def _calc_min_uuid_length(agents):
agent_ids = [agent.uuid for agent in agents]
common_len = len(os.path.commonprefix(agent_ids))
return common_len + 1

_calc_min_uuid_length(my_agents)

Should be 2 characters but returns 1 but should be 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants