Celery stubs
This is a small library for client side function stubs for celery.
The name stubs does not refer to the testing aspect but rather to a proxy behavior coming from the stub / skeleton pattern known from remote method invocations. At celery, there is no need to create a skeleton, since this is handled by the middleware.
The stubs approach uses the send_task to schedule a remote task for execution. Since the stub does not know the arguments to apply, this is the part of the blueprint method.
Example
## Server
@app.task(name="calculate_sum")
def sum(a, b):
return a + b
## Client
# Proxy Definition
class _CalculateSumTask(celery_client_stubs.AsyncRemoteTask):
def __init__(self, celery, *args):
super().__init__("calculate_sum", celery, *args)
def celery_sum(celery, a, b):
return _CalculateSumTask(celery, a, b)
# Definition of methods
app = Celery(...)
...
def sum(a, b):
return celery_sum(app, a, b)
# Usage
async_result = sum(1, 2).schedule_immediately()
# Wait for method to complete ...
Task Factory
The class itself provides an RemoteTaskFactory, that can be used:
# Definition
class MyRemoteTasks(celery_client_stubs.RemoteTaskFactory):
def sum(self, a, b):
task = celery.AsyncRemoteTask("calculate_sum", self._celery, a, b)
return task
# Usage
app = Celery(...)
tasks = MyRemoteTasks(app)
async_result = tasks.sum(1, 2).schedule_immediately()
Licensing
This library is published under BSD-3-Clause license, just like Celery is.
Versioning
This library follows semantic versioning 2.0. Any breaking change will produce a new major release. Versions below 1.0 are considered to have a unstable interface.
Metadata
Release files for celery-client-stubs 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| celery_client_stubs-0.7.1.tar.gz | 4.9 kB | Without provenance | Details for celery_client_stubs-0.7.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| celery_client_stubs-0.7.1-py3-none-any.whl | Python 3 | none | any | Details for celery_client_stubs-0.7.1-py3-none-any.whl |
Total release size: 9.8 kB
Release files / celery_client_stubs-0.7.1.tar.gz
| Download URL | celery_client_stubs-0.7.1.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
613a00f88aff8a217600c995c8db53c3a0fc5f4736f8486c457c3b93f22a8e33
|
|
BLAKE2b-256 checksum How to use checksums |
6e2415bc281380e41e6dac40b811f13ef377a5569e8018b886fbd1a4ffbf8ca7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
|
Release files / celery_client_stubs-0.7.1-py3-none-any.whl
| Download URL | celery_client_stubs-0.7.1-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2fc62877fa1b25abca5d24b1cf1f219176fa3a84b98f9932256a92d2e125367
|
|
BLAKE2b-256 checksum How to use checksums |
defbc15f60adfabb085fa284aa911209012744721fa3698256edc974a4c53fd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
|
Security for celery-client-stubs 0.7.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.