Date: Wed, 10 May 2023 14:59:00 GMT From: Dan Langille <dvl@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: e1fbe719d425 - main - devel/py-celery-singleton: New port Message-ID: <202305101459.34AEx0MI036926@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by dvl: URL: https://cgit.FreeBSD.org/ports/commit/?id=e1fbe719d4258ee0106c22dc5a4189cf050148c4 commit e1fbe719d4258ee0106c22dc5a4189cf050148c4 Author: Dan Langille <dvl@FreeBSD.org> AuthorDate: 2023-05-10 14:57:16 +0000 Commit: Dan Langille <dvl@FreeBSD.org> CommitDate: 2023-05-10 14:58:56 +0000 devel/py-celery-singleton: New port Prevent duplicate celery tasks. --- devel/Makefile | 1 + devel/py-celery-singleton/Makefile | 20 ++++++++++++++++++++ devel/py-celery-singleton/Makefile.new | 21 +++++++++++++++++++++ devel/py-celery-singleton/distinfo | 3 +++ devel/py-celery-singleton/pkg-descr | 22 ++++++++++++++++++++++ 5 files changed, 67 insertions(+) diff --git a/devel/Makefile b/devel/Makefile index 3c943afce144..1195b1661e86 100644 --- a/devel/Makefile +++ b/devel/Makefile @@ -4402,6 +4402,7 @@ SUBDIR += py-cdg SUBDIR += py-celery SUBDIR += py-celery-progress + SUBDIR += py-celery-singleton SUBDIR += py-cerberus SUBDIR += py-certsrv SUBDIR += py-cffi diff --git a/devel/py-celery-singleton/Makefile b/devel/py-celery-singleton/Makefile new file mode 100644 index 000000000000..1db65012b67e --- /dev/null +++ b/devel/py-celery-singleton/Makefile @@ -0,0 +1,20 @@ +PORTNAME= celery-singleton +PORTVERSION= 0.3.1 +CATEGORIES= devel python +MASTER_SITES= PYPI +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= dvl@FreeBSD.org +COMMENT= Prevent duplicate celery tasks +WWW= https://github.com/steinitzu/celery-singleton + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}redis>0:databases/py-redis@${PY_FLAVOR} + +USES= python:3.6+,run +USE_PYTHON= autoplist distutils +NO_ARCH= yes + +.include <bsd.port.mk> diff --git a/devel/py-celery-singleton/Makefile.new b/devel/py-celery-singleton/Makefile.new new file mode 100644 index 000000000000..4efec4571419 --- /dev/null +++ b/devel/py-celery-singleton/Makefile.new @@ -0,0 +1,21 @@ +PORTNAME= celery-singleton +PORTVERSION= 0.3.1 +PORTREVISION= 1 +CATEGORIES= devel python +MASTER_SITES= PYPI +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= dvl@FreeBSD.org +COMMENT= Prevent duplicate celery tasks +WWW= https://github.com/steinitzu/celery-singleton + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}redis>0:databases/py-redis@${PY_FLAVOR} + +USES= python:3.6+,run +USE_PYTHON= autoplist distutils +NO_ARCH= yes + +.include <bsd.port.mk> diff --git a/devel/py-celery-singleton/distinfo b/devel/py-celery-singleton/distinfo new file mode 100644 index 000000000000..4d68b5c9b10d --- /dev/null +++ b/devel/py-celery-singleton/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1683049934 +SHA256 (celery-singleton-0.3.1.tar.gz) = 260ce4978e631f8682ea0ccb03d7f3b87d42bc20e04e9bd46ddb78a2f8035d1e +SIZE (celery-singleton-0.3.1.tar.gz) = 4659 diff --git a/devel/py-celery-singleton/pkg-descr b/devel/py-celery-singleton/pkg-descr new file mode 100644 index 000000000000..178c480c3288 --- /dev/null +++ b/devel/py-celery-singleton/pkg-descr @@ -0,0 +1,22 @@ +celery-singleton uses the JSON representation of a task's delay() or +apply_async() arguments to generate a unique lock and stores it in redis. By +default it uses the redis server of the celery result backend. If you use a +different/no result backend or want to use a different redis server for +celery-singleton, refer the configuration section for how to customize the +redis. + +import time +from celery_singleton import Singleton +from somewhere import celery_app + +@celery_app.task(base=Singleton) +def do_stuff(*args, **kwargs): + time.sleep(4) + return 'I just woke up' + +# run the task as normal +async_result = do_stuff.delay(1, 2, 3, a='b') +async_result2 = do_stuff.delay(1, 2, 3, a='b') + +# These are the same, task is only queued once +assert async_result == async_result2
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202305101459.34AEx0MI036926>