blob: d4102629ff01a74978efcb3ad9a23e675cc34021 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import sys
import time
def log_build_task(f, *args, **kwargs):
"""Run the given function, representing an entire build task, and log the
BUILDTASK metadata row to stdout.
"""
start = time.monotonic()
try:
return f(*args, **kwargs)
finally:
end = time.monotonic()
print(
"BUILDTASK %s"
% json.dumps(
{"argv": sys.argv, "start": start, "end": end, "context": None}
)
)
|