From db9095de83e30f63f5dcb2559a6189981cb8fbef Mon Sep 17 00:00:00 2001 From: Mirko Bonadei Date: Mon, 23 Nov 2020 17:45:52 +0100 Subject: [PATCH] Fix perf results upload. Starting from [1], //third_party/protobuf has been updated to 3.13.0 and this introduces a breaking change which breaks WebRTC's perf results upload (see bugs.webrtc.org/12211). Error: File [..]/tracing/proto/histogram_proto.py", line 9, in import histogram_pb2 # pylint:disable=relative-import File "[..]/tracing/proto/histogram_pb2.py", line 22, in create_key=_descriptor._internal_create_key, AttributeError: 'module' object has no attribute '_internal_create_key' It looks like vpython is not able to load the wheel from the vpython environment if the import happens in the "from ... import ..." form while it works if the library is pre-imported with "import ...". [1] - https://chromium-review.googlesource.com/c/chromium/src/+/2545204 No-Try: True No-Presubmit: True Bug: webrtc:12211 Change-Id: Id3e365eb9d4c4c31bcd4dcfab7db700e0e6e00b2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195000 Commit-Queue: Mirko Bonadei Reviewed-by: Andrey Logvin Cr-Commit-Position: refs/heads/master@{#32677} --- DEPS | 9 +++++++++ tools_webrtc/perf/webrtc_dashboard_upload.py | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/DEPS b/DEPS index 6b00452db1..d29ef8ef0f 100644 --- a/DEPS +++ b/DEPS @@ -3167,6 +3167,15 @@ hooks = [ '--bucket', 'chromium-webrtc-resources', 'src/resources'], }, + # Download and initialize "vpython" VirtualEnv environment packages. + { + 'name': 'vpython_common', + 'pattern': '.', + 'action': [ 'vpython', + '-vpython-spec', 'src/.vpython', + '-vpython-tool', 'install', + ], + }, ] recursedeps = [] diff --git a/tools_webrtc/perf/webrtc_dashboard_upload.py b/tools_webrtc/perf/webrtc_dashboard_upload.py index df5b9bb2c8..a709af5dcd 100644 --- a/tools_webrtc/perf/webrtc_dashboard_upload.py +++ b/tools_webrtc/perf/webrtc_dashboard_upload.py @@ -21,6 +21,11 @@ import argparse import os import sys +# Even if protobuf is not used directly, this allows transitive imports +# of the protobuf library to use the vpython wheel specified in the root +# level .vpython (see bugs.webrtc.org/12211 for context). +import google.protobuf # pylint: disable=unused-import + def _CreateParser(): parser = argparse.ArgumentParser()