-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New approach to handling plugin configuration.
* You give each plugin an alias. You use a line of code like `config.plugin.my_alias = 'my_package.plugin'`. This assigns the alias "my_alias" to the plugin, and imports the specified python module. The module can be specified as a python module name, as an actual module object, or as the path to a python file. * Setting up the plugin alias as described above will give the plugin a chance to supply any configuration settings it uses. The plugin-specific configuration is stored in config.plugin.my_alias. * You can set up a plugin on the command line (or a config file) using --plugin=alias:module, where alias is the alias that determines where the plugin's configuration is stored, and module is either the module name or the module file path. The plugin may register new command line options, which are made available immediately. Plugins may choose to incorporate the alias into their option names. * You can also set up a plugin using a dictionary. The alias is put into the dictionary with the key "module". Other plugin configuation values can be put in the same dictionary. * Plugins must supply a register_plugins method that registers whatever callbacks it uses. This method called just before the simulation starts. Here are a couple examples of how you might set up a plugin: import my_plugins.pricing config.plugin.pricing = my_plugins.pricing config.plugin.pricing.option1 = 100 config.plugin.pricing.option2 = 'fast' config.plugin.stats_writer = '../plugins/stats.py' config.plugin.stats_writer.write_hourly = True options = {'plugin': {'ruc_monitor': { 'module': 'my_plugins.ruc', 'verbose':True } } } config.set_value(options)
1 parent
e3e546b
commit f3969a7
Showing
8 changed files
with
150 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters