-
Notifications
You must be signed in to change notification settings - Fork 18
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
158 add ability for plugin pipeline external persistent processes #167
base: main
Are you sure you want to change the base?
158 add ability for plugin pipeline external persistent processes #167
Conversation
instance2 = Singleton() | ||
|
||
# Assert | ||
assert instance1 is instance2 |
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 that this test perfectly describes "singleton" functionally.
Confirmed that tests pass and coverage is 100% on my setup. Code looks good to me (but I wasn't checking for docstrings...). I created #176 to capture that we still need an example and docs for how to create and use a service. Great work! |
@asgibson and I were discussing how plugins access services and want to avoid the user having to explicitly "instantiate" the services singleton. |
Large update... ServiceManager is now instantiated in the AIPlugin superclass, meaning Plugins can access it by This change necessitated a bunch of fixes in the CSV Output example plugin's unit tests since the way those are written is out of date. Preliminary changes to that set of tests were made so it would pass, but they will need a full overhaul eventually - I'll make a new issue. Merged commits to take advantage of more recent updates to the Pylint pipeline. We should be good to go! |
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.
Needs a clean rebase with main.
426d8ba
to
67dea87
Compare
- Add new initialized object in ExecutionEngine, the ServiceManager, which behaves as a singleton - When specified in the config (example & tutorial to come in a later commit), a Service is made an attribute of the ServiceManager - The ServiceManager can be imported in any plugin. As a singleton, when called to initialize, the original ServiceManager instance (along with instantiated Services) will be returned - Services are defined in the config and imported automatically when ServiceManager is first generated
…_services_dict FileNotFoundError message to align with parse_plugins_dict.
…the beginning of the __init__
- ServiceManager is instantiated in the AIPlugin and set to the attr Plugin.service_manager - Plugins no longer need to import it individually and can access by attr instead - Add corresponding unit test to AI plugin abstract class
80891f2
to
6a3ff91
Compare
Old tests are functional and are being saved to be added as functional tests Updated tests are true unit testing Singleton tests import Singleton always to ensure new import (isolation) ServiceManager tests mock the Singleton for ServiceManager this necessitated the importing of Singleton always for Singleton tests otherwise, randomized failures when Singleton tested after ServiceManager
Black fixes Random failure fixes MagicMock() as string randomizer does not work 100% Changed to random strings instead, fixes rare random failures
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.
Everything I did not do is approved.
Someone will need to review my updates.
Services framework has been implemented and unit tests have been updated to cover modifications. Currently, no example services are provided. Deferring to reviewers on whether we ought to wait for an example to be implemented (and tested) before adding to the main branch. This Services implementation is expected to be fully backwards compatible with previous OnAIR implementations.