From 0e6f9da2d5eb45531dd0ea0a1afc4448d6a153ac Mon Sep 17 00:00:00 2001 From: schneefux Date: Fri, 10 Mar 2017 16:51:47 +0100 Subject: cache job finish statement --- joblib.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/joblib.py b/joblib.py index 0c529ea..5c61f98 100644 --- a/joblib.py +++ b/joblib.py @@ -123,16 +123,17 @@ class JobQueue(object): async def finish(self, jobid): """Mark jobs as completed.""" async with self._pool.acquire() as con: + update = await con.prepare(""" + UPDATE jobs + SET status='finished' + WHERE id=$1 + """) if not isinstance(jobid, list): jobids = [jobid] else: jobids = jobid for jid in jobids: - await con.execute(""" - UPDATE jobs - SET status='finished' - WHERE id=$1 - """, jid) + await update.fetch(jid) async def fail(self, jobid, reason): """Mark a job as failed.""" -- cgit v1.3.1