aiogear
Advanced tools
@@ -21,3 +21,3 @@ import asyncio | ||
| """ | ||
| def __init__(self, loop=None): | ||
@@ -32,2 +32,7 @@ super().__init__(loop=loop) | ||
| self.handles_to_job = {} | ||
| self.priority_map = { | ||
| PACKET_TYPES.SUBMIT_JOB_HIGH: self.submit_job_high, | ||
| PACKET_TYPES.SUBMIT_JOB_LOW: self.submit_job_low, | ||
| PACKET_TYPES.SUBMIT_JOB: self.submit_job | ||
| } | ||
@@ -54,3 +59,5 @@ def set_update_callback(self, async_callback): | ||
| :param worker_name: The Gearman function name | ||
| :param jobs: A list tuples of uuid, and data | ||
| :param jobs: A list tuples of uuid, data, priority | ||
| Priority is optional and should be one of | ||
| packet.Type.SUBMIT_JOB, packet.Type.SUBMIT_JOB_HIGH, packet.Type.SUBMIT_JOB_LOW | ||
| :return: A future resolved when jobs are accepted, a future resolved when jobs are completed | ||
@@ -72,3 +79,2 @@ """ | ||
| job_iter = iter(jobs) | ||
| self.notify('progress', None, { | ||
@@ -79,3 +85,3 @@ 'complete': 0, | ||
| async def submit_each(uuid, data): | ||
| async def submit_each(uuid, data, priority=PACKET_TYPES.SUBMIT_JOB): | ||
| """ | ||
@@ -86,2 +92,4 @@ Submit each job and wait for the handle to | ||
| :param data: Data to pass to generic_worker | ||
| :param priority: What order should the job be taken out of | ||
| the gearman queue | ||
| :return: Future resolved when all jobs accepted, completed | ||
@@ -91,4 +99,9 @@ Completed future contains a generator of job results | ||
| try: | ||
| submit_funct = self.priority_map[priority] | ||
| except KeyError: | ||
| raise Exception("Unsupported priority {}".format(priority)) | ||
| self.ready_send_next = self.loop.create_future() | ||
| await self.submit_job(worker_name, data, uuid=uuid) | ||
| await submit_funct(worker_name, data, uuid=uuid) | ||
| handle = await self.ready_send_next | ||
@@ -102,3 +115,3 @@ self.handles_to_job[handle] = uuid | ||
| for params in job_iter: | ||
| for params in jobs: | ||
| await submit_each(*params) | ||
@@ -105,0 +118,0 @@ |
+2
-2
@@ -1,4 +0,4 @@ | ||
| Metadata-Version: 2.0 | ||
| Metadata-Version: 2.1 | ||
| Name: aiogear | ||
| Version: 0.2.5 | ||
| Version: 0.2.6 | ||
| Summary: Asynchronous gearman protocol based on asyncio | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/sardok/aiogear |
+6
-8
| aiogear/__init__.py,sha256=TGDf34BAI2sSrypynhsNbbOzF4XNgYOS2fN8AqW4XT0,280 | ||
| aiogear/admin.py,sha256=BSdZuJppER_hyupbrsZpW3EY3Nkb_83KX3ZLnmb9Z14,3980 | ||
| aiogear/callback_client.py,sha256=AC7QHj0UgNZIrpvL4ppHfcO_MjEi4IGYNicOtCaWPjc,6798 | ||
| aiogear/callback_client.py,sha256=6ud16m0RTSggywsTgfKIPQVzKOSEqN2Pal0H1V78dGk,7473 | ||
| aiogear/client.py,sha256=9vXceRcI1VmUyUaL_iSG-7ts743_UXP1_OnmfReM7tw,3269 | ||
@@ -11,8 +11,6 @@ aiogear/exception.py,sha256=q7t8kbd7JunJUVt11kiTbCsDZazc2GqJv8XhML1kV0w,279 | ||
| aiogear/worker.py,sha256=JnUTNDAEv0thbHapmNnIaQxBHgV9ZUeLjY0DyxAhFBE,6103 | ||
| aiogear-0.2.5.dist-info/DESCRIPTION.rst,sha256=OCTuuN6LcWulhHS3d5rfjdsQtW22n7HENFRh6jC6ego,10 | ||
| aiogear-0.2.5.dist-info/LICENSE.txt,sha256=aKOlcsi-w9drg2PRQfoa4M83mS9FacyriPb3UPVLfWY,1091 | ||
| aiogear-0.2.5.dist-info/METADATA,sha256=CkGAa4xa7PMmXauItPwPqzOAKVmAmNC8bI4W-CaIGzQ,351 | ||
| aiogear-0.2.5.dist-info/RECORD,, | ||
| aiogear-0.2.5.dist-info/WHEEL,sha256=o2k-Qa-RMNIJmUdIc7KU6VWR_ErNRbWNlxDIpl7lm34,110 | ||
| aiogear-0.2.5.dist-info/metadata.json,sha256=NykG5AQn-NoCZQwrjr2e3a6tqfNwa-_ZSG8XE9YuqMM,530 | ||
| aiogear-0.2.5.dist-info/top_level.txt,sha256=qHWIyKhLqElUnOY4Bm8ZxgFoQ6DPzIqZiXzYibRco-8,8 | ||
| aiogear-0.2.6.dist-info/LICENSE.txt,sha256=aKOlcsi-w9drg2PRQfoa4M83mS9FacyriPb3UPVLfWY,1091 | ||
| aiogear-0.2.6.dist-info/METADATA,sha256=ptIib1snlQyZdnfzIj7CVWhH1NDF4TZzVphVrEbge1Y,351 | ||
| aiogear-0.2.6.dist-info/RECORD,, | ||
| aiogear-0.2.6.dist-info/WHEEL,sha256=gduuPyBvFJQSQ0zdyxF7k0zynDXbIbvg5ZBHoXum5uk,110 | ||
| aiogear-0.2.6.dist-info/top_level.txt,sha256=qHWIyKhLqElUnOY4Bm8ZxgFoQ6DPzIqZiXzYibRco-8,8 |
+1
-1
| Wheel-Version: 1.0 | ||
| Generator: bdist_wheel (0.29.0) | ||
| Generator: bdist_wheel (0.31.1) | ||
| Root-Is-Purelib: true | ||
@@ -4,0 +4,0 @@ Tag: py2-none-any |
| UNKNOWN | ||
| {"classifiers": ["Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6"], "extensions": {"python.details": {"contacts": [{"email": "sardok@gmail.com", "name": "Sinan Nalkaya", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst", "license": "LICENSE.txt"}, "project_urls": {"Home": "https://github.com/sardok/aiogear"}}}, "generator": "bdist_wheel (0.29.0)", "metadata_version": "2.0", "name": "aiogear", "summary": "Asynchronous gearman protocol based on asyncio", "version": "0.2.5"} |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.