Better HN
topnewbestaskshowjobs
Log inSign up

asksol

223 karma · joined Jun 12, 2009 (17y ago) · 93 submissions

[ my public key: https://keybase.io/asksol; my proof: https://keybase.io/asksol/sigs/pRNbLlBYcQNkHJBAXB06Ci8CwTlUr6TpYgvSo5Q4Rt0 ]
Submissions

comment 10y ago · link · parent

> - You are limited to x number of blocking operations, where x >is the number of workers. It means you cannot do massively >parallel I/O such as network operations with it (e.g: a web >server).

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

Author of Celery here (not the article).

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

The title seem to suggest this has something to do with browser histories, but as far as I can tell from reading the article it's much worse: they want your ISP to keep a log of the web sites/other services you are using, and they want to get this log by simple request to your ISP (no VSL, subpoena, or warrant).

So restoring this option wouldn't help, maybe only using TOR or some VPN proxy would.

comment 10y ago · link · parent

I really like the browser, but still doesn't work with Apple Keychain so using it is not an option here. Guess I'm too lazy but it would take weeks to migrate over, and then I'd need to store the passwords in dual locations, which seems like a bad idea.

comment 10y ago · link · parent

100k lines of Python? I find it hard to believe that this project is properly organized. Rarely do you see 100k lines of Python solving a single problem, instead a project will be divided into many components, some of which can be reused in other projects. There shouldn't be any difference working on 1k line or 1 million-line code bases as long as the code is decoupled. Testing each part in isolation helps a lot (as opposed to running tests for a big monolithic ball of mud), as it ensures contributors are not introducing crazy dependencies.

I'm not against types at all, but don't think they solve problems related to big code bases.

comment 12y ago · link · parent

A broker is not suitable for all systems, but for this type of system going broker-less will quickly get complicated, and you're likely to end up with something resembling a broker anyway.

comment 12y ago · link · parent

Celery can very well handle 100k tasks/sec. Celery is not locked in to Python, but you are right it's not a drop in solution for other languages as it doesn't support them natively (yet, but that will change soon).

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

There are many differences, but most notably rq spawns one process per task. Line count is a stupid metric, e.g recently our line count doubled because of our new coding style, also the majority of the source code is tests.

comment 12y ago · link · parent

Thanks for the comments! Feedback on documentation is always welcome as it's hard to step inside the state of someone starting to use the project. I wish people would speak out more as I'm sure there are many more issues with the docs. The best way to get this solved is to open an issue at http://github.com/celery/celery/issues, you can even make suggestions.

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

The opt-in argument is useless since there is no way to verify that the user subscribed in the first place, giving them the address or not. All you do is providing value to the spammer since they have now verified that the email is indeed real and read by a person. When reporting abuse you can already forge any email out of nothing, and you cannot prove that the email was forged unless they have a trace of the email being sent by their server (logs), and if they have that trace they can see easily see a pattern of mass distribution and start an investigation by contacting the other recipients on that list, or just wait for more reports to come in. Guess it's been a while since I worked at an ISP, but I have never heard of a spam abuse investigation strategy that involves forwarding the address to the suspected spammer.

comment 12y ago · link · parent

I seem to remember "anarchist" being used for "someone using violence to further their view", so in that sense the situation is maybe better now.

comment 12y ago · link · parent

That must be a very recent development for 0mq then, do you have any source for this new feature?

comment 12y ago · link · parent

Right, I understand that ZeroMQ is used to send and receive messages, what I mean is that there's no persistency involved so the tasks will not survive a system restart.

comment 12y ago · link · parent

I wouldn't really classify this example as a "task queue", it resembles more the RPC pattern really (and I would guess that this example does not persist the jobs in any way). Celery does have a very experimental filesystem based transport that could be used for your use case. I don't know if it fits on a Raspberry PI but celery does not have very high memory/space requirements (c.f. other Python libraries).

comment 12y ago · link · parent

Could you please educate the rest of us what is so upsetting about these tweets (other than the fact that he received death threats)?

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

E.g. in Norway you don't receive welfare unless you've been actively employed for some years.

comment 13y ago · link · parent

"My wife is from Britain", "My husband is British" ? Maybe these are now archaic

comment 13y ago · link · parent

Blood from arteries are light red, while blood from veins is dark red. I don't know, but could not 'blue blood' be a term used for deoxygenated blood?

comment 13y ago · link · parent

"Journal of Near-Death studies"? Some of the papers in there are interesting, but it does seem kind of .. experimental

comment 13y ago · link · parent

carrot was already in use. I like Celery, we have no plans to change the name

comment 13y ago · link · parent

The logo looks almost identical to the old celery (task queue) logo. Not sure how the word "celery" relates to payments, but the name of the task queue is not random: rabbits like celery (rabbitmq.com).

comment 13y ago · link · parent

Like this little "fact box": http://www.cymascope.com/cyma_research/soundhealingimages/Pr..., only reference to "Prime Resonance Frequency" I could find on the web was on a few new-age sites, and apparently they have managed to find the frequency at which a cell vibrates.

comment 13y ago · link · parent

I love cached_property, and I don't see what makes it unpythonic. I don't consider it magic, it's just a small addition to the built-in property descriptor, and it makes the often repeated code easier to read. I'm sure it will be a common idiom very soon.

comment 14y ago · link · parent

Sure you can do that (using threads/multiprocessing/greenlets). But usually you don't want to because it's hard to guarantee that the background task will complete without interruption.

comment 14y ago · link · parent

Note that Celery isn't just about what you describe here. A distributed task queue is beneficial in Go (or node.js) too. Async is one thing, distribution is another. Also web servers are often volatile environments (e.g. for tasks that must complete).

comment 14y ago · link · parent

Celery supports beanstalk among many other backends (RabbitMQ, Redis, MongoDB, ..., etc)

So you can use Celery as a driver for beanstalk in Python.

comment 14y ago · link · parent

Very good question!

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

Several ways to accomplish that, but I would recommend using kombu in combination with celery to have the task manually send messages.

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

one queue for every worker instance, yes! this is for broadcasting remote control commands, but I don't see how this poses a problem?

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

1234