Bug 229783

Summary: [run-perf-tests] Add support for python3 and use it by default
Product: WebKit Reporter: Carlos Alberto Lopez Perez <clopez>
Component: Tools / TestsAssignee: Carlos Alberto Lopez Perez <clopez>
Status: RESOLVED FIXED    
Severity: Normal CC: aakash_jain, cdumez, clopez, darin, don.olmstead, ews-watchlist, glenn, jbedard, pnormand, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=226658
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Carlos Alberto Lopez Perez 2021-09-01 17:26:10 PDT
run-perf-tests seems to be already compatible with python3 (works without issue here) so let's change the default
Comment 1 Carlos Alberto Lopez Perez 2021-09-01 17:43:13 PDT
Created attachment 437096 [details]
Patch
Comment 2 Jonathan Bedard 2021-09-01 17:59:16 PDT
Let's wait on this one until we have a pending restart....unfortunately EWS doesn't cover us, and we won't see any consequences until buildbot restarts
Comment 3 Carlos Alberto Lopez Perez 2021-09-02 04:50:26 PDT
today r281919 landed with changes to the buildbot servers.

I think we can land the patch from this bug (if you give me r+) and then schedule a restart of the buildbot server to make effective both patches.
Comment 4 Jonathan Bedard 2021-09-02 08:07:42 PDT
(In reply to Carlos Alberto Lopez Perez from comment #3)
> today r281919 landed with changes to the buildbot servers.
> 
> I think we can land the patch from this bug (if you give me r+) and then
> schedule a restart of the buildbot server to make effective both patches.

Did some local testing to verify things seem to be working with Python 3.
Comment 5 Aakash Jain 2021-09-02 09:09:58 PDT
(In reply to Carlos Alberto Lopez Perez from comment #3)
> I think we can land the patch from this bug (if you give me r+) and then schedule a restart of the buildbot server to make effective both patches.
Let's not do that. There are many changes landing/in-flight for EWS. It would be hard to not include a specific landed change while restarting EWS. Let's land only what we are ready to pick up.
Comment 6 Carlos Alberto Lopez Perez 2021-09-02 11:23:31 PDT
(In reply to Aakash Jain from comment #5)
> (In reply to Carlos Alberto Lopez Perez from comment #3)
> > I think we can land the patch from this bug (if you give me r+) and then schedule a restart of the buildbot server to make effective both patches.
> Let's not do that. There are many changes landing/in-flight for EWS. It
> would be hard to not include a specific landed change while restarting EWS.
> Let's land only what we are ready to pick up.

This patch doesn't affect the EWS, only this two post-commit bots:

https://build.webkit.org/#/builders/Apple-Catalina-Release-WK2-Perf
https://build.webkit.org/#/builders/GTK-Linux-64-bit-Release-Perf

I gave it more testing and the part of uploading the json results to the server was broken with python3. I think I managed to fix it.. I'm uploading a second patch
Comment 7 Carlos Alberto Lopez Perez 2021-09-02 11:46:25 PDT
Created attachment 437176 [details]
Patch
Comment 8 Jonathan Bedard 2021-09-02 12:09:29 PDT
Comment on attachment 437176 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=437176&action=review

> Tools/Scripts/webkitpy/common/net/file_uploader.py:110
> +                request = Request(self._url, data.encode('utf-8'), {b'Content-Type': content_type.encode('utf-8')})

We've been using webkitcorepy.string_utils encode/decode for this, in this case, I think you wand encode with a target type of bytes, which will only encode if the provided string of type unicode (which it will be in Python 3, won't be in Python 2)
Comment 9 Carlos Alberto Lopez Perez 2021-09-02 13:43:12 PDT
Created attachment 437188 [details]
Patch
Comment 10 Jonathan Bedard 2021-09-02 13:46:46 PDT
Comment on attachment 437188 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=437188&action=review

> Tools/Scripts/webkitpy/common/net/file_uploader.py:37
> +    unicode = str

We can import `unicode` from webkitcorepy.string_utils instead of redeclaring that import here
Comment 11 Carlos Alberto Lopez Perez 2021-09-02 14:09:52 PDT
Created attachment 437195 [details]
Patch

Use webkitcorepy.string_utils
Comment 12 EWS 2021-09-02 15:09:48 PDT
Committed r281958 (241265@main): <https://commits.webkit.org/241265@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 437195 [details].
Comment 13 Radar WebKit Bug Importer 2021-09-02 15:10:18 PDT
<rdar://problem/82695350>