Skip to content

Commit

Permalink
fix: old mycroft skills loading (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl authored Mar 2, 2024
1 parent 5cf829f commit 6e3242c
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions ovos_core/skill_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,6 @@ def handle_initial_training(self, message):

def run(self):
"""Load skills and update periodically from disk and internet."""
self._remove_git_locks()

self.load_priority()

self.status.set_alive()
Expand Down Expand Up @@ -478,14 +476,6 @@ def run(self):
'hit.')
sleep(30)

def _remove_git_locks(self):
"""If git gets killed from an abrupt shutdown it leaves lock files."""
for skills_dir in get_skill_directories():
lock_path = os.path.join(skills_dir, '*/.git/index.lock')
for i in glob(lock_path):
LOG.warning('Found and removed git lock file: ' + i)
os.remove(i)

def _load_on_network(self):
LOG.info('Loading skills that require network...')
self._load_new_skills(network=True, internet=False)
Expand Down Expand Up @@ -611,7 +601,10 @@ def _load_skill(self, skill_directory):
load_status = False
finally:
self.skill_loaders[skill_directory] = skill_loader
LOG.info(f"Loaded old style skill: {skill_directory}")
if load_status:
LOG.info(f"Loaded old style skill: {skill_directory}")
else:
LOG.error(f"Failed to load old style skill: {skill_directory}")
return skill_loader if load_status else None

def _unload_skill(self, skill_dir):
Expand All @@ -628,7 +621,8 @@ def _get_skill_directories(self):
# let's scan all valid directories, if a skill folder name exists in
# more than one of these then it should override the previous
skillmap = {}
for skills_dir in get_skill_directories():
valid_skill_roots = ["/opt/mycroft/skills"] + get_skill_directories()
for skills_dir in valid_skill_roots:
if not os.path.isdir(skills_dir):
continue
for skill_id in os.listdir(skills_dir):
Expand Down

0 comments on commit 6e3242c

Please sign in to comment.