pq
pq copied to clipboard
Adding name of the job producer
Is it possible to add the name of the job producer? It would be very helpful.
from psycopg2 import connect
from pq import PQ
conn = connect('dbname=example user=postgres')
pq = PQ(conn, client_name='test_client')
Worker will see the name of producer. And preferrably adding column submitted_by into the database schema.
>>> job
<pq.Job id=77709 submitted_by="test_client" size=1 enqueued_at="2014-02-21T16:22:06Z" schedule_at=None>
Hmm, might make more sense to leverage the application_name in the connection string, this way the API doesn't change... :thinking:
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
That's better option actually. It'd be helpful if you can add a property submitted_by or something similar to the Job class: https://github.com/malthe/pq/blob/master/pq/init.py#L395