tasq-client-python 0.1.10__tar.gz → 0.1.12__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.
- {tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/PKG-INFO +1 -1
- {tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/setup.py +1 -1
- {tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/tasq_client/client.py +21 -10
- {tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/tasq_client_python.egg-info/PKG-INFO +1 -1
- {tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/README.md +0 -0
- {tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/setup.cfg +0 -0
- {tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/tasq_client/__init__.py +0 -0
- {tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/tasq_client/check_type.py +0 -0
- {tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/tasq_client/check_type_test.py +0 -0
- {tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/tasq_client_python.egg-info/SOURCES.txt +0 -0
- {tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/tasq_client_python.egg-info/dependency_links.txt +0 -0
- {tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/tasq_client_python.egg-info/requires.txt +0 -0
- {tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/tasq_client_python.egg-info/top_level.txt +0 -0
|
@@ -30,6 +30,10 @@ class QueueCounts:
|
|
|
30
30
|
expired: int
|
|
31
31
|
completed: int
|
|
32
32
|
|
|
33
|
+
# Won't be set if a time window wasn't specified in the request, or if the
|
|
34
|
+
# server is old enough to not support rate estimation.
|
|
35
|
+
rate: Optional[float] = None
|
|
36
|
+
|
|
33
37
|
|
|
34
38
|
class TasqClient:
|
|
35
39
|
"""
|
|
@@ -193,16 +197,17 @@ class TasqClient:
|
|
|
193
197
|
yield None
|
|
194
198
|
return
|
|
195
199
|
|
|
196
|
-
def counts(self) -> QueueCounts:
|
|
200
|
+
def counts(self, rate_window: int = 0) -> QueueCounts:
|
|
197
201
|
"""Get the number of tasks in each state within the queue."""
|
|
198
202
|
data = self._get(
|
|
199
|
-
"/counts",
|
|
200
|
-
|
|
201
|
-
pending
|
|
202
|
-
running
|
|
203
|
-
expired
|
|
204
|
-
completed
|
|
205
|
-
|
|
203
|
+
f"/counts?window={rate_window}",
|
|
204
|
+
{
|
|
205
|
+
"pending": int,
|
|
206
|
+
"running": int,
|
|
207
|
+
"expired": int,
|
|
208
|
+
"completed": int,
|
|
209
|
+
OptionalKey("minute_rate"): float,
|
|
210
|
+
},
|
|
206
211
|
)
|
|
207
212
|
return QueueCounts(**data)
|
|
208
213
|
|
|
@@ -223,7 +228,12 @@ class TasqClient:
|
|
|
223
228
|
assert self.username is not None and self.password is not None
|
|
224
229
|
self.session.auth = (self.username, self.password)
|
|
225
230
|
if self.retry_server_errors:
|
|
226
|
-
retries = Retry(
|
|
231
|
+
retries = Retry(
|
|
232
|
+
total=10,
|
|
233
|
+
backoff_factor=1.0,
|
|
234
|
+
status_forcelist=[500, 502, 503, 504],
|
|
235
|
+
allowed_methods=False,
|
|
236
|
+
)
|
|
227
237
|
for schema in ("http://", "https://"):
|
|
228
238
|
self.session.mount(schema, HTTPAdapter(max_retries=retries))
|
|
229
239
|
|
|
@@ -257,7 +267,8 @@ class TasqClient:
|
|
|
257
267
|
)
|
|
258
268
|
|
|
259
269
|
def _url_for_path(self, path: str, supports_timeout: bool) -> str:
|
|
260
|
-
|
|
270
|
+
separator = "?" if "?" not in path else "&"
|
|
271
|
+
result = self.base_url + path + separator + "context=" + urllib.parse.quote(self.context)
|
|
261
272
|
if supports_timeout and self.task_timeout is not None:
|
|
262
273
|
result += "&timeout=" + urllib.parse.quote(f"{self.task_timeout:f}")
|
|
263
274
|
return result
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/tasq_client_python.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/tasq_client_python.egg-info/requires.txt
RENAMED
|
File without changes
|
{tasq-client-python-0.1.10 → tasq-client-python-0.1.12}/tasq_client_python.egg-info/top_level.txt
RENAMED
|
File without changes
|