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
Refactor skill service #2220
Refactor skill service #2220
Conversation
- added some docstrings - put config retrieval in a function - added log messages
- fixed spelling error - renamed variable that shadowed built-in
- reordered imports - refactored docstrings for consistency - renamed camel case variables to use snake case
- renamed the message bus client - abstracted message bus config loading so service and client can use same code.
… it is a backport that inherits from the new MessageBusClient class. Added a deprecation comment as well.
… may cause breakage. added todo to include in next major release.
- broke big functions up into classes/methods - reworked the multiple calls to is_paired() into a single call to minimize API calls and improve performance a bit - added more documentation - added more logging - other miscellaneous cleaning stuff
…into this class... for now.
…to refactor-skill-service
|
Hello @chrisveilleux! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! Comment last updated at 2019-07-26 06:24:44 UTC |
|
There are some really good things here (and a few things I don't quite agree with). Will you let me take a stab at making an alternative approach during the weekend based on this? |
Have at it. Interested to see the differences between our approaches. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok this is much more to my liking. A couple of minor things (see separate comments).
I wonder if we need to have the _ at the start of functions since this is a __main__.py and it's quite clear it should not be imported?
| @@ -230,15 +230,14 @@ def load_config_stack(configs=None, cache=False): | |||
| return base | |||
|
|
|||
| @staticmethod | |||
| def init(ws): | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the rename but we might want to keep the init method as well for backwards compatibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed all the core uses of this. Are there other repos that could call this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically things like third party enclosures may use it or other things build for working with mycroft-core.
I do think we can have a rather short depreciation period though and remove it outright in 19.08 since it's a rarely touched thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. will add an init method back that calls the new method and add a deprecation warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh! since it is a static method, I had to actually duplicate the method rather than have one call the other. I added a deprecation message. How do we track things like this that will be breaking changes in 19.08? Do we just search the code base for comments that mention 19.08?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's basically it yeah TODO: 19.08 or similar comments
|
Also can you do a rebase against dev? The commit history looks really weird... |
done |
|
I think this looks pretty good, gonna do some final testruns. I want the current release to be out for 24 hours and then I'll merge this on Friday if no hot-fixes are needed. |
Description
Refactor the code that starts the skill service and primes the device when connected to the internet. Mostly just reorganized the code but also made a change to the logic that determines if a device is paired. The change reduces the amount of API calls to one.
How to test
This is a refactor so the unit tests need to pass and the skill service needs to work the same as it has.
Contributor license agreement signed?
CLA [yes]