|
|
Description[Telemetry] Add PRESUBMIT check to prevent .sha file uploaded without archive file uploaded
BUG=461379
TEST=Add a foo.wpr.sha1 file in tools/perf/page_set/data/ with random content, commit it, then run "git cl upload presubmit".
Committed: https://crrev.com/417ee8e828edf67ba172eb560ac96055fb4320da
Cr-Commit-Position: refs/heads/master@{#317955}
Patch Set 1 : #
Total comments: 16
Patch Set 2 : Address reviewers' comments #
Total comments: 6
Patch Set 3 : Address comments #
Total comments: 2
Patch Set 4 : Address comments #
Total comments: 2
Patch Set 5 : Fix redundant BUCKET_ALIASES assignment #Messages
Total messages: 30 (8 generated)
Patchset #1 (id:1) has been deleted
nednguyen@google.com changed reviewers: + aiolos@chromium.org, dtu@chromium.org, slamm@chromium.org
https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py File tools/perf/PRESUBMIT.py (right): https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:52: results.append(output_api.PresubmitError( Should this be a warning instead of an error? People outside of Google don't have permission to access all of the buckets, and will need to record their own wpr files to run the page_sets in Internal, and sometimes Partner. They definitely shouldn't be uploading or committing those recordings.
https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py File tools/perf/PRESUBMIT.py (right): https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:52: results.append(output_api.PresubmitError( On 2015/02/24 18:19:45, aiolos wrote: > Should this be a warning instead of an error? People outside of Google don't > have permission to access all of the buckets, and will need to record their own > wpr files to run the page_sets in Internal, and sometimes Partner. They > definitely shouldn't be uploading or committing those recordings. If they don't commit or upload, then this PRESUBMIT check will not run. It doesn't run on all .wpr.sha1 file, only the one that included in your commit. And it only runs when you do "git cl upload" or "git cl presubmit".
https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py File tools/perf/PRESUBMIT.py (right): https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:14: sys.path = [os.path.join(os.pardir, 'telemetry')] + sys.path PRESUBMIT scripts aren't supposed to have side effects, so this should go back in the try block format that is was in earlier.
https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py File tools/perf/PRESUBMIT.py (right): https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:45: wpr_file_exist_on_cloud = False nit: wpr_file_exists_in_cloud https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:52: results.append(output_api.PresubmitError( On 2015/02/24 18:24:40, nednguyen wrote: > On 2015/02/24 18:19:45, aiolos wrote: > > Should this be a warning instead of an error? People outside of Google don't > > have permission to access all of the buckets, and will need to record their > own > > wpr files to run the page_sets in Internal, and sometimes Partner. They > > definitely shouldn't be uploading or committing those recordings. > > If they don't commit or upload, then this PRESUBMIT check will not run. It > doesn't run on all .wpr.sha1 file, only the one that included in your commit. > And it only runs when you do "git cl upload" or "git cl presubmit". I think this is fine. I guess you have to be careful that the buckets are ordered from most open to most restrictive. https://codereview.chromium.org/954753002/diff/20001/tools/telemetry/telemetr... File tools/telemetry/telemetry/util/cloud_storage.py (right): https://codereview.chromium.org/954753002/diff/20001/tools/telemetry/telemetr... tools/telemetry/telemetry/util/cloud_storage.py:25: SUPPORTED_BUCKETS = (PUBLIC_BUCKET, PARTNER_BUCKET, INTERNAL_BUCKET) Avoid redundancy: use BUCKET_ALIASES.itervalues(). If you need to retain the order, use collections.OrderedDict
https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py File tools/perf/PRESUBMIT.py (right): https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:39: """ Check whether the wpr sha files have matching URLs """ No spaces immediately inside triple quotes. """Check whether the wpr sha files have matching URLs.""" https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:45: wpr_file_exist_on_cloud = False How about the following? is_wpr_file_uploaded or is_wpr_file_in_cloud https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:49: cloud_storage.Exists(bucket, expected_hash)) is_wpr_file_uploaded = any(cloud_storage.Exists(bucket, expected_hash) for bucket in cloud_storage.SUPPORTED_BUCKETS)) https://codereview.chromium.org/954753002/diff/20001/tools/telemetry/telemetr... File tools/telemetry/telemetry/util/cloud_storage.py (right): https://codereview.chromium.org/954753002/diff/20001/tools/telemetry/telemetr... tools/telemetry/telemetry/util/cloud_storage.py:25: SUPPORTED_BUCKETS = (PUBLIC_BUCKET, PARTNER_BUCKET, INTERNAL_BUCKET) On 2015/02/24 19:12:47, dtu wrote: > Avoid redundancy: use BUCKET_ALIASES.itervalues(). If you need to retain the > order, use collections.OrderedDict itervalues gives an undefined order.
https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py File tools/perf/PRESUBMIT.py (right): https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:14: sys.path = [os.path.join(os.pardir, 'telemetry')] + sys.path On 2015/02/24 18:53:07, aiolos wrote: > PRESUBMIT scripts aren't supposed to have side effects, so this should go back > in the try block format that is was in earlier. Done. https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:39: """ Check whether the wpr sha files have matching URLs """ On 2015/02/24 19:22:59, slamm wrote: > No spaces immediately inside triple quotes. > > """Check whether the wpr sha files have matching URLs.""" Done. https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:45: wpr_file_exist_on_cloud = False On 2015/02/24 19:12:47, dtu wrote: > nit: wpr_file_exists_in_cloud Done. https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:45: wpr_file_exist_on_cloud = False On 2015/02/24 19:22:59, slamm wrote: > How about the following? > > is_wpr_file_uploaded > > or > > is_wpr_file_in_cloud Done. https://codereview.chromium.org/954753002/diff/20001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:49: cloud_storage.Exists(bucket, expected_hash)) On 2015/02/24 19:22:59, slamm wrote: > is_wpr_file_uploaded = any(cloud_storage.Exists(bucket, expected_hash) > for bucket in cloud_storage.SUPPORTED_BUCKETS)) Nice, I like this. https://codereview.chromium.org/954753002/diff/20001/tools/telemetry/telemetr... File tools/telemetry/telemetry/util/cloud_storage.py (right): https://codereview.chromium.org/954753002/diff/20001/tools/telemetry/telemetr... tools/telemetry/telemetry/util/cloud_storage.py:25: SUPPORTED_BUCKETS = (PUBLIC_BUCKET, PARTNER_BUCKET, INTERNAL_BUCKET) On 2015/02/24 19:12:47, dtu wrote: > Avoid redundancy: use BUCKET_ALIASES.itervalues(). If you need to retain the > order, use collections.OrderedDict Done.
Patchset #2 (id:40001) has been deleted
Patchset #2 (id:60001) has been deleted
https://codereview.chromium.org/954753002/diff/80001/tools/perf/PRESUBMIT.py File tools/perf/PRESUBMIT.py (right): https://codereview.chromium.org/954753002/diff/80001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:43: old_sys_path = sys.path The nested sys.path changes are unneeded. Either this one should be removed, or the one in _CommonChecks should be moved to _CheckJson.
https://codereview.chromium.org/954753002/diff/80001/tools/telemetry/telemetr... File tools/telemetry/telemetry/util/cloud_storage.py (right): https://codereview.chromium.org/954753002/diff/80001/tools/telemetry/telemetr... tools/telemetry/telemetry/util/cloud_storage.py:31: BUCKET_ALIASES['internal'] = INTERNAL_BUCKET collections.OrderedDict(( ('public', PUBLIC_BUCKET), ('partner', PARTNER_BUCKET), ('internal', INTERNAL_BUCKET), ))
https://codereview.chromium.org/954753002/diff/80001/tools/telemetry/telemetr... File tools/telemetry/telemetry/util/cloud_storage.py (right): https://codereview.chromium.org/954753002/diff/80001/tools/telemetry/telemetr... tools/telemetry/telemetry/util/cloud_storage.py:31: BUCKET_ALIASES['internal'] = INTERNAL_BUCKET On 2015/02/24 19:39:49, dtu wrote: > collections.OrderedDict(( > ('public', PUBLIC_BUCKET), > ('partner', PARTNER_BUCKET), > ('internal', INTERNAL_BUCKET), > )) Also, collections.OrderedDict( public=PUBLIC_BUCKET, partner=PARTNER_BUCKET, internal=INTERNAL_BUCKET) https://codereview.chromium.org/954753002/diff/40002/tools/perf/PRESUBMIT.py File tools/perf/PRESUBMIT.py (right): https://codereview.chromium.org/954753002/diff/40002/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:48: is_wpr_file_uploaded = False Not needed.
https://codereview.chromium.org/954753002/diff/80001/tools/perf/PRESUBMIT.py File tools/perf/PRESUBMIT.py (right): https://codereview.chromium.org/954753002/diff/80001/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:43: old_sys_path = sys.path On 2015/02/24 19:37:49, aiolos wrote: > The nested sys.path changes are unneeded. Either this one should be removed, or > the one in _CommonChecks should be moved to _CheckJson. Err, I didn't look at this carefully and thought that _CommonChecks is in parallel with _CheckWprShaFiles :-) https://codereview.chromium.org/954753002/diff/80001/tools/telemetry/telemetr... File tools/telemetry/telemetry/util/cloud_storage.py (right): https://codereview.chromium.org/954753002/diff/80001/tools/telemetry/telemetr... tools/telemetry/telemetry/util/cloud_storage.py:31: BUCKET_ALIASES['internal'] = INTERNAL_BUCKET On 2015/02/24 19:39:49, dtu wrote: > collections.OrderedDict(( > ('public', PUBLIC_BUCKET), > ('partner', PARTNER_BUCKET), > ('internal', INTERNAL_BUCKET), > )) Done. https://codereview.chromium.org/954753002/diff/80001/tools/telemetry/telemetr... tools/telemetry/telemetry/util/cloud_storage.py:31: BUCKET_ALIASES['internal'] = INTERNAL_BUCKET On 2015/02/24 20:51:19, slamm wrote: > On 2015/02/24 19:39:49, dtu wrote: > > collections.OrderedDict(( > > ('public', PUBLIC_BUCKET), > > ('partner', PARTNER_BUCKET), > > ('internal', INTERNAL_BUCKET), > > )) > > Also, > > collections.OrderedDict( > public=PUBLIC_BUCKET, > partner=PARTNER_BUCKET, > internal=INTERNAL_BUCKET) Cool. But I prefer Dave's syntax. https://codereview.chromium.org/954753002/diff/40002/tools/perf/PRESUBMIT.py File tools/perf/PRESUBMIT.py (right): https://codereview.chromium.org/954753002/diff/40002/tools/perf/PRESUBMIT.py#... tools/perf/PRESUBMIT.py:48: is_wpr_file_uploaded = False On 2015/02/24 20:51:19, slamm wrote: > Not needed. Done.
LGTM (though I am ignorant of the ways of the PRESUBMIT)
On 2015/02/24 20:59:27, slamm wrote: > LGTM (though I am ignorant of the ways of the PRESUBMIT) also lgtm
On 2015/02/24 21:40:01, aiolos wrote: > On 2015/02/24 20:59:27, slamm wrote: > > LGTM (though I am ignorant of the ways of the PRESUBMIT) > > also lgtm Ping Dave since Steve and Kari don't have owner yet.
On 2015/02/24 21:59:38, nednguyen wrote: > On 2015/02/24 21:40:01, aiolos wrote: > > On 2015/02/24 20:59:27, slamm wrote: > > > LGTM (though I am ignorant of the ways of the PRESUBMIT) > > > > also lgtm > > Ping Dave since Steve and Kari don't have owner yet. I'm pretty sure that's fine since you do.
On 2015/02/24 22:00:51, aiolos wrote: > On 2015/02/24 21:59:38, nednguyen wrote: > > On 2015/02/24 21:40:01, aiolos wrote: > > > On 2015/02/24 20:59:27, slamm wrote: > > > > LGTM (though I am ignorant of the ways of the PRESUBMIT) > > > > > > also lgtm > > > > Ping Dave since Steve and Kari don't have owner yet. > > I'm pretty sure that's fine since you do. One way to find out... ;)
The CQ bit was checked by aiolos@chromium.org
The CQ bit was unchecked by aiolos@chromium.org
https://codereview.chromium.org/954753002/diff/100001/tools/telemetry/telemet... File tools/telemetry/telemetry/util/cloud_storage.py (right): https://codereview.chromium.org/954753002/diff/100001/tools/telemetry/telemet... tools/telemetry/telemetry/util/cloud_storage.py:38: BUCKET_ALIASES['internal'] = INTERNAL_BUCKET now this is redundant
https://codereview.chromium.org/954753002/diff/100001/tools/telemetry/telemet... File tools/telemetry/telemetry/util/cloud_storage.py (right): https://codereview.chromium.org/954753002/diff/100001/tools/telemetry/telemet... tools/telemetry/telemetry/util/cloud_storage.py:38: BUCKET_ALIASES['internal'] = INTERNAL_BUCKET On 2015/02/25 00:30:28, dtu wrote: > now this is redundant Oopps, silly me!
lgtm
The CQ bit was checked by nednguyen@google.com
The patchset sent to the CQ was uploaded after l-g-t-m from aiolos@chromium.org, slamm@chromium.org Link to the patchset: https://codereview.chromium.org/954753002/#ps120001 (title: "Fix redundant BUCKET_ALIASES assignment")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/954753002/120001
Message was sent while issue was closed.
Committed patchset #5 (id:120001)
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/417ee8e828edf67ba172eb560ac96055fb4320da Cr-Commit-Position: refs/heads/master@{#317955} |