summaryrefslogtreecommitdiff
path: root/api.py
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-02-26 18:35:32 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2017-02-26 18:35:32 +0100
commit90ee943705e6ed373b778929c0bab94c6e34f674 (patch)
tree533a3ed26fec69e07fa945617d5d0aae33047b99 /api.py
parentf54bb387475cd19e2f8d32cca131e2abb5eea8fd (diff)
downloadapigrabber-90ee943705e6ed373b778929c0bab94c6e34f674.tar.gz
apigrabber-90ee943705e6ed373b778929c0bab94c6e34f674.zip
report job fails in queue
Diffstat (limited to 'api.py')
-rw-r--r--api.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/api.py b/api.py
index 2dfa964..1da9e8d 100644
--- a/api.py
+++ b/api.py
@@ -69,8 +69,12 @@ class Worker(object):
if jobid is None:
raise LookupError("no jobs available")
logging.debug("%s: starting job", jobid)
- await self._execute_job(jobid, payload, priority)
- await self._queue.finish(jobid)
+ try:
+ await self._execute_job(jobid, payload, priority)
+ await self._queue.finish(jobid)
+ except crawler.ApiError as error:
+ logging.warning("%s: failed", jobid)
+ await self._queue.fail(jobid, error.args[0])
logging.debug("%s: finished job", jobid)
async def run(self):