-
Notifications
You must be signed in to change notification settings - Fork 15
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
24 allow for dynamic plugins #36
Conversation
Codecov Report
@@ Coverage Diff @@
## main #36 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 25 24 -1
Lines 1169 1104 -65
Branches 156 144 -12
=========================================
- Hits 1169 1104 -65
|
e5cfee4
to
f4006d2
Compare
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.
Small tweaks
onair/config/default_config.ini
Outdated
@@ -6,6 +6,7 @@ TelemetryFiles = ['700_crash_to_earth_1.csv'] | |||
ParserFileName = csv_parser | |||
ParserName = CSV | |||
SimName = CSV | |||
PluginList = {'generic_plugin':'plugins/generic/generic_plugin.py'} # format: {plugin_name : plugin_path} |
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.
Do we have an area where we can put an assertion statement?
importlib.import_module('onair.src.data_driven_components.' + plugin_name + '.' + f'{plugin_name}_plugin').Plugin(plugin_name, headers) for plugin_name in _ai_plugins | ||
] | ||
self.ai_constructs = [] | ||
|
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.
assertion here, or earlier. Also, I'd remove this empty space.
onair/src/reasoning/agent.py
Outdated
@@ -15,9 +15,9 @@ | |||
from ..reasoning.diagnosis import Diagnosis | |||
|
|||
class Agent: | |||
def __init__(self, vehicle): | |||
def __init__(self, plugin_list, vehicle): |
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'd swap the order (most significant to least significant)
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.
Also, follows the instantiation order
@@ -94,6 +98,8 @@ def parse_configs(self, config_filepath): | |||
self.benchmarkIndices = config['DEFAULT']['BenchmarkIndices'] | |||
except: | |||
pass | |||
## Sort Data: Plugins |
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.
is sorting happening? I think this function turns a string into list (with extra processing of tokens , beyond pythons built in "list()").
onair/src/run_scripts/sim.py
Outdated
@@ -39,7 +39,7 @@ def __init__(self, simType, parsedData, SBN_Flag): | |||
|
|||
else: | |||
self.simData = DataSource(parsedData.get_sim_data()) | |||
self.agent = Agent(vehicle) | |||
self.agent = Agent(plugin_list,vehicle) |
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.
swap
@cfirth-nasa Nice job :D I ran a pedantic review, happy to discuss if there are questions. I'll merge after these small tweaks. Note, some of the code changes will have ramifications in the test files. Thank youuuu! |
Will have time to work on this tomorrow - functionality is there but unit tests need work. Leaving up in case someone (Alan) can get to it before I can |
DataDrivenLearning is now guaranteed to receive valid paths Parsing Plugins is now with required parsing Using ast to check and ensure integrity of dict from config ValueError when not a dict or empty dict FileNotFoundError when path for Plugin is invalid
24 allow for dynamic plugins
Add support for external plugins to be specified by name and path in config INI's and imported as Plugins in data_driven_learning.py