Open yarikoptic opened 3 weeks ago
Option 1: add --python-unbuffered
-u
, when passed it will set PYTHONUNBUFFERED
Modifying env vars has a smell to it. And this option is only for python programs.
Option 2: Documentation
Todo(asmacdo) see how 'watch' deals with captured outputs for when comparing differences
'watch -d'
It does help
```shell ❯ duct ./test_script.py --duration 1 --memory-size=1000 2>&1 | ts Jun 09 11:18:48 this is of test of STDERR Jun 09 11:18:50 this is of test of STDOUT Jun 09 11:18:50 Test completed. Consumed 1000 MB for 1 seconds with CPU load factor 10000. Jun 09 11:18:50 duct is executing ./test_script.py --duration 1 --memory-size=1000... Jun 09 11:18:50 Log files will be written to .duct/logs/2024.06.09T11.18.48-1439380_ Jun 09 11:18:50 Jun 09 11:18:50 Exit Code: 0 Jun 09 11:18:50 Command: ./test_script.py --duration 1 --memory-size=1000 Jun 09 11:18:50 Log files location: .duct/logs/2024.06.09T11.18.48-1439380_ Jun 09 11:18:50 Wall Clock Time: 1.749 sec Jun 09 11:18:50 Memory Peak Usage: 1.5% Jun 09 11:18:50 CPU Peak Usage: 103.0% ❯ PYTHONUNBUFFERED=1 duct ./test_script.py --duration 1 --memory-size=1000 2>&1 | ts Jun 09 11:18:54 duct is executing ./test_script.py --duration 1 --memory-size=1000... Jun 09 11:18:54 Log files will be written to .duct/logs/2024.06.09T11.18.54-1439428_ Jun 09 11:18:54 this is of test of STDOUT Jun 09 11:18:54 this is of test of STDERR Jun 09 11:18:56 Test completed. Consumed 1000 MB for 1 seconds with CPU load factor 10000. Jun 09 11:18:56 Jun 09 11:18:56 Exit Code: 0 Jun 09 11:18:56 Command: ./test_script.py --duration 1 --memory-size=1000 Jun 09 11:18:56 Log files location: .duct/logs/2024.06.09T11.18.54-1439428_ Jun 09 11:18:56 Wall Clock Time: 1.756 sec Jun 09 11:18:56 Memory Peak Usage: 1.5% Jun 09 11:18:56 CPU Peak Usage: 103.0% ```and with this change:
BUT I am not yet sure we should do that (by default at least), since it changes operating conditions for the process and in some cases people would not even care to receive "online" output.