Closed falkamelung closed 3 years ago
Absolutely do not add sys.stdout.flush()
to all print statements! This is not only terrible practice, this is also resource intensive and unnecessary.
This is good to know. Thank you! So I will only do where needed, i.e. where bpeek puts the information to the wrong spot.
On Aug 8, 2019, at 1:25 PM, Joshua Zahner notifications@github.com<mailto:notifications@github.com> wrote:
Absolutely do not add sys.stdout.flush() to all print statements! This is not only terrible practice, this is also resource intensive and unnecessary.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgeodesymiami%2Frsmas_insar%2Fissues%2F210%3Femail_source%3Dnotifications%26email_token%3DACVFHXE5ZAYQMH7L7FCQNT3QDOU6LA5CNFSM4IKGONY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD32PF5Q%23issuecomment-519369462&data=02%7C01%7Cfamelung%40rsmas.miami.edu%7Ca150f619c64c4846c28f08d71bc0e4d7%7C2a144b72f23942d48c0e6f0f17c48e33%7C0%7C0%7C637008387616472889&sdata=LWvwpsSHNCfLHngyeNK2WcO9dgHhG%2FMpNE%2FOZj2x%2BdI%3D&reserved=0, or mute the threadhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACVFHXBXP2FFMLBGNAXWSULQDOU6LANCNFSM4IKGONYQ&data=02%7C01%7Cfamelung%40rsmas.miami.edu%7Ca150f619c64c4846c28f08d71bc0e4d7%7C2a144b72f23942d48c0e6f0f17c48e33%7C0%7C0%7C637008387616477880&sdata=EKgEAyEiK9HQgTJE5tG29rIRaiQLaiewJTzzuXx7p58%3D&reserved=0.
There should not be more than a single stdout flush per script. Pick the most important print statement to print and flush only that one. This strategy is a hack at best.
When I do bpeek I just see that jobs had been submitted, but not from which run_file. It would be nice to display whenever it starts working on a new run_file.
If it doesn't not show up at the right place we have to to `print('Executing from ' + run_file); sys.stdout.flush()'. See
https://github.com/insarlab/MintPy/issues/168
Actually, we just should get the habit to add
sys.stdout.flush()
to all print statements.