taskferry-celery 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {taskferry_celery-0.1.0 → taskferry_celery-0.2.0}/CHANGELOG.md +16 -0
- taskferry_celery-0.2.0/PKG-INFO +131 -0
- taskferry_celery-0.2.0/README.md +103 -0
- {taskferry_celery-0.1.0 → taskferry_celery-0.2.0}/pyproject.toml +3 -1
- {taskferry_celery-0.1.0 → taskferry_celery-0.2.0}/src/taskferry_celery/backend.py +46 -6
- taskferry_celery-0.1.0/PKG-INFO +0 -87
- taskferry_celery-0.1.0/README.md +0 -63
- {taskferry_celery-0.1.0 → taskferry_celery-0.2.0}/.gitignore +0 -0
- {taskferry_celery-0.1.0 → taskferry_celery-0.2.0}/LICENSE +0 -0
- {taskferry_celery-0.1.0 → taskferry_celery-0.2.0}/src/taskferry_celery/__init__.py +0 -0
- {taskferry_celery-0.1.0 → taskferry_celery-0.2.0}/src/taskferry_celery/message.py +0 -0
- {taskferry_celery-0.1.0 → taskferry_celery-0.2.0}/src/taskferry_celery/py.typed +0 -0
- {taskferry_celery-0.1.0 → taskferry_celery-0.2.0}/src/taskferry_celery/worker.py +0 -0
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
Follows [Semantic Versioning](https://semver.org/); versions independently of the
|
|
4
4
|
rest of the family.
|
|
5
5
|
|
|
6
|
+
## Unreleased
|
|
7
|
+
|
|
8
|
+
## [0.2.0] — 2026-11-26
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Advertise `RESULT` only when the configured Celery app has a result backend,
|
|
13
|
+
and read successful values and failures from that backend.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- A `redis` extra for deployments that choose Redis as Celery broker or result
|
|
18
|
+
backend. Celery and Redis remain optional dependencies.
|
|
19
|
+
- A `rabbitmq` convenience extra; RabbitMQ uses Celery's built-in AMQP transport
|
|
20
|
+
and does not add a separate provider dependency.
|
|
21
|
+
|
|
6
22
|
## [0.1.0]
|
|
7
23
|
|
|
8
24
|
### Added
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: taskferry-celery
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Celery task backend for Taskferry — enqueue Taskferry tasks onto a Celery app.
|
|
5
|
+
Project-URL: Homepage, https://github.com/xiidigital/taskferry
|
|
6
|
+
Project-URL: Documentation, https://taskferry.dev
|
|
7
|
+
Project-URL: Source, https://github.com/xiidigital/taskferry
|
|
8
|
+
Author: Taskferry authors
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: celery,queue,taskferry,tasks
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.12
|
|
20
|
+
Requires-Dist: taskferry<0.3,>=0.2
|
|
21
|
+
Provides-Extra: celery
|
|
22
|
+
Requires-Dist: celery>=5.3; extra == 'celery'
|
|
23
|
+
Provides-Extra: rabbitmq
|
|
24
|
+
Requires-Dist: celery>=5.3; extra == 'rabbitmq'
|
|
25
|
+
Provides-Extra: redis
|
|
26
|
+
Requires-Dist: celery[redis]>=5.3; extra == 'redis'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# taskferry-celery
|
|
30
|
+
|
|
31
|
+
A **Celery** task backend for [Taskferry](https://taskferry.dev). Enqueue Taskferry
|
|
32
|
+
tasks onto a Celery app you already run; Taskferry supplies no worker and
|
|
33
|
+
reimplements none of Celery.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install taskferry-celery[celery]
|
|
37
|
+
# Optional Redis transport/result backend support:
|
|
38
|
+
pip install taskferry-celery[redis]
|
|
39
|
+
# Optional convenience alias when the Celery broker is RabbitMQ:
|
|
40
|
+
pip install taskferry-celery[rabbitmq]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Submitting
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from taskferry import Taskferry
|
|
47
|
+
|
|
48
|
+
runtime = Taskferry.from_mapping(
|
|
49
|
+
{
|
|
50
|
+
"backends": {"cel": {"factory": "celery", "app": "myapp.celery:app"}},
|
|
51
|
+
"defaults": {"task": "cel"},
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
runtime.tasks.submit("myapp.tasks:refresh", 42, queue="metadata")
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Executing (worker)
|
|
58
|
+
|
|
59
|
+
Register the dispatcher once, then run Celery's own worker:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from celery import Celery
|
|
63
|
+
from taskferry_celery import register_dispatcher
|
|
64
|
+
from taskferry.functions import FunctionRegistry
|
|
65
|
+
|
|
66
|
+
app = Celery("myapp", broker="redis://localhost:6379/0")
|
|
67
|
+
# Result storage is independent from the broker and optional.
|
|
68
|
+
app.conf.result_backend = "redis://localhost:6379/1"
|
|
69
|
+
app.conf.task_serializer = "json"
|
|
70
|
+
app.conf.result_serializer = "json"
|
|
71
|
+
app.conf.accept_content = ["json"]
|
|
72
|
+
register_dispatcher(app, registry=FunctionRegistry(allowed_modules=["myapp"]))
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
RabbitMQ uses Celery's built-in AMQP transport; the `rabbitmq` extra is a
|
|
76
|
+
convenience installation alias for Celery and does not install Redis or a
|
|
77
|
+
separate RabbitMQ client:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
app = Celery(
|
|
81
|
+
"myapp",
|
|
82
|
+
broker="amqp://taskferry:secret@rabbitmq:5672/myvhost",
|
|
83
|
+
backend="rpc://", # optional result store over AMQP; results are transient
|
|
84
|
+
)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
RabbitMQ as a broker does not by itself store task results. Configure a Celery
|
|
88
|
+
result backend separately if `TaskferryBackend.result()` is needed. The RPC
|
|
89
|
+
backend can avoid Redis for result delivery; Celery also supports database and
|
|
90
|
+
other result backends.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
celery -A myapp worker
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Capabilities (honest)
|
|
97
|
+
|
|
98
|
+
| Advertised | Conditional / unavailable | Why |
|
|
99
|
+
| --- | --- | --- |
|
|
100
|
+
| submit, state, cancel, delay, priority, retry | `result` only when `app.conf.result_backend` is set | Celery discards return values when result storage is disabled |
|
|
101
|
+
| | `deduplication` | Celery has no native mechanism — an `idempotency_key` is rejected, not ignored |
|
|
102
|
+
|
|
103
|
+
Retries are the **engine's**: the dispatcher raises Celery's own `self.retry`, so
|
|
104
|
+
a failed task is genuinely re-queued with the requested countdown. Taskferry never
|
|
105
|
+
loops in-process pretending to retry.
|
|
106
|
+
|
|
107
|
+
`state` maps Celery's `PENDING/STARTED/SUCCESS/FAILURE/RETRY/REVOKED` onto the
|
|
108
|
+
portable states. Set Celery's `task_track_started` if workers should persist the
|
|
109
|
+
`STARTED` state. Celery reports `PENDING` for both a queued task and an unknown
|
|
110
|
+
id, so those remain indistinguishable. `result()` reads Celery's configured
|
|
111
|
+
result backend; that can be Redis, a database or another Celery-supported store.
|
|
112
|
+
The Redis extra is optional, and Redis is not required as either broker or result
|
|
113
|
+
storage. The result store persists Celery's result, but Taskferry's own
|
|
114
|
+
Taskferry-id-to-Celery-id index is process-local. For cross-process lookups, keep
|
|
115
|
+
the Celery task id (`Execution.external_id`) and pass it to
|
|
116
|
+
`runtime.get(celery_id, backend="celery")`; a Django `TaskResult` lookup is not
|
|
117
|
+
provided by the bridge.
|
|
118
|
+
|
|
119
|
+
Delivery is at least once: workers can redeliver after a crash or lost ack. Make
|
|
120
|
+
handlers idempotent. Taskferry retry policy is translated to Celery retries, with
|
|
121
|
+
Celery as the sole retry owner. Revocation is best effort and cannot stop code
|
|
122
|
+
already running. Result backends store a task's final return/error; Taskferry does
|
|
123
|
+
not define a provider-neutral progress schema, so persist domain progress in your
|
|
124
|
+
application store.
|
|
125
|
+
|
|
126
|
+
Only JSON-safe arguments and a `"module:function"` name cross the wire — never a
|
|
127
|
+
pickled callable.
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
Apache-2.0.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# taskferry-celery
|
|
2
|
+
|
|
3
|
+
A **Celery** task backend for [Taskferry](https://taskferry.dev). Enqueue Taskferry
|
|
4
|
+
tasks onto a Celery app you already run; Taskferry supplies no worker and
|
|
5
|
+
reimplements none of Celery.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install taskferry-celery[celery]
|
|
9
|
+
# Optional Redis transport/result backend support:
|
|
10
|
+
pip install taskferry-celery[redis]
|
|
11
|
+
# Optional convenience alias when the Celery broker is RabbitMQ:
|
|
12
|
+
pip install taskferry-celery[rabbitmq]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Submitting
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from taskferry import Taskferry
|
|
19
|
+
|
|
20
|
+
runtime = Taskferry.from_mapping(
|
|
21
|
+
{
|
|
22
|
+
"backends": {"cel": {"factory": "celery", "app": "myapp.celery:app"}},
|
|
23
|
+
"defaults": {"task": "cel"},
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
runtime.tasks.submit("myapp.tasks:refresh", 42, queue="metadata")
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Executing (worker)
|
|
30
|
+
|
|
31
|
+
Register the dispatcher once, then run Celery's own worker:
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from celery import Celery
|
|
35
|
+
from taskferry_celery import register_dispatcher
|
|
36
|
+
from taskferry.functions import FunctionRegistry
|
|
37
|
+
|
|
38
|
+
app = Celery("myapp", broker="redis://localhost:6379/0")
|
|
39
|
+
# Result storage is independent from the broker and optional.
|
|
40
|
+
app.conf.result_backend = "redis://localhost:6379/1"
|
|
41
|
+
app.conf.task_serializer = "json"
|
|
42
|
+
app.conf.result_serializer = "json"
|
|
43
|
+
app.conf.accept_content = ["json"]
|
|
44
|
+
register_dispatcher(app, registry=FunctionRegistry(allowed_modules=["myapp"]))
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
RabbitMQ uses Celery's built-in AMQP transport; the `rabbitmq` extra is a
|
|
48
|
+
convenience installation alias for Celery and does not install Redis or a
|
|
49
|
+
separate RabbitMQ client:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
app = Celery(
|
|
53
|
+
"myapp",
|
|
54
|
+
broker="amqp://taskferry:secret@rabbitmq:5672/myvhost",
|
|
55
|
+
backend="rpc://", # optional result store over AMQP; results are transient
|
|
56
|
+
)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
RabbitMQ as a broker does not by itself store task results. Configure a Celery
|
|
60
|
+
result backend separately if `TaskferryBackend.result()` is needed. The RPC
|
|
61
|
+
backend can avoid Redis for result delivery; Celery also supports database and
|
|
62
|
+
other result backends.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
celery -A myapp worker
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Capabilities (honest)
|
|
69
|
+
|
|
70
|
+
| Advertised | Conditional / unavailable | Why |
|
|
71
|
+
| --- | --- | --- |
|
|
72
|
+
| submit, state, cancel, delay, priority, retry | `result` only when `app.conf.result_backend` is set | Celery discards return values when result storage is disabled |
|
|
73
|
+
| | `deduplication` | Celery has no native mechanism — an `idempotency_key` is rejected, not ignored |
|
|
74
|
+
|
|
75
|
+
Retries are the **engine's**: the dispatcher raises Celery's own `self.retry`, so
|
|
76
|
+
a failed task is genuinely re-queued with the requested countdown. Taskferry never
|
|
77
|
+
loops in-process pretending to retry.
|
|
78
|
+
|
|
79
|
+
`state` maps Celery's `PENDING/STARTED/SUCCESS/FAILURE/RETRY/REVOKED` onto the
|
|
80
|
+
portable states. Set Celery's `task_track_started` if workers should persist the
|
|
81
|
+
`STARTED` state. Celery reports `PENDING` for both a queued task and an unknown
|
|
82
|
+
id, so those remain indistinguishable. `result()` reads Celery's configured
|
|
83
|
+
result backend; that can be Redis, a database or another Celery-supported store.
|
|
84
|
+
The Redis extra is optional, and Redis is not required as either broker or result
|
|
85
|
+
storage. The result store persists Celery's result, but Taskferry's own
|
|
86
|
+
Taskferry-id-to-Celery-id index is process-local. For cross-process lookups, keep
|
|
87
|
+
the Celery task id (`Execution.external_id`) and pass it to
|
|
88
|
+
`runtime.get(celery_id, backend="celery")`; a Django `TaskResult` lookup is not
|
|
89
|
+
provided by the bridge.
|
|
90
|
+
|
|
91
|
+
Delivery is at least once: workers can redeliver after a crash or lost ack. Make
|
|
92
|
+
handlers idempotent. Taskferry retry policy is translated to Celery retries, with
|
|
93
|
+
Celery as the sole retry owner. Revocation is best effort and cannot stop code
|
|
94
|
+
already running. Result backends store a task's final return/error; Taskferry does
|
|
95
|
+
not define a provider-neutral progress schema, so persist domain progress in your
|
|
96
|
+
application store.
|
|
97
|
+
|
|
98
|
+
Only JSON-safe arguments and a `"module:function"` name cross the wire — never a
|
|
99
|
+
pickled callable.
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
Apache-2.0.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "taskferry-celery"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "Celery task backend for Taskferry — enqueue Taskferry tasks onto a Celery app."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12"
|
|
@@ -25,6 +25,8 @@ dependencies = ["taskferry>=0.2,<0.3"]
|
|
|
25
25
|
|
|
26
26
|
[project.optional-dependencies]
|
|
27
27
|
celery = ["celery>=5.3"]
|
|
28
|
+
redis = ["celery[redis]>=5.3"]
|
|
29
|
+
rabbitmq = ["celery>=5.3"]
|
|
28
30
|
|
|
29
31
|
[project.entry-points."taskferry.backends"]
|
|
30
32
|
celery = "taskferry_celery:make_backend"
|
|
@@ -27,11 +27,10 @@ Capabilities are advertised from what Celery genuinely does out of the box:
|
|
|
27
27
|
* ``STATE`` — through ``AsyncResult``;
|
|
28
28
|
* ``CANCEL`` — ``AsyncResult.revoke``.
|
|
29
29
|
|
|
30
|
-
``RESULT`` is
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
``idempotency_key`` is rejected here rather than accepted and ignored.
|
|
30
|
+
``RESULT`` is advertised only when the configured Celery app has a result
|
|
31
|
+
backend. ``DEDUPLICATION`` is not advertised: Celery has no native mechanism for
|
|
32
|
+
it, so a spec carrying an ``idempotency_key`` is rejected rather than accepted
|
|
33
|
+
and ignored.
|
|
35
34
|
|
|
36
35
|
A note on Celery's ``PENDING``: Celery reports ``PENDING`` both for a task that is
|
|
37
36
|
genuinely queued *and* for a task id it has never heard of. Taskferry maps
|
|
@@ -51,6 +50,7 @@ from taskferry.execution import (
|
|
|
51
50
|
Execution,
|
|
52
51
|
ExecutionId,
|
|
53
52
|
ExecutionKind,
|
|
53
|
+
ExecutionResult,
|
|
54
54
|
ExecutionState,
|
|
55
55
|
new_execution_id,
|
|
56
56
|
)
|
|
@@ -151,7 +151,23 @@ class CeleryTaskBackend(BaseBackend):
|
|
|
151
151
|
|
|
152
152
|
@property
|
|
153
153
|
def capabilities(self) -> CapabilitySet:
|
|
154
|
-
|
|
154
|
+
capabilities = set(CELERY_CAPABILITIES)
|
|
155
|
+
if self._has_result_backend():
|
|
156
|
+
capabilities.add(Capability.RESULT)
|
|
157
|
+
return CapabilitySet(capabilities, provider=self._name)
|
|
158
|
+
|
|
159
|
+
def _has_result_backend(self) -> bool:
|
|
160
|
+
"""Return whether this app has durable Celery result storage configured.
|
|
161
|
+
|
|
162
|
+
A broker (including Redis) does not imply a result backend. Celery's
|
|
163
|
+
disabled result backend silently discards return values, so RESULT is
|
|
164
|
+
advertised only when ``result_backend`` is set explicitly.
|
|
165
|
+
"""
|
|
166
|
+
if self._app is None:
|
|
167
|
+
return False
|
|
168
|
+
app = self.app()
|
|
169
|
+
conf = getattr(app, "conf", None)
|
|
170
|
+
return bool(getattr(conf, "result_backend", None))
|
|
155
171
|
|
|
156
172
|
# -- the app ---------------------------------------------------------------- #
|
|
157
173
|
def app(self) -> Any:
|
|
@@ -234,6 +250,30 @@ class CeleryTaskBackend(BaseBackend):
|
|
|
234
250
|
provider_metadata=ProviderMetadata(provider="celery", provider_id=task_id),
|
|
235
251
|
)
|
|
236
252
|
|
|
253
|
+
def _result(self, execution_id: ExecutionId, *, timeout: float | None) -> ExecutionResult:
|
|
254
|
+
"""Read the value/error from Celery's configured result store."""
|
|
255
|
+
async_result = self._result_handle(execution_id)
|
|
256
|
+
try:
|
|
257
|
+
value = async_result.get(timeout=timeout, propagate=False)
|
|
258
|
+
except Exception as exc:
|
|
259
|
+
# Backend/network errors are not task failures; preserve them for the
|
|
260
|
+
# caller rather than turning them into a successful empty result.
|
|
261
|
+
raise SubmissionError(
|
|
262
|
+
f"celery could not read result for {execution_id!r}: {exc}",
|
|
263
|
+
backend=self._name,
|
|
264
|
+
) from exc
|
|
265
|
+
|
|
266
|
+
state = map_state(getattr(async_result, "state", None))
|
|
267
|
+
if state is ExecutionState.FAILED:
|
|
268
|
+
return ExecutionResult(
|
|
269
|
+
error=str(value),
|
|
270
|
+
error_type=type(value).__qualname__,
|
|
271
|
+
traceback=getattr(async_result, "traceback", None),
|
|
272
|
+
)
|
|
273
|
+
if state is ExecutionState.CANCELLED:
|
|
274
|
+
return ExecutionResult.cancelled()
|
|
275
|
+
return ExecutionResult(value=value)
|
|
276
|
+
|
|
237
277
|
def _cancel(self, execution_id: ExecutionId) -> Execution:
|
|
238
278
|
async_result = self._result_handle(execution_id)
|
|
239
279
|
try:
|
taskferry_celery-0.1.0/PKG-INFO
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.5
|
|
2
|
-
Name: taskferry-celery
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: Celery task backend for Taskferry — enqueue Taskferry tasks onto a Celery app.
|
|
5
|
-
Project-URL: Homepage, https://github.com/xiidigital/taskferry
|
|
6
|
-
Project-URL: Documentation, https://taskferry.dev
|
|
7
|
-
Project-URL: Source, https://github.com/xiidigital/taskferry
|
|
8
|
-
Author: Taskferry authors
|
|
9
|
-
License-Expression: Apache-2.0
|
|
10
|
-
License-File: LICENSE
|
|
11
|
-
Keywords: celery,queue,taskferry,tasks
|
|
12
|
-
Classifier: Development Status :: 3 - Alpha
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
-
Classifier: Typing :: Typed
|
|
19
|
-
Requires-Python: >=3.12
|
|
20
|
-
Requires-Dist: taskferry<0.3,>=0.2
|
|
21
|
-
Provides-Extra: celery
|
|
22
|
-
Requires-Dist: celery>=5.3; extra == 'celery'
|
|
23
|
-
Description-Content-Type: text/markdown
|
|
24
|
-
|
|
25
|
-
# taskferry-celery
|
|
26
|
-
|
|
27
|
-
A **Celery** task backend for [Taskferry](https://taskferry.dev). Enqueue Taskferry
|
|
28
|
-
tasks onto a Celery app you already run; Taskferry supplies no worker and
|
|
29
|
-
reimplements none of Celery.
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
pip install taskferry-celery[celery]
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Submitting
|
|
36
|
-
|
|
37
|
-
```python
|
|
38
|
-
from taskferry import Taskferry
|
|
39
|
-
|
|
40
|
-
runtime = Taskferry.from_mapping(
|
|
41
|
-
{
|
|
42
|
-
"backends": {"cel": {"factory": "celery", "app": "myapp.celery:app"}},
|
|
43
|
-
"defaults": {"task": "cel"},
|
|
44
|
-
}
|
|
45
|
-
)
|
|
46
|
-
runtime.tasks.submit("myapp.tasks:refresh", 42, queue="metadata")
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Executing (worker)
|
|
50
|
-
|
|
51
|
-
Register the dispatcher once, then run Celery's own worker:
|
|
52
|
-
|
|
53
|
-
```python
|
|
54
|
-
from celery import Celery
|
|
55
|
-
from taskferry_celery import register_dispatcher
|
|
56
|
-
from taskferry.functions import FunctionRegistry
|
|
57
|
-
|
|
58
|
-
app = Celery("myapp", broker="redis://localhost:6379/0")
|
|
59
|
-
register_dispatcher(app, registry=FunctionRegistry(allowed_modules=["myapp"]))
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
celery -A myapp worker
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Capabilities (honest)
|
|
67
|
-
|
|
68
|
-
| Advertised | Not advertised | Why not |
|
|
69
|
-
| --- | --- | --- |
|
|
70
|
-
| submit, state, cancel, delay, priority, retry | `result` | needs a configured result backend Taskferry can't see |
|
|
71
|
-
| | `deduplication` | Celery has no native mechanism — an `idempotency_key` is rejected, not ignored |
|
|
72
|
-
|
|
73
|
-
Retries are the **engine's**: the dispatcher raises Celery's own `self.retry`, so
|
|
74
|
-
a failed task is genuinely re-queued with the requested countdown. Taskferry never
|
|
75
|
-
loops in-process pretending to retry.
|
|
76
|
-
|
|
77
|
-
`state` maps Celery's `PENDING/STARTED/SUCCESS/FAILURE/RETRY/REVOKED` onto the
|
|
78
|
-
portable states. Note Celery reports `PENDING` for both a queued task and an
|
|
79
|
-
unknown id; without a result backend the two are indistinguishable, and this
|
|
80
|
-
adapter says so rather than guessing.
|
|
81
|
-
|
|
82
|
-
Only JSON-safe arguments and a `"module:function"` name cross the wire — never a
|
|
83
|
-
pickled callable.
|
|
84
|
-
|
|
85
|
-
## License
|
|
86
|
-
|
|
87
|
-
Apache-2.0.
|
taskferry_celery-0.1.0/README.md
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# taskferry-celery
|
|
2
|
-
|
|
3
|
-
A **Celery** task backend for [Taskferry](https://taskferry.dev). Enqueue Taskferry
|
|
4
|
-
tasks onto a Celery app you already run; Taskferry supplies no worker and
|
|
5
|
-
reimplements none of Celery.
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pip install taskferry-celery[celery]
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Submitting
|
|
12
|
-
|
|
13
|
-
```python
|
|
14
|
-
from taskferry import Taskferry
|
|
15
|
-
|
|
16
|
-
runtime = Taskferry.from_mapping(
|
|
17
|
-
{
|
|
18
|
-
"backends": {"cel": {"factory": "celery", "app": "myapp.celery:app"}},
|
|
19
|
-
"defaults": {"task": "cel"},
|
|
20
|
-
}
|
|
21
|
-
)
|
|
22
|
-
runtime.tasks.submit("myapp.tasks:refresh", 42, queue="metadata")
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Executing (worker)
|
|
26
|
-
|
|
27
|
-
Register the dispatcher once, then run Celery's own worker:
|
|
28
|
-
|
|
29
|
-
```python
|
|
30
|
-
from celery import Celery
|
|
31
|
-
from taskferry_celery import register_dispatcher
|
|
32
|
-
from taskferry.functions import FunctionRegistry
|
|
33
|
-
|
|
34
|
-
app = Celery("myapp", broker="redis://localhost:6379/0")
|
|
35
|
-
register_dispatcher(app, registry=FunctionRegistry(allowed_modules=["myapp"]))
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
celery -A myapp worker
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Capabilities (honest)
|
|
43
|
-
|
|
44
|
-
| Advertised | Not advertised | Why not |
|
|
45
|
-
| --- | --- | --- |
|
|
46
|
-
| submit, state, cancel, delay, priority, retry | `result` | needs a configured result backend Taskferry can't see |
|
|
47
|
-
| | `deduplication` | Celery has no native mechanism — an `idempotency_key` is rejected, not ignored |
|
|
48
|
-
|
|
49
|
-
Retries are the **engine's**: the dispatcher raises Celery's own `self.retry`, so
|
|
50
|
-
a failed task is genuinely re-queued with the requested countdown. Taskferry never
|
|
51
|
-
loops in-process pretending to retry.
|
|
52
|
-
|
|
53
|
-
`state` maps Celery's `PENDING/STARTED/SUCCESS/FAILURE/RETRY/REVOKED` onto the
|
|
54
|
-
portable states. Note Celery reports `PENDING` for both a queued task and an
|
|
55
|
-
unknown id; without a result backend the two are indistinguishable, and this
|
|
56
|
-
adapter says so rather than guessing.
|
|
57
|
-
|
|
58
|
-
Only JSON-safe arguments and a `"module:function"` name cross the wire — never a
|
|
59
|
-
pickled callable.
|
|
60
|
-
|
|
61
|
-
## License
|
|
62
|
-
|
|
63
|
-
Apache-2.0.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|