summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-02-26 12:18:33 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2017-02-26 12:18:33 +0100
commit8db59a181e50dac958f20fd6ca851e2c54d4c4da (patch)
treee95f8c84d81b72d71ba911af9c168ee6f3ec7341
parent69cee93c3bfbf95e1dd5e20bc6aa64bd82f95634 (diff)
downloadapigrabber-8db59a181e50dac958f20fd6ca851e2c54d4c4da.tar.gz
apigrabber-8db59a181e50dac958f20fd6ca851e2c54d4c4da.zip
pass job priority to processor
-rw-r--r--api.py7
m---------joblib0
2 files changed, 4 insertions, 3 deletions
diff --git a/api.py b/api.py
index cfd34d1..0e68b44 100644
--- a/api.py
+++ b/api.py
@@ -52,7 +52,7 @@ class Worker(object):
with open(root + "/insert.sql", "r", encoding="utf-8-sig") as file:
self._insertquery = file.read()
- async def _execute_job(self, jobid, payload):
+ async def _execute_job(self, jobid, payload, priority):
"""Finish a job."""
api = crawler.Crawler(self._apitoken)
logging.debug("%s: getting matches from API", jobid)
@@ -65,15 +65,16 @@ class Worker(object):
object_ids = [i["id"] for i in ids]
for object_id in object_ids:
await self._queue.request(jobtype="process",
+ priority=priority,
payload={"id": object_id})
async def _work(self):
"""Fetch a job and run it."""
- jobid, payload = await self._queue.acquire(jobtype="grab")
+ jobid, payload, priority = await self._queue.acquire(jobtype="grab")
if jobid is None:
raise LookupError("no jobs available")
logging.debug("%s: starting job", jobid)
- await self._execute_job(jobid, payload)
+ await self._execute_job(jobid, payload, priority)
await self._queue.finish(jobid)
logging.debug("%s: finished job", jobid)
diff --git a/joblib b/joblib
-Subproject fa1932a5ac4dd16c743ae55315aa7419297058b
+Subproject f7b858a53e0b3233e04186d18d309f8403ea99d