UCL / neso-calibration

Examples of calibrating Neptune Exploratory Software (NESO) models
MIT License
2 stars 0 forks source link

Add option to display `stdout` and `stderr` streams when simulating #2

Closed matt-graham closed 1 year ago

matt-graham commented 1 year ago

Currently NESO executables are called using subprocess.run with capture_output keyword argument set to True to capture the stdout and stderr output streams, with the captured output available on process completion in the returned CompletedProcess object (which is passed to the extract_outputs function usd to generate the outputs). While this allows inspecting / displaying what was written to the output streams after the simulation has finished running, it would be useful to have the option of displaying the outputs streams as the model is running to check on progress and/or allow easier debugging when errors occur.

One option for doing this would be to instead create the subprocess using asyncio and asynchronously process outputs written to the stdout and stderr streams as suggested in this StackOverflow answer.