Commit Graph

57 Commits (mark-ii/log-rotation)

Author SHA1 Message Date
Michael Hansen 9e67748bea Use configuration for dbus address 2021-12-08 11:08:35 -05:00
Chris Veilleux 712110e17f Removed DevicePrimer class. All functionality moved to enclosure 2021-12-02 16:04:37 -06:00
Chris Veilleux 982b79482c move enclosure logic from skill service to enclosure service 2021-11-30 15:44:09 -06:00
Chris Veilleux 53ffd737a0 move some steps in the startup sequence so that the message bus connection is established as early as possible. this will facilitate status updates occurring as soon as possible as well. 2021-11-30 15:40:40 -06:00
Chris Veilleux 3d26fa9ada Add service ready event and improve logic to determine if device is ready. 2021-11-30 15:40:27 -06:00
Kris Gesling 2c598fd96b Merge branch 'dev' into feature/mark-2 2021-06-15 12:01:18 +09:30
Kris Gesling e75a05557b docstring cleanup 2021-05-11 15:10:32 +09:30
Kris Gesling 27cf725411 Merge branch 'dev' into feature/mark-2 2021-05-10 07:22:45 +09:30
Kris Gesling 6327ac5dbb
Upgrade Lingua Franca to v0.4.1 (#2890)
**Update Lingua Franca to v0.4.1**

The update from Lingua Franca v0.2.x to v0.4.x includes few
breaking changes.
- Some API methods have been updated.
- Mycroft-core tests have been updated to reflect improvements in
  Lingua Franca's formatting and parsing.
- add LF default lang setting method to config.locale 
  including warning that this method will change in the future
- Add TODO's for 21.08 - moving more methods to LF
- simplify loading and setting default of languages in Skills service
- Remove unneeded wrappers for Lingua Franca functions
- Fix documentation of format and parse utils
- Fix test warnings
2021-05-08 08:34:02 +09:30
Chris Veilleux 8453e79900 Merge remote-tracking branch 'origin/dev' into feature/mark-2
# Conflicts:
#	mycroft/tts/tts.py
2021-03-15 18:47:32 -05:00
Åke Forslund 203e1fc740 Remove intent-service backwards compatibility
- Remove unused ContextManager import from mycroft.skills.intent_service
- Remove Old 'intent_failure' -> fallback handler
- Remove handling of fallback messages without the fallback_range
parameter
2021-03-07 12:59:59 +01:00
Chris Veilleux d4d7340f3a changed the list of Raspberry Pi platforms to replace "mycroft_mark_2pi" with "mycroft_mark_2" 2021-03-01 18:20:19 -06:00
Chris Veilleux 6ed674bd3e Merge remote-tracking branch 'origin/dev' into feature/mark-2
# Conflicts:
#	mycroft/audio/__main__.py
#	mycroft/client/speech/__main__.py
#	mycroft/skills/__main__.py
#	mycroft/util/process_utils.py
2021-02-26 11:49:30 -06:00
Åke Forslund df02bf22b4 Add skill api.
The skill api allows skills to define a public api which can easily be
accessed by other skills over the message bus just as easy as working
with a normal object.

The skill api object is generated from the skill's public_api property. It's a dict where each key is turned into a method on the api object. The method is defined as
  "api_method": {
    "type": message type string
    "func": handler method
    "help": help string for cli
  }

Example skill:

class Test2(MycroftSkill):
    def __init__(self):
        MycroftSkill.__init__(self)
        self.public_api = {
            'speak': {
                'type': 't2.speak',
                'func': self.handle_speak,
                'help': 'speak the test sentence\nand another line\n\nlast'
            },
            'speak2': {
                'type': 't2.speak2',
                'func': self.handle_speak2,
                'help': 'speak the other sentence'
            }
        }

    def handle_speak(self, message):
        self.speak('This is a test')
        self.bus.emit(message.response(data=None))

    def handle_speak2(self, message):
        self.speak('This is another test')
        self.bus.emit(message.response(data=None))
2021-02-06 17:55:34 +01:00
Åke Forslund b595f6cdad Always use the plural "Skills" for the service
Change all strings referring to the service to use "Skills service"
2021-01-28 17:24:21 +01:00
Åke Forslund 94d5e34fd0 Add started and alive hooks to skills process 2021-01-28 17:24:21 +01:00
Kris Gesling 1273425799 add ProcessStatus to key services 2021-01-28 17:24:21 +01:00
Kris Gesling cc3bf5b45a Change names for consistency 2021-01-28 17:21:33 +01:00
Åke Forslund bea1f008c6 Add ProcessStatus class
ProcessStatus tracks the process status and allows callbacks on changes
and status queries over the messagebus.

StatusCallbackMap is used to setup the callbacks

ProcessState is an enum tracking the different states.
2021-01-28 17:21:33 +01:00
Kris Gesling ad32a7a873 move bus connect method to process_utils 2021-01-11 16:57:25 +09:30
Kris Gesling 960f650c88 Skills service to use common bus client method 2021-01-11 16:57:25 +09:30
Åke Forslund 6eeeefb0ac Always use the plural "Skills" for the service
Change all strings referring to the service to use "Skills service"
2020-09-27 09:58:08 +02:00
Åke Forslund 225ece7737 Add started and alive hooks to skills process 2020-09-27 09:58:08 +02:00
Kris Gesling e9add604fd add ProcessStatus to key services 2020-09-25 06:52:27 +02:00
Kris Gesling fa0b0dbd41 Change names for consistency 2020-09-25 06:52:25 +02:00
Åke Forslund 633dea1ac5 Add ProcessStatus class
ProcessStatus tracks the process status and allows callbacks on changes
and status queries over the messagebus.

StatusCallbackMap is used to setup the callbacks

ProcessState is an enum tracking the different states.
2020-09-25 06:51:20 +02:00
Kris Gesling ae72ebd247
Merge pull request #2599 from forslund/refactor/intent-service
Refactor intent service
2020-09-23 10:24:16 +09:30
Åke Forslund 988b99b7fe Add missing watchdog argument
Fix retry call to _initialize_skill_manager() when Msm cache doesn't exist locally.
2020-08-20 21:22:55 +02:00
Åke Forslund bb8d4e3c1f Generalization of intent service Episode IV
Simplify the handle_utterance into a list of intent matching functions
run in order until a match is found.

The resolution order is

- Converse
- Padatious High Confidence
- Adapt
- Fallback High priority
- Padatious Medium Confidence
- Fallback Medium priority
- Padatious Last ditch effore
- Fallback Low priority

This collects the many parts of where intent is handled into a single
location handling the entire flow.

The idea is that, in the end, all the skill calling should be done from
this method. The main intent parsers does this but the converse and
fallback still calls directly.
2020-08-13 08:12:53 +02:00
Åke Forslund 4c87bc23d4 Move padatious service to within the IntentService 2020-08-13 08:12:53 +02:00
Åke Forslund 236a2ed594 Add hook for stopping 2020-07-22 11:06:47 +02:00
Åke Forslund a1fdae3415 Add support for watchdog in skills and speech client
If no watchdog is provided a dummy function will be called
2020-07-22 10:52:32 +02:00
Åke Forslund 09b1deb511 Add possibility for notification hooks for services
- skills
- audio
- speech client
- messagebus service
- enclosure

The main functions now accepts the arguments ready_hook and error_hook
allowing a service or runner script to catch these states and perform
actions accordingly.

This is useful for things like systemd or a desktop launcher.

Fix audio service startup
2020-07-22 10:52:27 +02:00
David Wagner 7cb1ca7282 Remove unused methods 2019-09-25 10:58:51 -05:00
David Wagner 3fc389dbf3 Remove ntp sync reboot 2019-09-24 20:35:11 +00:00
Åke Forslund e9922c0fff Catch all exceptions from upload device info 2019-09-17 08:13:58 +02:00
Åke Forslund 5457c265f3 Handle errors when updating device attributes
Capture the correct exceptions when updating device version and
enclosure type. Switches from BackendDown to ConnectionError and
HTTPError.
2019-09-16 10:41:34 +02:00
Chris Veilleux 3bd3dd1bed Refactor skill manager (#2237)
Split skill_manager into three separate classes, SkillManager, SkillUpdater and SkillLoader splitting the responsibility into logical units

* Split the SkillManager.__init__ code to determine the download times into a new method
* Make docstrings consistent and PEP257 compliant.  Also fixed a couple of spelling errors
* fixed two issues introduced in the previous refactoring
* removed unnecessary assignment of an instance attribute to a local variable
* updated the unit test to mock out code that reaches outside of core, like MSM and the configuration manager.
* add several unittests and refactored load_priority method.
* add a test for the _get_last_modified_date function.
* add "quick" argument to docstring
* removed unused import
* new class containing the logic to periodically update/install skills and send skill manifests to the backend.
* import MsmException from where it is defined, not from the skill manager.
* add some logging to the skill updater
* remove code now in SkillUpdater from SkillManager
* added imports to __init__.py to define the API into the message bus package
* new base class for unit tests and module for reusable mocks
* new skill loader class that will replace the _load_or_reload_skill() method in the SkillManager class.
* moved skill loading logic from core.py into skill_loader.py, resulting in some refactoring of skill loader and skill manager.  change unit tests to match.
* added back some spacing that was inadvertently removed.
* change skill tester to use new SkillLoader class.
* Separate reload required check from performing reload to make logic easier
to follow
* Track skills that failed to load to handle infinite loop at first load
if skill fails to load
* Allow reloading skills that has failed to load
* Simplify first load of skills
- create activate, deactivate and unload methods for skill_loader
objects
- add sanity checks before activating and deactivating skills
- Update activation/deactivation test cases
2019-08-20 12:02:39 +02:00
Åke Forslund e9cc683dbe Allow startup if update attempt occurs
update_attempt will block waiting for the update to complete and the
update will shutdown the running skills process if an update is needed.
2019-07-26 17:40:59 +02:00
Chris Veilleux 0bde1bc9df Refactor skill service (#2220)
Major refactoring of the skills startup sequence
- Restructure to a less nested structure
- Remove usage of globals by wrapping a lot of state variables into a class this allows for things like caching a negative pairing status throughout the startup process
2019-07-26 08:53:27 +02:00
Åke bb779e6136
Merge pull request #2217 from forslund/bugfix/quick-download
Move quick skill update to after internet check
2019-07-19 13:13:03 +02:00
Chris Veilleux d8f3095d40 Rename the message bus client and abstract config loading
Message bus config loading is now shared by service and client.

messagebus.client.ws file is still available in case skills are using it. It is a backport that inherits from the new MessageBusClient class. Adds depreciation warning.
2019-07-19 08:16:54 +02:00
Åke Forslund 8b03a93dc1 Move quick skill update to after internet check 2019-07-18 14:25:31 +02:00
David Wagner 4b480dcf32
Add mycroft_mark_2pi to platforms needing ntp sync 2019-07-12 06:56:35 -05:00
Åke Forslund 94ab53f47e Handle sending skill manifest
Skill manifest is now sent on each startup if paired otherwise after successful pairing.
2019-07-09 16:52:27 +02:00
Åke Forslund cd16404455 Download skills if they're stale or in unknown state
Checks if the skills haven't been updated for more than 2 weeks or if
the last_download is undefined. last_download may be undefined if
the .msm file is missing or if the list of installed requirements is
missing so skill requirements may be missing.

This also makes sure the skills are normally loaded before the an update
attemt is tried.
2019-07-09 16:52:27 +02:00
Åke b1348de6f7 Feature/msm 0.7.6 (#2136)
* Log error when creating Padatious

* Update msm to v0.7.6

This handles connection errors during the startup procedure and improves
the skill_gid when no network is available
2019-05-23 10:16:37 -07:00
Åke Forslund c3f2b73794 set_active_lang on startup of skills 2019-03-14 11:00:51 +01:00
Steve Penrod 286fa6314f Imporove user feedback during startup
Now the eyes go to a khaki color and "< < < LOADING < < <" displays
during the skill startup.  When Padatious finishes the first training
we now emit a "mycroft.ready" on the messagebus.

A change to the skill_mark_1 to look for "mycroft.ready" instead of
"mycroft.skills.initialized" provides a good visual change to show that
it is ready for use.
2019-02-28 14:58:19 -06:00
Åke 8e495870c2 Feature/skill manager error checks (#1981)
* Attempt to create skill directory if not existing

* Handle missing priority skills

* Minor update of comments

* Handle skill load exception

Make sure an exception while trying to load/reload skill doesn't shutdown thread.

* Handle MsmException during SkillManager creation

If SkillManager can't be created due to an MsmException wait for network connection and retry.

* Update immediately if skill install file is missing

Missing skill install file indicates that this is a new venv and the requirements of the skills will need to be reinstalled.

* Add basic test for skill_manager

Basically only creating the skill_manager but it ensures that msm can be used on all supported python versions
2019-02-28 00:18:48 -06:00