This is an automated email from the ASF dual-hosted git repository. tvb pushed a commit to branch tristan/implement-retry-failed in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit b1f9869a19d42d1e3ffdd186fba3702e987d2c6c Author: Tristan van Berkom <[email protected]> AuthorDate: Mon Jul 10 22:25:09 2023 +0900 _messenger.py: Use datestampts instead of PID to differentiate log files Log filenames have traditionally been differentiated by PID in the off chance that the same cache key is built twice, this however is unreliable, as I can see in some tests we consistently get the same PID twice in a row (depending on the system behavior of course). Using a datestamp here is more reliable, not to mention more intuitive and meaningful to a user if browsing the log directory. --- src/buildstream/_messenger.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/buildstream/_messenger.py b/src/buildstream/_messenger.py index ba2556d88..ef87e26f6 100644 --- a/src/buildstream/_messenger.py +++ b/src/buildstream/_messenger.py @@ -411,8 +411,11 @@ class Messenger: assert not hasattr(self._locals, "log_filename") or self._locals.log_filename is None # Create the fully qualified logfile in the log directory, - # appending the pid and .log extension at the end. - self._locals.log_filename = os.path.join(logdir, "{}.{}.log".format(filename, os.getpid())) + # appending the timestamp and .log extension at the end. + timestamp = datetime.datetime.now() + self._locals.log_filename = os.path.join( + logdir, "{}.{}.log".format(filename, timestamp.strftime("%Y%m%d-%H%M%S")) + ) # Ensure the directory exists first directory = os.path.dirname(self._locals.log_filename)
