Skip to content

Fixes build for PyPy3#6635

Merged
thedrow merged 11 commits intocelery:masterfrom
mjhoffman65:fix_pypy_check
Jun 27, 2021
Merged

Fixes build for PyPy3#6635
thedrow merged 11 commits intocelery:masterfrom
mjhoffman65:fix_pypy_check

Conversation

@mjhoffman65
Copy link
Contributor

@mjhoffman65 mjhoffman65 commented Feb 18, 2021

@auvipy, I took at stab at fixing the PyPy failures. My first step is to try to install all the requirements and recreate the unit test failure in the docker environment. I ran into issues installing the python requirements and am wondering if more work needs to be done before we can expect celery to run with PyPy. Looks like at least a couple of the dependencies do not work with PyPy since they rely on a C backend.

couchbase: https://docs.couchbase.com/python-sdk/current/hello-world/start-using-sdk.html#pypy-support
ephem: celery/django-celery-beat#69 (comment) (Note we may be able to replace this with skyfield. See here for more.)

This PR illustrates the same error I'm getting in the docker environment: https://github.com/celery/celery/runs/1930241932?check_suite_focus=true

How should I move forward?

@mjhoffman65 mjhoffman65 changed the title installs packages the same way docker does PyPy Compatibility Feb 18, 2021
@mjhoffman65 mjhoffman65 changed the title PyPy Compatibility PyPy Compatibility? Feb 18, 2021
@auvipy
Copy link
Member

auvipy commented Feb 19, 2021

I think we should stop couchbase testing and eventually remove it from the build. I am not sure how much popular it is.

@mjhoffman65
Copy link
Contributor Author

mjhoffman65 commented Feb 22, 2021

We now see actual errors.
Are you working on fixing those?

Yep! Working now to fix them.

@mjhoffman65 mjhoffman65 changed the title PyPy Compatibility? Fixes build for PyPy3 Feb 22, 2021
@mjhoffman65
Copy link
Contributor Author

mjhoffman65 commented Feb 22, 2021

@auvipy @thedrow This is ready for review. I have some in-progress Dockerfile changes making it easy to run the unit tests with pypy3 via docker as well, but that can go separately.

@mjhoffman65 mjhoffman65 marked this pull request as ready for review February 22, 2021 18:41
@lgtm-com
Copy link

lgtm-com bot commented Feb 22, 2021

This pull request introduces 1 alert and fixes 2 when merging c0ca554 into 3384937 - view on LGTM.com

new alerts:

  • 1 for Unused import

fixed alerts:

  • 1 for Non-exception in 'except' clause
  • 1 for Module is imported with 'import' and 'import from'

@mjhoffman65
Copy link
Contributor Author

mjhoffman65 commented Feb 22, 2021

What about that event is a boolean failure that pops up every now and then?
@auvipy You know what I'm talking about right? Can you find a build log where that happens?
@mjhoffman65 If you repeatedly run the test suite multiple times, does it always pass?

@thedrow I've ran it 4 times in docker and so far it has always passed. I'm not sure how to trigger reruns with the github actions, but I haven't seen that error pop up yet. I'm assuming it's this one: #6489

@mjhoffman65
Copy link
Contributor Author

Was able to recreate #6489. Will reopen after I fix it.

@auvipy auvipy reopened this Feb 24, 2021
@auvipy auvipy added this to the 5.1.0 milestone Feb 24, 2021
@lgtm-com
Copy link

lgtm-com bot commented Mar 2, 2021

This pull request introduces 1 alert and fixes 2 when merging 3712de6 into cfa1b41 - view on LGTM.com

new alerts:

  • 1 for Unused import

fixed alerts:

  • 1 for Non-exception in 'except' clause
  • 1 for Module is imported with 'import' and 'import from'

@maybe-sybr
Copy link
Contributor

Those dockerfile changes @mjhoffman65 mentioned might make life easier, but I don't see a ref to them. In any case, I've got a pypy3 interpreter on my box so I'll see if I can clean this up.

@maybe-sybr
Copy link
Contributor

maybe-sybr commented May 7, 2021

Rebased this to hopefully fix the CI failures on that delivery info test, also with the correct fix for #6489

Edit: Annoyingly couchbase now doesn't appear to be getting installed in the github jobs? configured properly?

And there's another test breaking under pypy3 in test_events.py :(

We could cherry pick 651a0ed by itself but I'm not confident enough to spend more time on this in the lead up to 5.1.

@maybe-sybr maybe-sybr marked this pull request as ready for review May 7, 2021 02:51
@lgtm-com
Copy link

lgtm-com bot commented May 7, 2021

This pull request fixes 3 alerts when merging 82d7ad3 into 426a8f9 - view on LGTM.com

fixed alerts:

  • 1 for Non-exception in 'except' clause
  • 1 for Unused import
  • 1 for Module is imported with 'import' and 'import from'

@maybe-sybr
Copy link
Contributor

maybe-sybr commented May 9, 2021

It's still broken :( I de-drafted this thinking it would run through and go green and now can't work out how to put it back 😬

Edit: Found it. It was a text link under the reviewers rather than a nice button...

@maybe-sybr maybe-sybr marked this pull request as draft May 9, 2021 23:38
@maybe-sybr
Copy link
Contributor

Freshened this on top of master now that 5.1 is released. I've also made some changes to the workflow to run unit tests using tox. I think that might fix up some of the weirdness around the missing dependencies. We'll see...

@lgtm-com
Copy link

lgtm-com bot commented May 24, 2021

This pull request fixes 2 alerts when merging 4dd514e into 025bad6 - view on LGTM.com

fixed alerts:

  • 1 for Non-exception in 'except' clause
  • 1 for Module is imported with 'import' and 'import from'

@maybe-sybr
Copy link
Contributor

maybe-sybr commented Jun 9, 2021

Freshened on master and also with a few extra fixes for the same kind of Thread._is_stopped shadowing in the bgThread class which is probably broken in a race-y way similar to Timer but only touched in two tests so we probably never noticed that it was different to the timer failure.

I'm hoping this will go green now, with the fix from #6806 pulled in via the rebase as well.

@codecov
Copy link

codecov bot commented Jun 9, 2021

Codecov Report

Merging #6635 (1ce3b20) into master (d9d8250) will increase coverage by 5.12%.
The diff coverage is 100.00%.

❗ Current head 1ce3b20 differs from pull request most recent head f486c0d. Consider uploading reports for the commit f486c0d to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6635      +/-   ##
==========================================
+ Coverage   70.70%   75.82%   +5.12%     
==========================================
  Files         138      138              
  Lines       16603    16603              
  Branches     2092     2092              
==========================================
+ Hits        11739    12590     +851     
+ Misses       4668     3797     -871     
- Partials      196      216      +20     
Flag Coverage Δ
unittests 75.82% <100.00%> (+5.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
celery/backends/redis.py 92.17% <ø> (+8.93%) ⬆️
celery/bin/base.py 0.00% <ø> (ø)
celery/concurrency/__init__.py 100.00% <ø> (ø)
celery/exceptions.py 32.60% <ø> (ø)
celery/worker/consumer/consumer.py 93.57% <ø> (ø)
celery/canvas.py 94.82% <100.00%> (ø)
celery/utils/threads.py 65.43% <100.00%> (ø)
celery/utils/timer2.py 98.95% <100.00%> (ø)
celery/app/trace.py 98.60% <0.00%> (+0.27%) ⬆️
celery/result.py 58.01% <0.00%> (+0.40%) ⬆️
... and 22 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d9d8250...f486c0d. Read the comment docs.

@maybe-sybr
Copy link
Contributor

maybe-sybr commented Jun 9, 2021

Huh, weird, it's trying to run flake8 under action environments without python 3.9 installed :/

Edit: Oh 0295d7a did that. Probably no point in linting in each of the build jobs though, that's kind of weird

@lgtm-com
Copy link

lgtm-com bot commented Jun 9, 2021

This pull request introduces 1 alert and fixes 1 when merging a3b2af7 into d9d8250 - view on LGTM.com

new alerts:

  • 1 for Non-exception in 'except' clause

fixed alerts:

  • 1 for Module is imported with 'import' and 'import from'

@maybe-sybr maybe-sybr force-pushed the fix_pypy_check branch 2 times, most recently from 60a8122 to 1ce3b20 Compare June 9, 2021 07:41
Also fix some flakes which may have been added by some other
autoformatter in celery#6804. The 4 space non-visual-indentation should keep
most formatters fairly happy.
@lgtm-com
Copy link

lgtm-com bot commented Jun 9, 2021

This pull request fixes 1 alert when merging f486c0d into d9d8250 - view on LGTM.com

fixed alerts:

  • 1 for Module is imported with 'import' and 'import from'

@maybe-sybr maybe-sybr marked this pull request as ready for review June 9, 2021 10:14
@maybe-sybr maybe-sybr requested a review from thedrow June 9, 2021 10:14
@thedrow thedrow merged commit 117cd9c into celery:master Jun 27, 2021
jeyrce pushed a commit to jeyrce/celery that referenced this pull request Aug 25, 2021
* installs packages the same way docker does

* removes couchbase dependency for PyPy

* removes ephem dependency for PyPy

* fixes mongo unit tests for PyPy3

Mocking `datetime.datetime` was causing an issue with
`datetime.utcnow()`.  This mock doesn't appear to be needed.
See https://github.com/celery/celery/pull/6635/checks?check_run_id=1944166896.

* fix: Avoid shadowing `Thread` attributes

Fixes celery#6489

* ci: Install default deps for pypy3 toxenvs

* ci: Run unit tests with `tox`

* ci: Lint source in separate action using `tox`

* ci: Redent codecov action

* test: Rework some mocking in `test_platforms.py`

Also fix some flakes which may have been added by some other
autoformatter in celery#6804. The 4 space non-visual-indentation should keep
most formatters fairly happy.

* style: Fix some flakes

Co-authored-by: maybe-sybr <58414429+maybe-sybr@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pypy3 unit tests sometimes fail due to an attribute we expect to be an Event being a bool instead

3 participants