pq icon indicating copy to clipboard operation
pq copied to clipboard

Adding name of the job producer

Open riyadparvez opened this issue 5 years ago • 2 comments

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>

riyadparvez avatar Mar 25 '21 12:03 riyadparvez

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

stas avatar Mar 26 '21 12:03 stas

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

riyadparvez avatar Mar 26 '21 16:03 riyadparvez