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

fix: runtime requirements #628

Merged
merged 1 commit into from
Dec 9, 2024
Merged
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
12 changes: 8 additions & 4 deletions ovos_core/skill_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ def load_plugin_skills(self, network=None, internet=None):
LOG.info(f"Consider uninstalling {skill_id} instead of blacklisting it")
continue
if skill_id not in self.plugin_skills and skill_id not in loaded_skill_ids:
skill_loader = self._get_plugin_skill_loader(skill_id, init_bus=False)
skill_loader = self._get_plugin_skill_loader(skill_id, init_bus=False,
skill_class=plug)
requirements = skill_loader.runtime_requirements
if not network and requirements.network_before_load:
continue
Expand All @@ -327,7 +328,7 @@ def _get_internal_skill_bus(self):
bus = self.bus
return bus

def _get_plugin_skill_loader(self, skill_id, init_bus=True):
def _get_plugin_skill_loader(self, skill_id, init_bus=True, skill_class=None):
"""Get a plugin skill loader.

Args:
Expand All @@ -340,7 +341,10 @@ def _get_plugin_skill_loader(self, skill_id, init_bus=True):
bus = None
if init_bus:
bus = self._get_internal_skill_bus()
return PluginSkillLoader(bus, skill_id)
loader = PluginSkillLoader(bus, skill_id)
if skill_class:
loader.skill_class = skill_class
return loader

def _load_plugin_skill(self, skill_id, skill_plugin):
"""Load a plugin skill.
Expand All @@ -352,7 +356,7 @@ def _load_plugin_skill(self, skill_id, skill_plugin):
Returns:
PluginSkillLoader: Loaded plugin skill loader instance if successful, None otherwise.
"""
skill_loader = self._get_plugin_skill_loader(skill_id)
skill_loader = self._get_plugin_skill_loader(skill_id, skill_class=skill_plugin)
try:
load_status = skill_loader.load(skill_plugin)
except Exception:
Expand Down
Loading