saq 0.24.10__tar.gz → 0.24.11__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.
Files changed (34) hide show
  1. {saq-0.24.10/saq.egg-info → saq-0.24.11}/PKG-INFO +4 -1
  2. {saq-0.24.10 → saq-0.24.11}/README.md +3 -0
  3. {saq-0.24.10 → saq-0.24.11}/saq/__init__.py +1 -1
  4. {saq-0.24.10 → saq-0.24.11}/saq/queue/base.py +15 -6
  5. {saq-0.24.10 → saq-0.24.11/saq.egg-info}/PKG-INFO +4 -1
  6. {saq-0.24.10 → saq-0.24.11}/LICENSE +0 -0
  7. {saq-0.24.10 → saq-0.24.11}/MANIFEST.in +0 -0
  8. {saq-0.24.10 → saq-0.24.11}/saq/__main__.py +0 -0
  9. {saq-0.24.10 → saq-0.24.11}/saq/errors.py +0 -0
  10. {saq-0.24.10 → saq-0.24.11}/saq/job.py +0 -0
  11. {saq-0.24.10 → saq-0.24.11}/saq/multiplexer.py +0 -0
  12. {saq-0.24.10 → saq-0.24.11}/saq/py.typed +0 -0
  13. {saq-0.24.10 → saq-0.24.11}/saq/queue/__init__.py +0 -0
  14. {saq-0.24.10 → saq-0.24.11}/saq/queue/http.py +0 -0
  15. {saq-0.24.10 → saq-0.24.11}/saq/queue/postgres.py +0 -0
  16. {saq-0.24.10 → saq-0.24.11}/saq/queue/postgres_migrations.py +0 -0
  17. {saq-0.24.10 → saq-0.24.11}/saq/queue/redis.py +0 -0
  18. {saq-0.24.10 → saq-0.24.11}/saq/types.py +0 -0
  19. {saq-0.24.10 → saq-0.24.11}/saq/utils.py +0 -0
  20. {saq-0.24.10 → saq-0.24.11}/saq/web/__init__.py +0 -0
  21. {saq-0.24.10 → saq-0.24.11}/saq/web/aiohttp.py +0 -0
  22. {saq-0.24.10 → saq-0.24.11}/saq/web/common.py +0 -0
  23. {saq-0.24.10 → saq-0.24.11}/saq/web/starlette.py +0 -0
  24. {saq-0.24.10 → saq-0.24.11}/saq/web/static/app.js +0 -0
  25. {saq-0.24.10 → saq-0.24.11}/saq/web/static/pico.min.css.gz +0 -0
  26. {saq-0.24.10 → saq-0.24.11}/saq/web/static/snabbdom.js.gz +0 -0
  27. {saq-0.24.10 → saq-0.24.11}/saq/worker.py +0 -0
  28. {saq-0.24.10 → saq-0.24.11}/saq.egg-info/SOURCES.txt +0 -0
  29. {saq-0.24.10 → saq-0.24.11}/saq.egg-info/dependency_links.txt +0 -0
  30. {saq-0.24.10 → saq-0.24.11}/saq.egg-info/entry_points.txt +0 -0
  31. {saq-0.24.10 → saq-0.24.11}/saq.egg-info/requires.txt +0 -0
  32. {saq-0.24.10 → saq-0.24.11}/saq.egg-info/top_level.txt +0 -0
  33. {saq-0.24.10 → saq-0.24.11}/setup.cfg +0 -0
  34. {saq-0.24.10 → saq-0.24.11}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: saq
3
- Version: 0.24.10
3
+ Version: 0.24.11
4
4
  Summary: Distributed Python job queue with asyncio and redis
5
5
  Home-page: https://github.com/tobymao/saq
6
6
  Author: Toby Mao
@@ -177,6 +177,9 @@ print(job.results)
177
177
  # run a job and return the result
178
178
  print(await queue.apply("test", a=2))
179
179
 
180
+ # run a job with custom polling interval to check status more frequently
181
+ print(await queue.apply("test", a=2, poll_interval=0.1))
182
+
180
183
  # Run multiple jobs concurrently and collect the results into a list
181
184
  print(await queue.map("test", [{"a": 3}, {"a": 4}]))
182
185
 
@@ -137,6 +137,9 @@ print(job.results)
137
137
  # run a job and return the result
138
138
  print(await queue.apply("test", a=2))
139
139
 
140
+ # run a job with custom polling interval to check status more frequently
141
+ print(await queue.apply("test", a=2, poll_interval=0.1))
142
+
140
143
  # Run multiple jobs concurrently and collect the results into a list
141
144
  print(await queue.map("test", [{"a": 3}, {"a": 4}]))
142
145
 
@@ -14,4 +14,4 @@ __all__ = [
14
14
  "Worker",
15
15
  ]
16
16
 
17
- __version__ = "0.24.10"
17
+ __version__ = "0.24.11"
@@ -28,12 +28,12 @@ if t.TYPE_CHECKING:
28
28
  from saq.types import (
29
29
  BeforeEnqueueType,
30
30
  CountKind,
31
- ListenCallback,
32
31
  DumpType,
32
+ ListenCallback,
33
33
  LoadType,
34
34
  QueueInfo,
35
- WorkerStats,
36
35
  WorkerInfo,
36
+ WorkerStats,
37
37
  )
38
38
 
39
39
 
@@ -370,7 +370,7 @@ class Queue(ABC):
370
370
  job_keys: sequence of job keys
371
371
  callback: callback function, if it returns truthy, break
372
372
  timeout: if timeout is truthy, wait for timeout seconds
373
- poll_interval: number of seconds in between poll attempts if needed
373
+ poll_interval: Number of seconds between checking job status (default 0.5)
374
374
  """
375
375
 
376
376
  async def listen() -> None:
@@ -391,7 +391,13 @@ class Queue(ABC):
391
391
  else:
392
392
  await listen()
393
393
 
394
- async def apply(self, job_or_func: str, timeout: float | None = None, **kwargs: t.Any) -> t.Any:
394
+ async def apply(
395
+ self,
396
+ job_or_func: str,
397
+ timeout: float | None = None,
398
+ poll_interval: float = 0.5,
399
+ **kwargs: t.Any,
400
+ ) -> t.Any:
395
401
  """
396
402
  Enqueue a job and wait for its result.
397
403
 
@@ -409,9 +415,12 @@ class Queue(ABC):
409
415
  Args:
410
416
  job_or_func: Same as Queue.enqueue
411
417
  timeout: If provided, how long to wait for result, else infinite (default None)
418
+ poll_interval: Number of seconds between checking job status (default 0.5)
412
419
  kwargs: Same as Queue.enqueue
413
420
  """
414
- results = await self.map(job_or_func, timeout=timeout, iter_kwargs=[kwargs])
421
+ results = await self.map(
422
+ job_or_func, timeout=timeout, poll_interval=poll_interval, iter_kwargs=[kwargs]
423
+ )
415
424
  if results:
416
425
  return results[0]
417
426
  return None
@@ -450,7 +459,7 @@ class Queue(ABC):
450
459
  return_exceptions: If False (default), an exception is immediately raised as soon as any jobs
451
460
  fail. Other jobs won't be cancelled and will continue to run.
452
461
  If True, exceptions are treated the same as successful results and aggregated in the result list.
453
- poll_interval: number of seconds in between poll attempts
462
+ poll_interval: Number of seconds between checking job status (default 0.5)
454
463
  kwargs: Default kwargs for all jobs. These will be overridden by those in iter_kwargs.
455
464
  """
456
465
  iter_kwargs = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: saq
3
- Version: 0.24.10
3
+ Version: 0.24.11
4
4
  Summary: Distributed Python job queue with asyncio and redis
5
5
  Home-page: https://github.com/tobymao/saq
6
6
  Author: Toby Mao
@@ -177,6 +177,9 @@ print(job.results)
177
177
  # run a job and return the result
178
178
  print(await queue.apply("test", a=2))
179
179
 
180
+ # run a job with custom polling interval to check status more frequently
181
+ print(await queue.apply("test", a=2, poll_interval=0.1))
182
+
180
183
  # Run multiple jobs concurrently and collect the results into a list
181
184
  print(await queue.map("test", [{"a": 3}, {"a": 4}]))
182
185
 
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
File without changes
File without changes
File without changes