Celery 5.0
docs.celeryproject.org
docs.celeryproject.org
I have also used Celery parallelize crawling of multiple websites in parallel. Beyond a small number of workers, Celery would go into a frozen state (My data flow was one way. No chance that I know of deadlocking.) The code felt too convoluted to dive in and understand.
I have since shifted to Dramatiq ( https://dramatiq.io/ ). It has all the features I like of Celery (Chaining of async methods with error handling when any one link on the chain fails), with super reliability. It also has Django support.
Having said that, it must be recognized that Dramatiq was built from the success and learnings gained from Celery. Celery is a wonderful piece of work still in active use in almost all Python shops. I am just thankful that we now have so many alternatives.
PS: The Django-Q mentioned in another comment looks very well structured, comprehensive and actively developed. I shall give it a try. For now, so happy with Dramatiq.
I guess as long as you go into it eyes wide open - dramatiq is not an actor framework - you will be a-ok.
I am so glad to hear that the community has listened and picked it up again. Thank you for pointing it out.
I've used celery very successfully in the past once setup. About ten years ago I had problems connecting to rabbitmq. I finally found a solution and posted it on the GitHub project page. The funny thing is two years later I ran into the same issue. I forgot about that post and ended up stumbling on my post, and at first didn't realize it was mine.
I still get an occasional email about that solution.
However, if anyone from the maintainers is reading - could you guys please have auvipy not deliberately close outstanding issues / PRs that he thinks are not important and that other maintainers then proceed to re-open.
Disclosure: I got banned for pointing that out only, so I may be slightly biased. [0]
0 - https://github.com/celery/celery/issues/4817#issuecomment-47...
Also, you really need to read the fine print to understand the quirks of every backend (eg. Redis) when using Celery. For me, this plus the above means I'll never use Celery again.
It's a terrible piece of open source as it "looks" fine from the outside, you integrate it and then you start getting weird stability issues that are super hard to debug.
I was in the process of evaluating Celery for a project, and it was looking promising, but this sentence alone might have prompted me to pull the emergency brake.
I've had past experience with projects that have a policy of shipping frequent major releases in order to have frequent breaking changes, and it was never a fun time. It's not just that the breaking changes themselves are troublesome. It's also that projects that are overly liberal about removing features tend to become overly liberal about adding features, too. So that, over the long run, they have a tendency to become bloated and clunky at a faster-than-average rate.
”As we’d like to provide some time for you to transition, we’re designating Celery 4.x an LTS release. Celery 4.x will be supported until the 1st of August, 2021.” [from the op]
An LTS version supported for less then a year from being designated as LTS?
However 7 breaks your pipeline.
What do you do? Fix the vulnerability yourself on an outdated version (high effort) Upgrade your entire pipeline to the new version (High effort) Leave the vulnerability in place (terrible idea)
That's honestly the only viable choice with such libraries if you want to deploy your software in production environments.
Thankfully, there are alternatives around and you're not forced to migrate every task at the same time
But that's a mitigation strategy, not a place you actually want to be. I would not consider selecting a dependency with the intent of doing things that way to be a sound policy, because infrequent big-bang updates like that have a tendency to be expensive and risky. There aren't a lot of development ethics that I find less palatable than "move fast and break things," but "move slow and break things" is definitely one of them.
There was a sequence of releases in 4.x that each had their own game-breaking bug for us, which has meant we have been stuck for a while (I've tried personally contributing fixes to this project, and fixed one bug, but another got introduced in the same release).
I would be happy about more granular releases, but I hope they could make more "bugfix-only" releases so I can make some forward progress on not having a busted task queue.
This combined with flower [2] provides a simple platform to build powerful platform for data integration with real-time and scheduled long running jobs. Apache Airflow also use celery for distributed execution of tasks and jobs.
[1] https://github.com/celery/celery/issues/4843 (fixed in 5.0 will be backported to 4.x).
Look the story of AngularJS vs React.
As a library you’re the less important part of my system, I use you to save me time so that I can focus on business logic. The moment I am spending time on you constantly is the moment I am looking for something else
A link to more detailed description is missing though.
"To read more about Celery you should go read the introduction" (with link)
Well, the fact is that if you are sending a couple of emails per hour for users that are registering to your site you don't need to use async tasks. Just offload them to your SMTP or use something like sendgrid. It won't matter to the user if there are a couple of seconds until he sees the http response or he gets the email after 1 minute. Also, even for other kinds of async tasks you can usually get away using a management command and a cron job running once per minute. Let's suppose your users may need to create a report that needs 1 minute to be created. Just flag it to run in your request response cycle and run it in the management task from cron. The user will be notified when it's been finished. Or even if you actually need that async task functionality, just start by using a simpler way to run async tasks (that aren't as complex as celery, don't need rabbit mq and can even use the database as a broker so you won't need any external parts). You almost probably don't need to support hundreds of async tasks per minute or complex task workflows using forks joins etc. I mean if you need to use celery you probably will know it.
https://docs.celeryproject.org/en/latest/changelog.html#chan...
https://docs.celeryproject.org/en/latest/history/index.html#...
My understanding is that the Python versions that don't support asyncio have been removed, which should make the codebase cleaner and easier to maintain. So it's actually a pretty big deal.
A few years ago I added native windows support to python rq but the maintainer couldn't accept the pull request which was a bummer so I just abandoned the project.
And if you have first-class messages instead of function calls as the data in your queue, things like decoupling into services becomes much easier.
In celery the consumer and producer are very tightly coupled (same code needed).
How can frequent breaking changes be a better experience?
I just can't trust a product that doesn't even discuss those issues prominently in the documentation. Distributed computing is inherent for a background task queue, and it's one of the hardest problems out there, so their best effort patchwork of retries and checks doesn't cut it for me. They seem to code and document for a happy case, which is a huge red flag.
My celery experience so far has been quite awful to say the least.
From the infrastructure point of view, celery has been the less reliable component of our stack by far. As others have mentioned, one problem is that celery is frequently used for what it is not meant to be. And that's true for us too. If you check the documentation, deep down, celery was originally designed for short lived tasks, cpu bound, but turned out to be used for long lived tasks. And starting to process long lived tasks is the root of many problems until you find the correct settings to make it work. Of course, these settings are either not documented, or the documentation is useless at best (it sometimes creates even more confusion). There are also very few good quality resources online regarding this.
For several months, we dealt with celery workers getting stuck and not processing tasks, celery workers running out of memory, ... until we found the correct solution. And even now, we still have some random issues we have difficulty to track down due to the poor quality of monitoring around celery. It actually made me smile a few weeks ago when the engineering team of DoorDash released a blog article about celery in which they mentioned several issues we encountered, including some they still have no clue but managed to mitigate (in particular, the stuck celery queue: they need to use -Ofair to fix the scheduling algorithm!) [1]
It's also very easy for developers to make mistake with celery: celery routing in Django is messy (routing of individual tasks and scheduled tasks), adding new queues need some coordination upon deployment until you automate it, generating too many scheduled tasks can make your workers run out memory, ... Celery definitely requires a solid training for all the engineers that will work with it. To be fair, this is very likely to be a true for any backgroubd processing tools: it usually is a critical part of the tech stack, but resources/training about that are less.
We are still using Celery 3. We few months ago, when they released celery 4, we looked into upgrading, but it was way more work that expected as the entire configuration syntax was broken. The testing needed to deploy that to production was not worth the shot, especially when factoring it took us months to find some tricky settings to get celery to finally be somewhat stable, so why risk losing that. Now, they already are at celery 5.0, and they plan to release even more breaking updates: seriously, WTF! And if you try to report issues but you use celery 3, you'll just be told to upgrade.
To be frank, I believe celery is a good project. They aren't many alternatives in python anyway. But they don't seem to listen to what their users need. It really seems that there is a gap between what they expect people to do with celery and what people do with it. I understand it's hard to provide a good default configuration suiting everyone, but then provide the appropriate documentation about how you can tune celery based on your use case, or clearly state the intented use case and limitations. So, the last thing we need is more breaking versions with more uncertainty about celery, but more documentation!
If they really go on that path, it's clear that we will eventually ditch celery for something else. Celery, from our experience, is not production friendly unless you put major efforts into it, or unless your project is fairly simple.
[1] https://doordash.engineering/2020/09/03/eliminating-task-pro...
But honestly, people working on Celery in their free time (i think) so who am I to complain. I can see that monetary support would be necessary to make it better. But in my opinion the project just got too big and it will be difficult to fix all the underlying issues.
Please take care of the Redis connections. Make sure that you can control all of the client settings and make sure that it reconnects reliably.
From what I can gleam from a high level scan of the project, Celery is a process/task queue, yet the intermingling of Celery's framework with whatever a process/task's goal happens to be looks like a non-starter for any organization that does not use python like BASH.
This appears to be a poor architecture for a distributed programming framework. There are a good number of high quality proses/task queues already, I don't see a reason for this project at all.
It doesn’t solve a single problem that a set of bare queue consumers can’t resolve.
- By default, task IDs are just pickled Python objects - if you want to change the location of a function, it might break; - The whole process appears to be reloaded for each task - any heavy loading ends up being performed on each call; - I couldn't find any "ops" documentation: how does it interact with RabbitMQ? How are deferred tasks implemented? What happens if a node crashes?
Although the API is nice, the product itself seems ill-suited for actual reliable, production use — at that point, it's sometimes easier to just deploy your own minimal API using the serialization format you've chosen to adopt (JSON, Protobuf, ASN.1, … ;)
"It doesn't solve a single problem that a set of queue instances on a single machine solve. Who needs any resilience?"
Weird take, that is provably incorrect and wrong.
No thanks.