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:log_spam #566

Merged
merged 5 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
104 changes: 53 additions & 51 deletions ovos_core/intent_services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
#
from typing import Tuple, Callable

from ocp_pipeline.opm import OCPPipelineMatcher
from ovos_adapt.opm import AdaptPipeline as AdaptService
from ovos_bus_client.message import Message
from ovos_bus_client.session import SessionManager
from ovos_bus_client.util import get_message_lang
from ovos_workshop.intents import open_intent_envelope

from ocp_pipeline.opm import OCPPipelineMatcher
from ovos_adapt.opm import AdaptPipeline as AdaptService
from ovos_commonqa.opm import CommonQAService
from ovos_config.config import Configuration
from ovos_config.locale import setup_locale, get_valid_languages, get_full_lang_code
Expand All @@ -29,7 +31,6 @@
from ovos_plugin_manager.templates.pipeline import IntentMatch
from ovos_utils.log import LOG, deprecated, log_deprecation
from ovos_utils.metrics import Stopwatch
from ovos_workshop.intents import open_intent_envelope
from padacioso.opm import PadaciosoPipeline as PadaciosoService


Expand Down Expand Up @@ -89,99 +90,100 @@ def __init__(self, bus, config=None):
self.bus.on('intent.service.padatious.entities.manifest.get', self.handle_entity_manifest)

@property
@deprecated("direct access to self.adapt_service is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def adapt_service(self):
log_deprecation("direct access to self.adapt_service is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
return self._adapt_service

@property
@deprecated("direct access to self.padatious_service is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def padatious_service(self):
log_deprecation("direct access to self.padatious_service is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
return self._padatious_service

@property
@deprecated("direct access to self.padacioso_service is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def padacioso_service(self):
log_deprecation("direct access to self.padacioso_service is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
return self._padacioso_service

@property
@deprecated("direct access to self.fallback is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def fallback(self):

log_deprecation("direct access to self.fallback is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
return self._fallback

@property
@deprecated("direct access to self.converse is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def converse(self):
log_deprecation("direct access to self.converse is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
return self._converse

@property
@deprecated("direct access to self.common_qa is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def common_qa(self):
log_deprecation("direct access to self.common_qa is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
return self._common_qa

@property
@deprecated("direct access to self.stop is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def stop(self):
log_deprecation("direct access to self.stop is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
return self._stop

@property
@deprecated("direct access to self.ocp is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def ocp(self):
log_deprecation("direct access to self.ocp is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
return self._ocp

@adapt_service.setter
@deprecated("direct access to self.adapt_service is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def adapt_service(self, value):
log_deprecation("direct access to self.adapt_service is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
self._adapt_service = value

@padatious_service.setter
@deprecated("direct access to self.padatious_service is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def padatious_service(self, value):
log_deprecation("direct access to self.padatious_service is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
self._padatious_service = value

@padacioso_service.setter
@deprecated("direct access to self.padacioso_service is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def padacioso_service(self, value):
log_deprecation("direct access to self.padacioso_service is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
self._padacioso_service = value

@fallback.setter
@deprecated("direct access to self.fallback is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def fallback(self, value):
log_deprecation("direct access to self.fallback is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
self._fallback = value

@converse.setter
@deprecated("direct access to self.converse is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def converse(self, value):
log_deprecation("direct access to self.converse is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
self._converse = value

@common_qa.setter
@deprecated("direct access to self.common_qa is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def common_qa(self, value):
log_deprecation("direct access to self.common_qa is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
self._common_qa = value

@stop.setter
@deprecated("direct access to self.stop is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def stop(self, value):
log_deprecation("direct access to self.stop is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
self._stop = value

@ocp.setter
@deprecated("direct access to self.ocp is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
def ocp(self, value):
log_deprecation("direct access to self.ocp is deprecated, "
"pipelines are in the progress of being replaced with plugins", "1.0.0")
self._ocp = value

def _load_pipeline_plugins(self):
Expand Down Expand Up @@ -209,7 +211,7 @@ def _load_pipeline_plugins(self):
def registered_intents(self):
lang = get_message_lang()
return [parser.__dict__
for parser in self.adapt_service.engines[lang].intent_parsers]
for parser in self._adapt_service.engines[lang].intent_parsers]

def update_skill_name_dict(self, message):
"""Messagebus handler, updates dict of id to skill name conversions."""
Expand Down Expand Up @@ -454,7 +456,7 @@ def handle_utterance(self, message: Message):
# tag language of this utterance
lang = self.disambiguate_lang(message)

try:
try: # TODO - uncouple lingua franca from core, up to skills to ensure locale is loaded if needed
setup_locale(lang)
except Exception as e:
LOG.exception(f"Failed to set lingua_franca default lang to {lang}")
Expand Down Expand Up @@ -524,7 +526,7 @@ def handle_register_vocab(self, message):
regex_str = message.data.get('regex')
alias_of = message.data.get('alias_of')
lang = get_message_lang(message)
self.adapt_service.register_vocabulary(entity_value, entity_type,
self._adapt_service.register_vocabulary(entity_value, entity_type,
alias_of, regex_str, lang)
self.registered_vocab.append(message.data)

Expand All @@ -535,7 +537,7 @@ def handle_register_intent(self, message):
message (Message): message containing intent info
"""
intent = open_intent_envelope(message)
self.adapt_service.register_intent(intent)
self._adapt_service.register_intent(intent)

def handle_detach_intent(self, message):
"""Remover adapt intent.
Expand All @@ -544,7 +546,7 @@ def handle_detach_intent(self, message):
message (Message): message containing intent info
"""
intent_name = message.data.get('intent_name')
self.adapt_service.detach_intent(intent_name)
self._adapt_service.detach_intent(intent_name)

def handle_detach_skill(self, message):
"""Remove all intents registered for a specific skill.
Expand All @@ -553,7 +555,7 @@ def handle_detach_skill(self, message):
message (Message): message containing intent info
"""
skill_id = message.data.get('skill_id')
self.adapt_service.detach_skill(skill_id)
self._adapt_service.detach_skill(skill_id)

def handle_add_context(self, message):
"""Add context
Expand Down Expand Up @@ -652,7 +654,7 @@ def handle_get_adapt(self, message: Message):
"""
utterance = message.data["utterance"]
lang = get_message_lang(message)
intent = self.adapt_service.match_intent((utterance,), lang, message.serialize())
intent = self._adapt_service.match_intent((utterance,), lang, message.serialize())
intent_data = intent.intent_data if intent else None
self.bus.emit(message.reply("intent.service.adapt.reply",
{"intent": intent_data}))
Expand Down Expand Up @@ -714,15 +716,15 @@ def handle_entity_manifest(self, message):
def shutdown(self):
self.utterance_plugins.shutdown()
self.metadata_plugins.shutdown()
self.adapt_service.shutdown()
self.padacioso_service.shutdown()
if self.padatious_service:
self.padatious_service.shutdown()
self.common_qa.shutdown()
self.converse.shutdown()
self.fallback.shutdown()
if self.ocp:
self.ocp.shutdown()
self._adapt_service.shutdown()
self._padacioso_service.shutdown()
if self._padatious_service:
self._padatious_service.shutdown()
self._common_qa.shutdown()
self._converse.shutdown()
self._fallback.shutdown()
if self._ocp:
self._ocp.shutdown()

self.bus.remove('register_vocab', self.handle_register_vocab)
self.bus.remove('register_intent', self.handle_register_intent)
Expand Down
4 changes: 2 additions & 2 deletions ovos_core/skill_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from ovos_utils.file_utils import FileWatcher
from ovos_utils.gui import is_gui_connected
from ovos_utils.log import LOG, deprecated
from ovos_utils.network_utils import is_connected
from ovos_utils.network_utils import is_connected_http
from ovos_utils.process_utils import ProcessStatus, StatusCallbackMap, ProcessState
from ovos_workshop.skill_launcher import SKILL_MAIN_MODULE
from ovos_workshop.skill_launcher import SkillLoader, PluginSkillLoader
Expand Down Expand Up @@ -181,7 +181,7 @@ def _sync_skill_loading_state(self):
network = True
else:
LOG.debug("ovos-phal-plugin-connectivity-events not detected, performing direct network checks")
network = internet = is_connected()
network = internet = is_connected_http()

if internet and not self._connected_event.is_set():
LOG.debug("Notify internet connected")
Expand Down
Loading