-
Notifications
You must be signed in to change notification settings - Fork 62
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
Tracker entity fails padatious compilation #104
Comments
Hello, when I did this method, one of proposed tracker.entity storage was directly in folder with skill. It was rejected as not a good solution. If the skill work with padatious not single_threated=false, I would raise issue in Padatious. When I come back home, I will try this. |
The issue is not really within padatious. It may do some cleanup of names to prevent saving issues, but the core problem remains this skill as it uses an unexpected behavior of mycroft-core: the filename is looked up within the
Due to However, I do agree on the fact temporary files are a better design. It would be interesting for mycroft-core to provide a way to dynamically create entities or intents. I may create a PR going this way on mycroft-core |
Yes, that's something I like what I did mean with Padatious (not in skill, but in Mycroft - wrote on phone in hurry, sry). I can imagine something like this: or When Or both. |
A cleaner way to do, even if mycroft-core do not have a dedicated method would be to do what name = '{}:tracker'.format(self.skill_id)
self.intent_service.register_padatious_entity(name, self.tracker_file) instead of self.register_entity_file(self.tracker_file) def _register_tracker_entities(self) -> None:
"""List tracker entities.
Add them to entity file and registry it so
Padatious react only to known entities.
Should fix conflict with Where is skill.
"""
types = ['device_tracker']
entities = self.ha_client.list_entities(types)
if entities:
cache_dir = get_cache_directory(type(self).__name__)
self.tracker_file = pth_join(cache_dir, "tracker.entity")
with open(self.tracker_file, 'w', encoding='utf8') as voc_file:
voc_file.write('\n'.join(entities))
name = '{}:tracker'.format(self.skill_id)
self.intent_service.register_padatious_entity(name, self.tracker_file) |
Do you want me to do a PR, or do you prefer to do it directly as part of another commit because it is only a 2-lines change? |
Please, prepare a separate PR, I am quite out of time now and It's always better to create separate PR's. I had to cut one big PR into slices myself in order to get it merged. 🙂 |
Describe the bug
Since PR #89 the list of trackers is saved within a temporary
tracker.entity
files and loaded within padatious. Padatious cannot save the generated network and fails with an exception.When padatious is configured to be
single_thread
, it cause the whole skills process to fails and exit.To Reproduce
Steps to reproduce the behavior:
single_thread
mycroft.skills
Expected behavior
Padatious should not fails to compile and save the generated neural network.
Log files
Environment (please complete the following information):
Additional context
The issue comes from method
_register_tracker_entities
:skill-homeassistant/__init__.py
Lines 91 to 107 in cb27f22
This methods create a temporary file (
/tmp/mycroft/cache/HomeAssistantSkill/tracker.entity
) and write trackers to it. It is provided to the core methodregister_entity_file
which is intented to managed files within thevocab
orlocale
directories only.When Mycroft core generate the name for padatious, it uses both the skill ID and the filename https://github.com/MycroftAI/mycroft-core/blob/dev/mycroft/skills/mycroft_skill/mycroft_skill.py#L1049
In this case, the entity name contains multiples slashes
/
which are not valid within filenames.One solution to prevent this issue would be to directly write list of trackers within
vocab/<lang>/tracker.entity
and to load it withself.register_entity_file("tracker.entity")
The text was updated successfully, but these errors were encountered: