Skip to content

Commit

Permalink
feat:delayed_padatious_training
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Dec 9, 2024
1 parent 88b094d commit e6e333f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ovos_core/intent_services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def _load_pipeline_plugins(self):
LOG.info("padatious forcefully disabled in config")
else:
from ovos_padatious.opm import PadatiousPipeline
# TODO - read from config once default value has been added to ovos-config
self.config["padatious"]["instant_train"] = False
self._padatious_service = PadatiousPipeline(self.bus, self.config["padatious"])
except ImportError:
LOG.error(f'Failed to create padatious intent handlers, padatious not installed')
Expand Down
13 changes: 12 additions & 1 deletion ovos_core/skill_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ def load_plugin_skills(self, network=None, internet=None):
network (bool): Network connection status.
internet (bool): Internet connection status.
"""
loaded_new = False
if network is None:
network = self._network_event.is_set()
if internet is None:
Expand All @@ -309,6 +310,8 @@ def load_plugin_skills(self, network=None, internet=None):
if not internet and requirements.internet_before_load:
continue
self._load_plugin_skill(skill_id, plug)
loaded_new = True
return loaded_new

def _get_internal_skill_bus(self):
"""Get a dedicated skill bus connection per skill.
Expand Down Expand Up @@ -473,7 +476,7 @@ def _load_new_skills(self, network=None, internet=None, gui=None):
# There is a possible race condition where this handler would be executing several times otherwise.
with self._lock:

self.load_plugin_skills(network=network, internet=internet)
loaded_new = self.load_plugin_skills(network=network, internet=internet)

for skill_dir in self._get_skill_directories():
replaced_skills = []
Expand Down Expand Up @@ -505,6 +508,14 @@ def _load_new_skills(self, network=None, internet=None, gui=None):

if skill_dir not in self.skill_loaders:
self._load_skill(skill_dir)
loaded_new = True

if loaded_new:
LOG.info("Requesting padatious intent training")
self.bus.wait_for_response(Message("padatious:train"),
"mycroft.skills.trained")
else:
LOG.debug("Nothing new to train")

def _get_skill_loader(self, skill_directory, init_bus=True):
"""Get a skill loader instance.
Expand Down

0 comments on commit e6e333f

Please sign in to comment.