Bug 1393655 - Strip microsecond from run-task logs
* Strip microsecond from log prefixes generated
by run-task.
MozReview-Commit-ID: 87kL6gs2LZS
--- a/taskcluster/docker/recipes/run-task
+++ b/taskcluster/docker/recipes/run-task
@@ -63,18 +63,19 @@ Change the Dockerfile and anything run f
any VOLUME.
A lesser possibility is that you stumbled upon a TaskCluster platform bug
where it fails to use new volumes for tasks.
'''
def print_line(prefix, m):
- now = datetime.datetime.utcnow()
- print(b'[%s %sZ] %s' % (prefix, now.isoformat(), m), end=b'')
+ now = datetime.datetime.utcnow().isoformat()
+ now = now[:-3] if now[-7] == '.' else now # slice microseconds to 3 decimals
+ print(b'[%s %sZ] %s' % (prefix, now, m), end=b'')
def run_and_prefix_output(prefix, args, extra_env=None):
"""Runs a process and prefixes its output with the time.
Returns the process exit code.
"""
print_line(prefix, b'executing %s\n' % args)
@@ -104,17 +105,16 @@ def run_and_prefix_output(prefix, args,
data = p.stdout.readline()
if data == b'':
break
print_line(prefix, data)
return p.wait()
-
WANTED_DIR_MODE = stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR
def set_dir_permissions(path, uid, gid):
st = os.lstat(path)
if st.st_uid != uid or st.st_gid != gid:
os.chown(path, uid, gid)