cli
Utilities for commandline usage of experiments.
This module provides common utilities for commandline usage of experiments. It is intended to be used as a library for writing commandline interfaces for experiments.
DEFAULT_RUNTIME_CONFIGURATION_PATH: Path = Path('runtime.yaml')
module-attribute
The default path to the runtime configuration file.
initialize_logging(log_level=None, runtime_configuration=None, *, parse_arguments=True)
Initialize an experiment for commandline usage.
This function configures commandline arguments and initializes the logging framework. Three sources of configuration are checked in the following priority:
- Commandline arguments
- Runtime configuration file
- Function arguments
That is, commandline arguments take precedence over the configuration file, and the configuration file takes precedence over the function arguments.
Example
>>> import flowcean.cli
>>> flowcean.cli.initialize(log_level="DEBUG")
Example
$ python my_experiment.py --log-level DEBUG
Parameters:
Name | Type | Description | Default |
---|---|---|---|
log_level
|
str | int | None
|
The logging level to use. |
None
|
runtime_configuration
|
Path | None
|
The path to the runtime configuration file. |
None
|
parse_arguments
|
bool
|
Whether to parse commandline arguments. |
True
|
Source code in src/flowcean/cli/logging.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|