METADATA 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. Metadata-Version: 2.0
  2. Name: huey
  3. Version: 1.10.4
  4. Summary: huey, a little task queue
  5. Home-page: http://github.com/coleifer/huey/
  6. Author: Charles Leifer
  7. Author-email: coleifer@gmail.com
  8. License: UNKNOWN
  9. Platform: UNKNOWN
  10. Classifier: Development Status :: 4 - Beta
  11. Classifier: Environment :: Web Environment
  12. Classifier: Intended Audience :: Developers
  13. Classifier: License :: OSI Approved :: MIT License
  14. Classifier: Operating System :: OS Independent
  15. Classifier: Programming Language :: Python
  16. Provides-Extra: backends
  17. Requires-Dist: peewee; extra == 'backends'
  18. Requires-Dist: redis; extra == 'backends'
  19. Requires-Dist: simpledb; extra == 'backends'
  20. Provides-Extra: redis
  21. Requires-Dist: redis; extra == 'redis'
  22. Provides-Extra: simpledb
  23. Requires-Dist: simpledb; extra == 'simpledb'
  24. Provides-Extra: sqlite
  25. Requires-Dist: peewee; extra == 'sqlite'
  26. huey - a little task queue
  27. ==========================
  28. .. image:: http://media.charlesleifer.com/blog/photos/huey-logo.png
  29. a lightweight alternative.
  30. * written in python (2.7+, 3.4+)
  31. * optional dependency on the Python Redis client
  32. supports:
  33. * multi-process, multi-thread or greenlet task execution models
  34. * schedule tasks to execute at a given time, or after a given delay
  35. * schedule recurring tasks, like a crontab
  36. * retry tasks that fail automatically
  37. * task result storage
  38. * task locking
  39. * task pipelines and chains
  40. .. image:: http://i.imgur.com/2EpRs.jpg
  41. .. image:: https://api.travis-ci.org/coleifer/huey.svg?branch=master
  42. Huey's API
  43. ----------
  44. .. code-block:: python
  45. from huey import RedisHuey, crontab
  46. huey = RedisHuey('my-app', host='redis.myapp.com')
  47. @huey.task()
  48. def add_numbers(a, b):
  49. return a + b
  50. @huey.periodic_task(crontab(minute='0', hour='3'))
  51. def nightly_backup():
  52. sync_all_data()
  53. To run the consumer with 4 worker processes:
  54. .. code-block:: console
  55. $ huey_consumer.py my_app.huey -k process -w 4
  56. To enqueue a task to add two numbers and print the result:
  57. .. code-block:: python
  58. res = add_numbers(1, 2) # Enqueues task.
  59. print(res.get()) # Prints "3".
  60. To schedule two numbers to be added in 10 seconds:
  61. .. code-block:: python
  62. res = add_numbers.schedule(args=(1, 2), delay=10)
  63. # Attempt to get result without blocking.
  64. print(res.get(False)) # returns None.
  65. # Block until result is ready and print.
  66. print(res.get()) # after 10 seconds, prints "3".
  67. Brokers
  68. -------
  69. To use Huey with Redis (**recommended**):
  70. .. code-block:: python
  71. from huey import RedisHuey
  72. huey = RedisHuey()
  73. To use Huey with SQLite (`docs <http://huey.readthedocs.io/en/latest/contrib.html#sqlite-storage>`_):
  74. .. code-block:: python
  75. from huey.contrib.sqlitedb import SqliteHuey
  76. huey = SqliteHuey('my-app-queue.db')
  77. To run Huey within the parent process using background greenlets (`docs <http://huey.readthedocs.io/en/latest/contrib.html#mini-huey>`_):
  78. .. code-block:: python
  79. from huey.contrib.minimal import MiniHuey
  80. huey = MiniHuey()
  81. huey.start() # Spawns scheduler background thread and returns immediately.
  82. To run Huey with a simple Python broker (**should not be used in production**),
  83. install `simpledb <https://github.com/coleifer/simpledb>`_ and run:
  84. .. code-block:: python
  85. from huey.contrib.simple_storage import SimpleHuey
  86. huey = SimpleHuey()
  87. # Be sure to run the Python broker process, e.g.:
  88. # $ python simpledb.py # Starts Python broker.
  89. Documentation
  90. ----------------
  91. `See Huey documentation <https://huey.readthedocs.io/>`_.
  92. Project page
  93. ---------------
  94. `See source code and issue tracker on Github <https://github.com/coleifer/huey/>`_.
  95. Huey is named in honor of my cat:
  96. .. image:: http://m.charlesleifer.com/t/800x-/blog/photos/p1473037658.76.jpg?key=mD9_qMaKBAuGPi95KzXYqg