summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-03-10 16:51:47 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2017-03-10 16:51:47 +0100
commit0e6f9da2d5eb45531dd0ea0a1afc4448d6a153ac (patch)
tree64aa3010d1cb8bfde4455b0b23a252cc7f651b0c
parentd3b6bcaf493f19971d1a3401a0720daac82c9410 (diff)
downloadjoblib-0e6f9da2d5eb45531dd0ea0a1afc4448d6a153ac.tar.gz
joblib-0e6f9da2d5eb45531dd0ea0a1afc4448d6a153ac.zip
cache job finish statement
-rw-r--r--joblib.py11
1 files 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."""