Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joegasewicz/pytask-io
Python Async Task Queue
https://github.com/joegasewicz/pytask-io
asyncio coroutines redis task-manager task-queue wsgi
Last synced: 14 days ago
JSON representation
Python Async Task Queue
- Host: GitHub
- URL: https://github.com/joegasewicz/pytask-io
- Owner: joegasewicz
- License: mit
- Created: 2019-11-06T16:46:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-15T18:47:25.000Z (4 months ago)
- Last Synced: 2024-09-17T20:30:35.769Z (about 2 months ago)
- Topics: asyncio, coroutines, redis, task-manager, task-queue, wsgi
- Language: Python
- Homepage:
- Size: 6.2 MB
- Stars: 91
- Watchers: 2
- Forks: 5
- Open Issues: 30
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
![PyPI](https://img.shields.io/pypi/v/pytask-io)
![Read the Docs](https://img.shields.io/readthedocs/pytask-io)
![GitHub](https://img.shields.io/github/license/joegasewicz/pytask_io)Asynchronous Tasks Library using asyncio
An Asyncio based task queue that is designed to be super easy to use!
Read the docs: [Documentation](https://pytask-io.readthedocs.io/en/latest/)
![PyTask IO](assets/Group.png?raw=true "Title")
## Install
```bash
pip install pytask-iodocker run redis # Rabbit MQ coming soon...
```
### Usage
```python
from pytask_io import PyTaskIO
# Starts the task runner
pytask = PytaskIO(
store_port=6379,
store_host="localhost",
db=0,
workers=1,
)
# Start the PytaskIO task queue on a separate thread.
pytask.run()
# Handle a long running process, in this case a send email function
metadata = pytask.add_task(send_email, title, body)
# Try once to get the results of your email sometime in the future
result = pytask.get_task(metadata)
# Later we can use the `metadata` result to pass to `add_task`
result = pytask.poll_for_task(metadata, tries=100, interval=60)
# Stop PytaskIO completely (This will not affect any units of work that haven't yet executed)
pytask.stop()```
### Compatible task types
PyTaskIO will always return back the task meta data.
Do not embed Python objects of type frame, generator, traceback & context objects.
In this case you will get back the exception thrown when PyTaskIO attempts to execute the serialization.## Authors
* **joegasewicz** - *Initial work* - [@joegasewicz](https://twitter.com/joegasewicz)
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)