-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: add simulation config #8
feat: add simulation config #8
Conversation
- loads config options from a file and overwrites with CLI args - adds configurable log interval -change configuration file type by doing the ffg: replacing conf.json with conf.ini, updating SimulationConfig::load(...) to read the new .ini file, implementing cli_overwrite!(...) macro to reduce LOC when overwriting config values with CLI arguments
- Implements a Cli::from_config_file(...) method to load configuration options from either a default or user-provided (via command line argument) config file - Merges the Cli-s generated from the config file and the parsed command line arguments taking into account the following precedence (command line args > configuration options > default value) - deletes config.rs and the former implementation that loads configuration options into a Simulation- Config struct
- The latter allows dynamic, programmatic updates to the log level at runtime. - The replace was necessary to capture and log command line arguments and configuration options which may or may not contain specification of the log levels after parsing
- additionally reduces the LOC by implementing the overwrite_field!(...) macro and from_config_field(...) generic function. - makes the requirement of a configuration file optional, defaulting to default Cli values if no config file is provided
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.
An author commented here with:
- comment link
https://github.com/bitcoin-dev-project/sim-ln/pull/166#pullrequestreview-1859661063
at 2024/02/02, 16:56:25 UTC.
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.
An author commented here with:
- comment link
https://github.com/bitcoin-dev-project/sim-ln/pull/166#pullrequestreview-1871594510
at 2024/02/09, 03:08:36 UTC.
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.
An author commented here with:
- comment link
https://github.com/bitcoin-dev-project/sim-ln/pull/166#pullrequestreview-1871594868
at 2024/02/09, 03:09:17 UTC.
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.
An author commented here with:
- comment link
https://github.com/bitcoin-dev-project/sim-ln/pull/166#pullrequestreview-1871595720
at 2024/02/09, 03:10:54 UTC.
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.
An author commented here with:
- comment link
https://github.com/bitcoin-dev-project/sim-ln/pull/166#pullrequestreview-1871596380
at 2024/02/09, 03:11:51 UTC.
An author commented here with:
|
An author commented here with:
|
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.
An author commented here with:
- comment link
https://github.com/bitcoin-dev-project/sim-ln/pull/166#pullrequestreview-1875364393
at 2024/02/12, 14:26:40 UTC.
@@ -0,0 +1,10 @@ | |||
[simln.conf] | |||
data_dir = "." |
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.
An author commented here with:
- comment link
https://github.com/bitcoin-dev-project/sim-ln/pull/166#discussion_r1486404657
at 2024/02/12, 16:08:13 UTC.
pub const ACTIVITY_MULTIPLIER: f64 = 2.0; | ||
|
||
/// Default batch size to flush result data to disk | ||
const DEFAULT_PRINT_BATCH_SIZE: u32 = 500; |
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.
2 authors commented here with:
- comment link
https://github.com/bitcoin-dev-project/sim-ln/pull/166#discussion_r1486738554
at 2024/02/12, 20:30:47 UTC - comment link
https://github.com/bitcoin-dev-project/sim-ln/pull/166#discussion_r1519710853
at 2024/03/11, 13:23:17 UTC.
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.
An author commented here with:
- comment link
https://github.com/bitcoin-dev-project/sim-ln/pull/166#pullrequestreview-1875600542
at 2024/02/12, 20:31:07 UTC.
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.
An author commented here with:
- comment link
https://github.com/bitcoin-dev-project/sim-ln/pull/166#pullrequestreview-1927808422
at 2024/03/11, 13:20:36 UTC.
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.
An author commented here with:
- comment link
https://github.com/bitcoin-dev-project/sim-ln/pull/166#pullrequestreview-1927810637
at 2024/03/11, 13:21:33 UTC.
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.
An author commented here with:
- comment link
https://github.com/bitcoin-dev-project/sim-ln/pull/166#pullrequestreview-1927811675
at 2024/03/11, 13:21:57 UTC.
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.
An author commented here with:
- comment link
https://github.com/bitcoin-dev-project/sim-ln/pull/166#pullrequestreview-1927815371
at 2024/03/11, 13:23:17 UTC.
What this PR does
Adds aLoads config values from an optionalSimulationConfig
struct thatINI
file and overwrites these values if corresponding command line arguments are passedlog_interval
after which results are loggedRelated Issue(s)
#157
Update
This PR has changed to consider a standard way of handling configuration files as well as command line arguments. It currently introduces functionality to create and parse the
Cli
from an optionally-provided config file, to merge thisCli
with that parsed from command line arguments, and to grant precedence to the options/values in the latter.Secondly, this PR also replaces the logging crate from
simple_logger
toflexi_logger
.INI
0 allows dynamic update of log levels after initialization and was required to deal with the issue described here.Finally, documentation was updated to reflect the introduction and use of a config file.
Note: There are some changes to unrelated files because of the requirement to wrap maximum width of code and comments at 120 column spaces. Thought to include them regardless following conversation from
#164
on maintaining width.