The following function calls have "mandatory" print statements:
- scheduler.sim_process ('Progress: %.2f%%')
The first of these is of particular importance when using mosaik in a Jupyter notebook, since all print statements are saved in the .ipynb file. When running long models or looping over many model runs, the amount of print statements saved can be in excess of 500 000, which causes the notebook to fail due to http transfer limits.
As a workaround, the user can redirect stdout using
sys.stdout = open(os.devnull, 'w')
sys.stdout = sys.__stdout__
but a better solution would be to be able to suppress the output directly in the call to scenario.World.run.
Therefore I propose to add an option to suppress these statements. I see two possible options here:
- Define a 'printing level' through the mosaik configuration
- Add an optional parameter to the scenario.World.run function call which blocks all print statements (e.g. verbose=True)
- Add an optional parameter to the scenario.World.run function call which blocks only the "progress" print statement (e.g. print_progress=True)
I would personally prefer option 3 to make it more apparent to the user that the option exists, while still reporting on scenario setup information.