223 karma · joined Jun 12, 2009 (17y ago) · 93 submissions
comment 10y ago · link · parent
Celery can use eventlet/gevent instead of multiprocessing for executing tasks, so this should be possible (granted, not sure if using it as a web server is a great idea)
>- Tasks cannot communicate with each others;
This is not true, they can send messages to each other
>- You must juggle with the workflow of your tasks (is it ready >? it it dead ?). You can use await stuff() with a try/except;
If you have to juggle it means your workflow design is not good enough. I.e. you shouldn't wait for other tasks, you should have callbacks and errbacks.
Also, note that a try/except does not guarantee the operation will be completed (e.g your asyncio app can be killed).
I'm not sure there's much point in comparing these, they are wildly different concepts: Celery is a distributed system, asyncio is for async I/O, the GIL is only a problem if you can't start n instances of your app.
comment 10y ago · link · parent
Celery solves a different problem: it's a distributed system that will help you run your tasks on multiple machines, not an alternative to asyncio/twisted/tornado etc.
The GIL is often easily worked around by starting N instances of your app, but that doesn't work for all applications (games, video, audio). Celery won't help you in those cases, but you can write C extensions. 99.99% of the time you shouldn't even consider using posix threads in Python, as most libraries (including popular ones) are not thread-safe, resulting in spending precious time fixing tricky bugs.
Celery is also not in contrast to coroutines, actually it's quite common to use Celery as a distributed layer on top of async I/O frameworks (top tip: routing CPU-bound tasks to a prefork worker means they will not block your event loop).
Another thing, the article says `scrape_url.subtask(args=(url,)),` is not very readable, but the idiomatic way to write this is: `scrape_url.s(url)` (yup we have a one letter method name, Django has Q we have .s). See more examples here: http://docs.celeryproject.org/en/latest/userguide/canvas.htm...
comment 10y ago · link · parent
So restoring this option wouldn't help, maybe only using TOR or some VPN proxy would.
comment 10y ago · link · parent
I'm not against types at all, but don't think they solve problems related to big code bases.
comment 12y ago · link · parent
You can write simple workers for Celery in other languages too, and there is one in active development for Java. But then Redis is not really a good choice, AMQP is more convenient for interoperability.
Have no idea if pinterest evaluated Celery, because they have not been in contact. If they did there are several pitfalls they could have gotten wrong at this scale, but I'm pretty confident it would have been more than suitable. It could have been a benefit for all of us and chances are they have underestimated the effort needed to maintain a custom solution.
comment 12y ago · link · parent
1) How does it differ from startproject? 2) That's how you tell Celery to use your Django project settings as a source of configuration. Did you read the 'First steps with Celery' guide first? 3) The old Python import behavior is very limiting, and starting from Python 3 absolute import is the default. We believe everyone should start using it by importing it in all modules, but you don't have to if you don't want to, just give it another name. 4) The Django result backend is a stable component, the Django ORM message transport is not, so we won't tell you how to use it in the introduction because we don't want you to. You can find the instructions here: http://docs.celeryproject.org/en/latest/getting-started/brok... 5) Everything is supported out of the box except for storing results using the Django ORM (there's built-in sqlalchemy result backend that can also be used, but it's not compatible with the Django backend as the data is stored in a slightly different way: https://github.com/celery/celery/issues/183)
comment 12y ago · link · parent
comment 12y ago · link · parent
comment 12y ago · link · parent
Jacob is doing a fantastic job at making people of all types feel welcome, which I believe is more likely to make the Django developer community thrive (as it already is).
Also, the footnote mentioned where pg writes that he enjoys that startups can freely discriminate is worrying. It does not mean that pg is a sexist, but he is a role model and we would expect him to be more sensitive.
comment 13y ago · link · parent
comment 14y ago · link · parent
The reason is that I found that it better matches what you use them for in Celery, since they are used e.g. to forward results from the previous tasks to a callback. Often you have a signatures like: def blur_image(image, amount=1), where the partial is used like render_image.s(file) | blur_image.s()
functools.partial is usually used the other way; it's most common to create functools.partials where the first argument is satisfied.
comment 14y ago · link · parent
You could set the exchange type of the results exchange to be topic too, that way you would both have result queues and you could additionally bind a queue to the results exchange to get a copy of all the messages sent there. But if you don't need to listen for individual results then I'd rather just send messages manually. You have both connection and producer pools in Celery, so it's rather convenient to combine kombu with celery.
comment 14y ago · link · parent
If you mean the one queue for every task behavior of the amqp result backend then that is also a yes. Usually with replies in amqp you create one queue for every client, but Celery is often used in a web context where the process that initiated the task may not be the same process that collects the reply, so this is why it uses one queue for every task (it's also documented).
There's an experimental result backend for RPC-style replies, that uses transient messages and one queue per client: http://github.com/celery/celery/tree/kombuRPC