Asynchronous Tasks
Celery tasks of the provider app, and how everything else queues them.
verify: verify a Provider and its models.queue: thequeue_*functions, the one place that queues these tasks (ADR-030, rule 10, issue #1098).
The package exports the queue_* functions, never a task. Importing queue imports the task module, so that
Celery registers its tasks. Each task names itself smarter.apps.provider.tasks.<function>
(TASK_NAME_PREFIX). Anything else, e.g. a task that a test runs, is imported from
its own module.
- smarter.apps.provider.tasks.queue_verify_provider(provider)[source]
Queue
verify_provider(), which runs a provider’s test bank.The
provider_verification_requestedreceiver calls it, e.g. whenProvider.verify()is called.
- smarter.apps.provider.tasks.queue_verify_provider_model(provider_model)[source]
Queue
verify_provider_model(), which runs a provider model’s test bank.The
model_verification_requestedreceiver calls it, e.g. when a ProviderModel is created.- Parameters:
provider_model (
ProviderModel) – The ProviderModel.- Return type:
Queueing the Tasks
The one place that queues the provider app’s Celery tasks.
Every task of the app is queued by a function of this module, never by <task>.delay() or
<task>.apply_async() anywhere else (ADR-030, rule 10, issue #1098). So this module is where to look for what
queues a task, and the one place that a test patches so that nothing reaches a real worker. Each function queues
its task once the current transaction commits, so that the worker finds the row it verifies.
- smarter.apps.provider.tasks.queue.queue_verify_provider(provider)[source]
Queue
verify_provider(), which runs a provider’s test bank.The
provider_verification_requestedreceiver calls it, e.g. whenProvider.verify()is called.
- smarter.apps.provider.tasks.queue.queue_verify_provider_model(provider_model)[source]
Queue
verify_provider_model(), which runs a provider model’s test bank.The
model_verification_requestedreceiver calls it, e.g. when a ProviderModel is created.- Parameters:
provider_model (
ProviderModel) – The ProviderModel.- Return type:
Verification
Celery tasks that verify a Provider and its models, with their test banks.
Each is queued by a function of smarter.apps.provider.tasks.queue, never with .delay() (ADR-030, rule 10).