Live data from Hacker News

Procrastinate: PostgreSQL-Based Task Queue for Python

procrastinate.readthedocs.io

21–30 of 40 posts

Re: Procrastinate: PostgreSQL-Based Task Queue for Python

#21

Is there a job/message queue implemented in pure Postgres, so it doesn't depend on Python, Perl, Ruby, ...? So that it can be used from any language that can connect to Postgres?

My opinion is if you need a message queue use a message queue product, not a database.

Re: Procrastinate: PostgreSQL-Based Task Queue for Python

#22

Is there a job/message queue implemented in pure Postgres, so it doesn't depend on Python, Perl, Ruby, ...? So that it can be used from any language that can connect to Postgres?

Usually job queue libraries provide other niceties like tight language integrations. While you could probably build a job queue with a decent API in pure postgres, it wouldn't even come close to e.g. just slapping @task in front of your method like in the post.

Re: Procrastinate: PostgreSQL-Based Task Queue for Python

#23
post #11

My current favourite task queue is http://p3rl.org/Minion and I mention this not in a spirit of competition but because the pg queries to be found in the source code of https://metacpan.org/dist/Minion/source/lib/Minion/Backend/P... are IMO truly beautiful and worthy of the "great artists steal" treatment.

I’m reading through that file and I’m not finding anything particularly interesting — the queries all look… reasonable — though I’m also struggling to imagine what I would consider a beautiful query

Anything specific worth calling out?

Re: Procrastinate: PostgreSQL-Based Task Queue for Python

#24

Is there a job/message queue implemented in pure Postgres, so it doesn't depend on Python, Perl, Ruby, ...? So that it can be used from any language that can connect to Postgres?

My opinion is if you need a message queue use a message queue product, not a database.

FWIW, my opinion is that you always start with the database, especially an RDBMS, to solve your problem. Databases have some pretty advanced programming constructs, and advanced algorithms that are available to you via a language as simple as SQL.

And when it (the database) cannot serve your needs in terms of performance anymore, then you must choose a domain-specific product dedicated to solve the you challenges.

> premature optimization is the root of all evil.

Re: Procrastinate: PostgreSQL-Based Task Queue for Python

#25

I’ve been looking for a tool that could replace Celery for my smaller projects and use postgresql as its queuing system. I was pointed this way in the recent thread about message queuing natively in postgresql [1]. I thought it seemed like a project deserving a bit more attention. https://news.ycombinator.com/item?id=30119285

Why this and not celery? And why Postgres and not rabbitmq or redis?

Came here to ask this as well :)

I have a production system running on Celery (on Redis). It's been fine, once I tuned it.

Time for a refactor; wondering: should I consider migration?

Re: Procrastinate: PostgreSQL-Based Task Queue for Python

#26

This looks nice, I'll give it a try. It's worth mentionning Huey too: https://huey.readthedocs.io/en/latest/ I've been using it for a year on top of sqlite.

I ran on Huey for a few years on a python/postgres ecosystem project fronted by Django, and ultimately migrated to django-postgres-queue, which is wonderful. (There has since been a fork that I have not used.) It uses the same underlying primitives as OP, and I would absolutely recommend this to anyone operating in the same ecosystem.

https://github.com/gavinwahl/django-postgres-queue

Re: Procrastinate: PostgreSQL-Based Task Queue for Python

#27
At my past job we have something like for newsletters and 250k/tasks per day was fine. The only design problem we have had is that if you keep past tasks on the queue table, when it grows it traches a lot cache due to index writes, so moving already finished jobs from the hot table had solved the issue.

Re: Procrastinate: PostgreSQL-Based Task Queue for Python

#28
StarQueue is also written in Async Python

https://www.starqueue.org/

It's not open source though it is free.

StarQueue has a pure HTTP API so any language can talk to it.

StarQueue is designed to be a more simple implementation of the SQS way of doing things, without some of the unnecessary stuff that SQS has in its API.

Under the hood it uses Postgres although I actually wrote it to support MySQL and SQL Server also, which are equally capable of doing queueing as Postgres.

Re: Procrastinate: PostgreSQL-Based Task Queue for Python

#29
post #14

Quite timely to see this discussion here. I got to a point on a home project last night where I need to implement a scheduler and was thinking 'man I dont want to setup Celery for this', that can wait for tomorrow. In the past I have actually written my own very little scheduler that borrows the app database. Really just table that is a job queue and a script on a loop that grabs the job when it appears in the table.…

[deleted]

Re: Procrastinate: PostgreSQL-Based Task Queue for Python

#30

I’ve been looking for a tool that could replace Celery for my smaller projects and use postgresql as its queuing system. I was pointed this way in the recent thread about message queuing natively in postgresql [1]. I thought it seemed like a project deserving a bit more attention. https://news.ycombinator.com/item?id=30119285

If you are just queueing outbound emails you can consider a simple SMTP buffer that uses no server at all - it just saves files to disk.

I was using Celery for sending emails - nothing else. And Celery was such a nightmare to configure and debug and such overkill for email buffering that in a fit of frustration I wrote the Arnie SMTP buffering server and ditched Celery.

https://github.com/bootrino/arniesmtpbufferserver

It's only 100 lines of code:

https://github.com/bootrino/arniesmtpbufferserver/blob/maste...

Post reply on HN