Jedutils 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {Jedutils-0.2.1 → Jedutils-0.2.2}/Jedutils.egg-info/PKG-INFO +1 -1
- {Jedutils-0.2.1 → Jedutils-0.2.2}/PKG-INFO +1 -1
- Jedutils-0.2.2/jedutils/__init__.py +3 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/jedutils/asyncio/_async_redis_pipe.py +14 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/jedutils/asyncio/network/_dl.py +1 -1
- Jedutils-0.2.1/jedutils/__init__.py +0 -3
- {Jedutils-0.2.1 → Jedutils-0.2.2}/Jedutils.egg-info/SOURCES.txt +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/Jedutils.egg-info/dependency_links.txt +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/Jedutils.egg-info/requires.txt +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/Jedutils.egg-info/top_level.txt +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/LICENSE +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/MANIFEST.in +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/README.md +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/jedutils/asyncio/__init__.py +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/jedutils/asyncio/_concurrency_manager.py +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/jedutils/asyncio/_run_async.py +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/jedutils/asyncio/_rwlock.py +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/jedutils/asyncio/network/__init__.py +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/jedutils/databases/__init__.py +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/jedutils/databases/_in_memory.py +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/jedutils/math/__init__.py +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/jedutils/math/_number_formatter.py +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/jedutils/strings/__init__.py +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/jedutils/strings/_chunked_text.py +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/jedutils/strings/_random_string.py +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/setup.cfg +0 -0
- {Jedutils-0.2.1 → Jedutils-0.2.2}/setup.py +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
+
import logging
|
|
2
3
|
|
|
3
4
|
try:
|
|
4
5
|
from redis import Redis
|
|
@@ -28,6 +29,7 @@ class AsyncRedisPipe:
|
|
|
28
29
|
pipe_max_size: int = 200,
|
|
29
30
|
workers: int = 8,
|
|
30
31
|
loop: asyncio.AbstractEventLoop = None,
|
|
32
|
+
debug: bool = False,
|
|
31
33
|
) -> None:
|
|
32
34
|
"""
|
|
33
35
|
Args:
|
|
@@ -42,6 +44,9 @@ class AsyncRedisPipe:
|
|
|
42
44
|
|
|
43
45
|
loop (:py:class:`asyncio.AbstractEventLoop`, *optional*):
|
|
44
46
|
The event loop to use. Defaults to :py:class:`asyncio.get_event_loop()`.
|
|
47
|
+
|
|
48
|
+
debug (``bool``, *optional*):
|
|
49
|
+
Whether to enable debug logging. Defaults to ``False``.
|
|
45
50
|
"""
|
|
46
51
|
|
|
47
52
|
if not Redis:
|
|
@@ -49,6 +54,9 @@ class AsyncRedisPipe:
|
|
|
49
54
|
|
|
50
55
|
self.redis = redis
|
|
51
56
|
self.pipe_max_size = pipe_max_size
|
|
57
|
+
self.debug = debug
|
|
58
|
+
self.logger = logging.getLogger(__name__)
|
|
59
|
+
|
|
52
60
|
self.__queue = asyncio.Queue()
|
|
53
61
|
self.__loop = (
|
|
54
62
|
asyncio.get_event_loop()
|
|
@@ -83,6 +91,9 @@ class AsyncRedisPipe:
|
|
|
83
91
|
except asyncio.QueueEmpty:
|
|
84
92
|
break
|
|
85
93
|
else:
|
|
94
|
+
if self.debug:
|
|
95
|
+
self.logger.debug(f"Executing command: {data[1]}")
|
|
96
|
+
|
|
86
97
|
pipe.execute_command(*data[1])
|
|
87
98
|
futures.append(data[0])
|
|
88
99
|
count += 1
|
|
@@ -92,6 +103,9 @@ class AsyncRedisPipe:
|
|
|
92
103
|
async def __handle_pipe_line(self, futures: list, pipe):
|
|
93
104
|
results = await pipe.execute(False)
|
|
94
105
|
for x, result in enumerate(results):
|
|
106
|
+
if self.debug:
|
|
107
|
+
self.logger.debug(f"Result: {result}")
|
|
108
|
+
|
|
95
109
|
if isinstance(result, BaseException):
|
|
96
110
|
futures[x].set_exception(result)
|
|
97
111
|
else:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|