Skip to main content

No project description provided

Project description

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']
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

celery_service_task-0.9.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

celery_service_task-0.9.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file celery_service_task-0.9.0.tar.gz.

File metadata

  • Download URL: celery_service_task-0.9.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for celery_service_task-0.9.0.tar.gz
Algorithm Hash digest
SHA256 b7668ddc8789d4f77d76720e8aff43ac255ca12025dd9445e23578c77fd9ad8b
MD5 0bb04456fe333398f0d378e8929ada5b
BLAKE2b-256 ebda148dd432585ee0579a9e2edb55cedd8ca3704da235f12ba3ee748ffe930e

See more details on using hashes here.

File details

Details for the file celery_service_task-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: celery_service_task-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for celery_service_task-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01484ba21c9f96b92aa36bfede9a083cdb67dfb81693dc9867d98858cb18f3fc
MD5 deb304e67b0204509faa228b51abf34e
BLAKE2b-256 7c3d1147a36da3c90f8354ef415a60ffb3ec1d1668d5289e1d034d4d5aaf4e28

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page