Commit 73e83f95 authored by Ned Nguyen's avatar Ned Nguyen Committed by Commit Bot

[perf] Do not specify timeout limit for luci-auth's token generation

We misunderstood how authentication token works in the past. For one time request,
the token expiration time don't matter much.

Setting a high timeout expiration is making luci-auth fail flakily. Since we
generate a new token for every perf dashboard upload attempt, using the default
value of luci-auth should be fine

Bug:878916
Cq-Include-Trybots: master.tryserver.chromium.perf:obbs_fyi
Change-Id: Ie9025fb0fc2467dda02cd8aa0aa3e2136ca190a8

NOTRY=true # all tests passed, speed up landing to green up perf waterfall uploading

Change-Id: Ie9025fb0fc2467dda02cd8aa0aa3e2136ca190a8
Reviewed-on: https://chromium-review.googlesource.com/1195930
Commit-Queue: Ned Nguyen <nednguyen@google.com>
Reviewed-by: default avatarSimon Hatch <simonhatch@chromium.org>
Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Reviewed-by: default avatarAndrii Shyshkalov <tandrii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587352}
parent 750635ec
...@@ -34,7 +34,6 @@ psutil = external_modules.ImportOptionalModule('psutil') ...@@ -34,7 +34,6 @@ psutil = external_modules.ImportOptionalModule('psutil')
# The paths in the results dashboard URLs for sending results. # The paths in the results dashboard URLs for sending results.
SEND_RESULTS_PATH = '/add_point' SEND_RESULTS_PATH = '/add_point'
SEND_HISTOGRAMS_PATH = '/add_histograms' SEND_HISTOGRAMS_PATH = '/add_histograms'
DEFAULT_TOKEN_TIMEOUT_IN_MINUTES = 30
class SendResultException(Exception): class SendResultException(Exception):
...@@ -49,10 +48,8 @@ class SendResultsFatalException(SendResultException): ...@@ -49,10 +48,8 @@ class SendResultsFatalException(SendResultException):
pass pass
def LuciAuthTokenGeneratorCallback( def LuciAuthTokenGeneratorCallback(service_account_file):
service_account_file, token_expiration_in_minutes): args = ['luci-auth', 'token']
args = ['luci-auth', 'token',
'-lifetime', '%im' % token_expiration_in_minutes]
if service_account_file: if service_account_file:
args += ['-service-account-json', service_account_file] args += ['-service-account-json', service_account_file]
else: else:
...@@ -87,8 +84,7 @@ def SendResults(data, data_label, url, send_as_histograms=False, ...@@ -87,8 +84,7 @@ def SendResults(data, data_label, url, send_as_histograms=False,
builder will be used. builder will be used.
token_generator_callback: a callback for generating the authentication token token_generator_callback: a callback for generating the authentication token
to upload to perf dashboard. to upload to perf dashboard.
This callback takes two parameters This callback takes |service_account_file| and returns the token
(service_account_file, token_expiration_in_minutes) and returns the token
string. string.
If |token_generator_callback| is not specified, it's default to If |token_generator_callback| is not specified, it's default to
LuciAuthTokenGeneratorCallback. LuciAuthTokenGeneratorCallback.
...@@ -470,8 +466,7 @@ def _SendHistogramJson(url, histogramset_json, ...@@ -470,8 +466,7 @@ def _SendHistogramJson(url, histogramset_json,
None if successful, or an error string if there were errors. None if successful, or an error string if there were errors.
""" """
try: try:
oauth_token = token_generator_callback( oauth_token = token_generator_callback(service_account_file)
service_account_file, DEFAULT_TOKEN_TIMEOUT_IN_MINUTES)
data = zlib.compress(histogramset_json) data = zlib.compress(histogramset_json)
headers = { headers = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment