diff options
Diffstat (limited to 'python-dramatiq-pg.spec')
| -rw-r--r-- | python-dramatiq-pg.spec | 347 |
1 files changed, 347 insertions, 0 deletions
diff --git a/python-dramatiq-pg.spec b/python-dramatiq-pg.spec new file mode 100644 index 0000000..bbdbd69 --- /dev/null +++ b/python-dramatiq-pg.spec @@ -0,0 +1,347 @@ +%global _empty_manifest_terminate_build 0 +Name: python-dramatiq-pg +Version: 0.11.0 +Release: 1 +Summary: Postgres Broker for Dramatiq Task Queue +License: PostgreSQL +URL: https://gitlab.com/dalibo/dramatiq-pg +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/74/5e/5b663bf7841ca64315d3e7b54e2c393064c77e729f00f7e2267610bf6429/dramatiq-pg-0.11.0.tar.gz +BuildArch: noarch + +Requires: python3-dramatiq +Requires: python3-tenacity + +%description + + +[Dramatiq](https://dramatiq.io/) is a simple task queue implementation for +Python3. dramatiq-pg provides a Postgres-based implementation of a dramatiq +broker. + + +## Features + +- Super simple deployment: Single table, no ORM. +- Stores message payload and results as native JSONb. +- Uses LISTEN/NOTIFY to keep worker sync. No polling. +- Implements delayed task. +- Reliable thanks to Postgres MVCC. +- Self-healing: automatic purge of old messages. Automatic recovery after + crash. +- Utility CLI for maintainance: flush, purge, stats, etc. + +Note that dramatiq assumes tasks are idempotent. This broker makes the same +assumptions for recovering after a crash. + + +## Installation + +- Install dramatiq-pg package from PyPI: + ``` console + $ pip install dramatiq-pg psycopg2-binary + ``` + Ensure you have either psycopg2 or psycopg2-binary installed. +- Init database schema with `init` command. + ``` console + $ dramatiq-pg init + ``` + Or adapt `dramatiq-pg/schema.sql` to your needs. +- Before importing actors, define global broker with a connection + pool: + ``` python + import dramatiq + import psycopg2.pool + from dramatiq_pg import PostgresBroker + + dramatiq.set_broker(PostgresBroker(i)) + + @dramatiq.actor + def myactor(): + ... + ``` + +Now declare/import actors and manage worker just like any [dramatiq +setup](https://dramatiq.io/guide.html). An [example +script](https://gitlab.com/dalibo/dramatiq-pg/blob/master/example.py) is +available, tested on CI. + +The CLI tool `dramatiq-pg` allows you to requeue messages, purge old messages +and show stats on the queue. See `--help` for details. + +[Dramatiq-pg +documentation](https://gitlab.com/dalibo/dramatiq-pg/blob/master/docs/index.rst) +is hosted on GitLab and give you more details on deployment and operation of +Postgres as a Dramatiq broker. + + +## Integration + +**Django** : Use +[django-dramatiq-pg](https://github.com/uptick/django-dramatiq-pg/) by [Curtis +Maloney](https://gitlab.com/FunkyBob). It includes configuration, ORM model and +database migration. + + +## Support + +If you encounter a bug or miss a feature, please [open an issue on +GitLab](https://gitlab.com/dalibo/dramatiq-pg/issues/new) with as much +information as possible. + +dramatiq_pg is available under the PostgreSQL licence. + + +## Credit + +Thanks to all contributors : + +- Andy Freeland +- Curtis Maloney, Django support. +- Federico Caselli, bugfixes. +- Giuseppe Papallo, bugfixes. +- Rafal Kwasny, improvements. + + +The logo is a creation of [Damien CAZEILS](http://www.damiencazeils.com/) + + +%package -n python3-dramatiq-pg +Summary: Postgres Broker for Dramatiq Task Queue +Provides: python-dramatiq-pg +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-dramatiq-pg + + +[Dramatiq](https://dramatiq.io/) is a simple task queue implementation for +Python3. dramatiq-pg provides a Postgres-based implementation of a dramatiq +broker. + + +## Features + +- Super simple deployment: Single table, no ORM. +- Stores message payload and results as native JSONb. +- Uses LISTEN/NOTIFY to keep worker sync. No polling. +- Implements delayed task. +- Reliable thanks to Postgres MVCC. +- Self-healing: automatic purge of old messages. Automatic recovery after + crash. +- Utility CLI for maintainance: flush, purge, stats, etc. + +Note that dramatiq assumes tasks are idempotent. This broker makes the same +assumptions for recovering after a crash. + + +## Installation + +- Install dramatiq-pg package from PyPI: + ``` console + $ pip install dramatiq-pg psycopg2-binary + ``` + Ensure you have either psycopg2 or psycopg2-binary installed. +- Init database schema with `init` command. + ``` console + $ dramatiq-pg init + ``` + Or adapt `dramatiq-pg/schema.sql` to your needs. +- Before importing actors, define global broker with a connection + pool: + ``` python + import dramatiq + import psycopg2.pool + from dramatiq_pg import PostgresBroker + + dramatiq.set_broker(PostgresBroker(i)) + + @dramatiq.actor + def myactor(): + ... + ``` + +Now declare/import actors and manage worker just like any [dramatiq +setup](https://dramatiq.io/guide.html). An [example +script](https://gitlab.com/dalibo/dramatiq-pg/blob/master/example.py) is +available, tested on CI. + +The CLI tool `dramatiq-pg` allows you to requeue messages, purge old messages +and show stats on the queue. See `--help` for details. + +[Dramatiq-pg +documentation](https://gitlab.com/dalibo/dramatiq-pg/blob/master/docs/index.rst) +is hosted on GitLab and give you more details on deployment and operation of +Postgres as a Dramatiq broker. + + +## Integration + +**Django** : Use +[django-dramatiq-pg](https://github.com/uptick/django-dramatiq-pg/) by [Curtis +Maloney](https://gitlab.com/FunkyBob). It includes configuration, ORM model and +database migration. + + +## Support + +If you encounter a bug or miss a feature, please [open an issue on +GitLab](https://gitlab.com/dalibo/dramatiq-pg/issues/new) with as much +information as possible. + +dramatiq_pg is available under the PostgreSQL licence. + + +## Credit + +Thanks to all contributors : + +- Andy Freeland +- Curtis Maloney, Django support. +- Federico Caselli, bugfixes. +- Giuseppe Papallo, bugfixes. +- Rafal Kwasny, improvements. + + +The logo is a creation of [Damien CAZEILS](http://www.damiencazeils.com/) + + +%package help +Summary: Development documents and examples for dramatiq-pg +Provides: python3-dramatiq-pg-doc +%description help + + +[Dramatiq](https://dramatiq.io/) is a simple task queue implementation for +Python3. dramatiq-pg provides a Postgres-based implementation of a dramatiq +broker. + + +## Features + +- Super simple deployment: Single table, no ORM. +- Stores message payload and results as native JSONb. +- Uses LISTEN/NOTIFY to keep worker sync. No polling. +- Implements delayed task. +- Reliable thanks to Postgres MVCC. +- Self-healing: automatic purge of old messages. Automatic recovery after + crash. +- Utility CLI for maintainance: flush, purge, stats, etc. + +Note that dramatiq assumes tasks are idempotent. This broker makes the same +assumptions for recovering after a crash. + + +## Installation + +- Install dramatiq-pg package from PyPI: + ``` console + $ pip install dramatiq-pg psycopg2-binary + ``` + Ensure you have either psycopg2 or psycopg2-binary installed. +- Init database schema with `init` command. + ``` console + $ dramatiq-pg init + ``` + Or adapt `dramatiq-pg/schema.sql` to your needs. +- Before importing actors, define global broker with a connection + pool: + ``` python + import dramatiq + import psycopg2.pool + from dramatiq_pg import PostgresBroker + + dramatiq.set_broker(PostgresBroker(i)) + + @dramatiq.actor + def myactor(): + ... + ``` + +Now declare/import actors and manage worker just like any [dramatiq +setup](https://dramatiq.io/guide.html). An [example +script](https://gitlab.com/dalibo/dramatiq-pg/blob/master/example.py) is +available, tested on CI. + +The CLI tool `dramatiq-pg` allows you to requeue messages, purge old messages +and show stats on the queue. See `--help` for details. + +[Dramatiq-pg +documentation](https://gitlab.com/dalibo/dramatiq-pg/blob/master/docs/index.rst) +is hosted on GitLab and give you more details on deployment and operation of +Postgres as a Dramatiq broker. + + +## Integration + +**Django** : Use +[django-dramatiq-pg](https://github.com/uptick/django-dramatiq-pg/) by [Curtis +Maloney](https://gitlab.com/FunkyBob). It includes configuration, ORM model and +database migration. + + +## Support + +If you encounter a bug or miss a feature, please [open an issue on +GitLab](https://gitlab.com/dalibo/dramatiq-pg/issues/new) with as much +information as possible. + +dramatiq_pg is available under the PostgreSQL licence. + + +## Credit + +Thanks to all contributors : + +- Andy Freeland +- Curtis Maloney, Django support. +- Federico Caselli, bugfixes. +- Giuseppe Papallo, bugfixes. +- Rafal Kwasny, improvements. + + +The logo is a creation of [Damien CAZEILS](http://www.damiencazeils.com/) + + +%prep +%autosetup -n dramatiq-pg-0.11.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-dramatiq-pg -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.11.0-1 +- Package Spec generated |
