16
16
import os
17
17
from os .path import basename
18
18
from threading import Thread , Event , Lock
19
-
20
19
from time import monotonic
21
20
22
21
from ovos_bus_client .apis .enclosure import EnclosureAPI
@@ -118,8 +117,9 @@ def __init__(self, bus, watchdog=None, alive_hook=on_alive, started_hook=on_star
118
117
self ._logged_skill_warnings = list ()
119
118
self ._detected_installed_skills = bool (find_skill_plugins ())
120
119
if not self ._detected_installed_skills :
121
- LOG .warning ("No installed skills detected! if you are running skills in standalone mode ignore this warning,"
122
- " otherwise you probably want to install skills first!" )
120
+ LOG .warning (
121
+ "No installed skills detected! if you are running skills in standalone mode ignore this warning,"
122
+ " otherwise you probably want to install skills first!" )
123
123
124
124
self .config = Configuration ()
125
125
@@ -288,6 +288,7 @@ def load_plugin_skills(self, network=None, internet=None):
288
288
network (bool): Network connection status.
289
289
internet (bool): Internet connection status.
290
290
"""
291
+ loaded_new = False
291
292
if network is None :
292
293
network = self ._network_event .is_set ()
293
294
if internet is None :
@@ -310,6 +311,8 @@ def load_plugin_skills(self, network=None, internet=None):
310
311
if not internet and requirements .internet_before_load :
311
312
continue
312
313
self ._load_plugin_skill (skill_id , plug )
314
+ loaded_new = True
315
+ return loaded_new
313
316
314
317
def _get_internal_skill_bus (self ):
315
318
"""Get a dedicated skill bus connection per skill.
@@ -477,7 +480,7 @@ def _load_new_skills(self, network=None, internet=None, gui=None):
477
480
# There is a possible race condition where this handler would be executing several times otherwise.
478
481
with self ._lock :
479
482
480
- self .load_plugin_skills (network = network , internet = internet )
483
+ loaded_new = self .load_plugin_skills (network = network , internet = internet )
481
484
482
485
for skill_dir in self ._get_skill_directories ():
483
486
replaced_skills = []
@@ -509,6 +512,20 @@ def _load_new_skills(self, network=None, internet=None, gui=None):
509
512
510
513
if skill_dir not in self .skill_loaders :
511
514
self ._load_skill (skill_dir )
515
+ loaded_new = True
516
+
517
+ if loaded_new :
518
+ LOG .info ("Requesting padatious intent training" )
519
+ try :
520
+ response = self .bus .wait_for_response (Message ("mycroft.skills.train" ),
521
+ "mycroft.skills.trained" ,
522
+ timeout = 60 ) # 60 second timeout
523
+ if not response :
524
+ LOG .error ("Padatious training timed out" )
525
+ elif response .data .get ('error' ):
526
+ LOG .error (f"Padatious training failed: { response .data ['error' ]} " )
527
+ except Exception as e :
528
+ LOG .exception (f"Error during padatious training: { e } " )
512
529
513
530
def _get_skill_loader (self , skill_directory , init_bus = True ):
514
531
"""Get a skill loader instance.
0 commit comments