Celery service task
Classe permettant d'implémenter une tâche pour un worker Celery spécifique
Usage
# import
from celery_service_task.task import TaskBase
# implémentation d'une tâche simple
class Task(TaskBase):
def task(self, payload: Dict[str, Any], meta: MessageMetadata) -> bool:
print(self.conf) # la configuration est donnée par le worker Celery
print(payload) # le payload est déjà sous forme d'un dictionnaire
print(payload['transaction_id']) # identifiant de la transaction issue du payload
print(meta)
# Initialisation de la classe avec une configuration
t = Task(
conf={'token': 'tk'},
redis=redis_connection,
redis_key=redis_task_key
)
# lance la tâche si l'id de transaction n'est pas déjà enregistré
# Ici la tâche se lance
t.run_task(
payload=payload,
meta=metadata,
t_id=payload['transaction_id']
)
# Ici la tâche est considérée comme un replica
t.run_task(
payload=payload,
meta=metadata,
t_id=payload['transaction_id']
)
Release files for celery-service-task 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| celery_service_task-0.9.0.tar.gz | 2.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| celery_service_task-0.9.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.3 kB
Release files / celery_service_task-0.9.0.tar.gz
| Download URL | celery_service_task-0.9.0.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7668ddc8789d4f77d76720e8aff43ac255ca12025dd9445e23578c77fd9ad8b
|
|
BLAKE2b-256 checksum How to use checksums |
ebda148dd432585ee0579a9e2edb55cedd8ca3704da235f12ba3ee748ffe930e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
|
Release files / celery_service_task-0.9.0-py3-none-any.whl
| Download URL | celery_service_task-0.9.0-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
01484ba21c9f96b92aa36bfede9a083cdb67dfb81693dc9867d98858cb18f3fc
|
|
BLAKE2b-256 checksum How to use checksums |
7c3d1147a36da3c90f8354ef415a60ffb3ec1d1668d5289e1d034d4d5aaf4e28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
|