diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-02-26 12:18:33 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-02-26 12:18:33 +0100 |
| commit | 8db59a181e50dac958f20fd6ca851e2c54d4c4da (patch) | |
| tree | e95f8c84d81b72d71ba911af9c168ee6f3ec7341 | |
| parent | 69cee93c3bfbf95e1dd5e20bc6aa64bd82f95634 (diff) | |
| download | apigrabber-8db59a181e50dac958f20fd6ca851e2c54d4c4da.tar.gz apigrabber-8db59a181e50dac958f20fd6ca851e2c54d4c4da.zip | |
pass job priority to processor
| -rw-r--r-- | api.py | 7 | ||||
| m--------- | joblib | 0 |
2 files changed, 4 insertions, 3 deletions
@@ -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 |
