TopGit theo dõi coleifer/huey trên GitHub trong nhóm Backend, đã đạt 6.1k sao. a little task queue for python
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
support for redis (or valkey/redict), postgres, sqlite, file-system, or in-memory storage
zero dependencies (redis-py required to use redis-like brokers,
psycopg for postgres).
example code <https://github.com/coleifer/huey/tree/master/examples/>_.
django <https://huey.readthedocs.io/en/latest/contrib.html#django>_ integration (native or via django.tasks)
with admin integration for visibility and management.
documentation <https://huey.readthedocs.io/>_.
huey supports:
multi-process, multi-thread or greenlet task execution models
schedule tasks to execute at a given time, or after a given delay
schedule recurring tasks, like a crontab
automatically retry tasks that fail
task prioritization
task result storage
task expiration
task locking, rate-limits and timeouts
task pipelines and chains
groups (fan-out), chords (map / reduce)
.. image:: https://i.imgur.com/2EpRs.jpg
At a glance
.. code-block:: python
from huey import RedisHuey, crontab
# Or PostgresHuey, SqliteHuey, FileHuey, etc...
huey = RedisHuey('my-app', host='redis.myapp.com')
@huey.task()
def add_numbers(a, b):
return a + b
@huey.task(retries=2, retry_delay=60)
def flaky_task(url):
# This task might fail, in which case it will be retried up to 2 times
# with a delay of 60s between retries.
return this_might_fail(url)
@huey.periodic_task(crontab(minute='0', hour='3'))
def nightly_backup():
sync_all_data()
Calling a task-decorated function will enqueue the function call for
execution by the consumer. A special result handle is returned immediately,
which can be used to fetch the result once the task is finished:
.. code-block:: pycon
>>> from demo import add_numbers
>>> res = add_numbers(1, 2)
>>> res
<Result: task 6b6f36fc-da0d-4069-b46c-c0d4ccff1df6>
>>> res()
3
Tasks can be scheduled to run in the future:
.. code-block:: pycon
>>> res = add_numbers.schedule((2, 3), delay=10) # Will be run in ~10s.
>>> res(blocking=True) # Will block until task finishes, in ~10s.
5
For much more, check out the guide <https://huey.readthedocs.io/en/latest/guide.html>_
or take a look at the example code <https://github.com/coleifer/huey/tree/master/examples/>_.
Running the consumer
^^^^^^^^^^^^^^^^^^^^
Run the consumer with four worker processes:
.. code-block:: console
$ huey_consumer my_app.huey -k process -w 4
To run the consumer with a single worker thread (default):
.. code-block:: console
$ huey_consumer my_app.huey
If your work-loads are mostly IO-bound, you can run the consumer with threads
or greenlets instead. Because greenlets are so lightweight, you can run quite a
few of them efficiently:
.. code-block:: console
$ huey_consumer my_app.huey -k greenlet -w 32
Storage
Huey's design and feature-set were informed by the capabilities of the
Redis <https://redis.io>_ database. Redis is a fantastic fit for a
lightweight task queueing library like Huey: it's self-contained, versatile,
and can be a multi-purpose solution for other web-application tasks like
caching, event publishing, analytics, rate-limiting, and more.
Although Huey was designed with Redis in mind, the storage system implements a
simple API and many other tools could be used instead of Redis if that's your
preference.
Huey comes with builtin support for Redis, Postgres, Sqlite, File-system, and
in-memory storage.
Frameworks
Huey provides Django integration either natively or via django.tasks. Huey
also provides an optional admin integration for Django:
Other frameworks can use the stats <https://huey.readthedocs.io/en/latest/contrib.html#task-statistics>_
extension to collect and display this information.
Documentation
See Huey documentation <https://huey.readthedocs.io/>_.
Project page
See source code and issue tracker on Github <https://github.com/coleifer/huey/>_.
coleifer/huey có 6.1k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/coleifer/huey. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
coleifer/huey có những chủ đề gì?
GitHub topics của coleifer/huey: "dank", "django", "python", "queue", "redis", "task-queue". TopGit xếp repo vào nhóm Backend.
coleifer/huey có trang demo không?
Dự án có trang chủ ở https://huey.readthedocs.io/. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
coleifer/huey còn đang phát triển không?
Commit gần nhất trên coleifer/huey là 3 tháng trước (theo timestamp GitHub). Repo có 407 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
coleifer/huey dùng license gì?
coleifer/huey phát hành theo license MIT. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
coleifer/huey viết bằng ngôn ngữ gì?
coleifer/huey chủ yếu viết bằng Python. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc thêm về coleifer/huey ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/coleifer/huey là nguồn chính thức.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về huey?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về huey.