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

To 9.0.1 #3177

Merged
merged 3 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all 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: 4 additions & 0 deletions volttron/platform/aip.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def __init__(self, env, **kwargs):
if self.message_bus == 'rmq':
self.rmq_mgmt = RabbitMQMgmt()
self.instance_name = get_platform_instance_name()
self.agent_uuid_name_map = {}

def add_agent_user_group(self):
user = pwd.getpwuid(os.getuid())
Expand Down Expand Up @@ -682,11 +683,14 @@ def remove_agent(self, agent_uuid, remove_auth=True):
self.remove_agent_user(volttron_agent_user)

def agent_name(self, agent_uuid):
if cached_name := self.agent_uuid_name_map.get(agent_uuid):
return cached_name
agent_path = os.path.join(self.install_dir, agent_uuid)
for agent_name in os.listdir(agent_path):
dist_info = os.path.join(
agent_path, agent_name, agent_name + '.dist-info')
if os.path.exists(dist_info):
self.agent_uuid_name_map[agent_uuid] = agent_name
return agent_name
raise KeyError(agent_uuid)

Expand Down
4 changes: 2 additions & 2 deletions volttron/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def __init__(self, filetowatch, callback):
_log.debug("patterns is {}".format([get_home() + '/' + filetowatch]))
self._callback = callback

def on_any_event(self, event):
def on_closed(self, event):
_log.debug("Calling callback on event {}. Calling {}".format(event, self._callback))
try:
self._callback()
Expand All @@ -133,7 +133,7 @@ def __init__(self, filetowatch, callback):
def watchfile(self):
return self._filetowatch

def on_any_event(self, event):
def on_closed(self, event):
_log.debug("Calling callback on event {}. Calling {}".format(event, self._callback))
try:
self._callback(self._filetowatch)
Expand Down
Loading