goatbeat-celery 0.1.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.
- goatbeat_celery-0.1.0/LICENSE +21 -0
- goatbeat_celery-0.1.0/PKG-INFO +28 -0
- goatbeat_celery-0.1.0/README.md +3 -0
- goatbeat_celery-0.1.0/pyproject.toml +49 -0
- goatbeat_celery-0.1.0/pyproject.toml.orig +39 -0
- goatbeat_celery-0.1.0/src/goatbeat/celery/__init__.py +4 -0
- goatbeat_celery-0.1.0/src/goatbeat/celery/py.typed +0 -0
- goatbeat_celery-0.1.0/src/goatbeat/celery/submitter.py +30 -0
- goatbeat_celery-0.1.0/src/goatbeat/celery/tasks.py +17 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Louis Midson LAJEANTY <midsonlajeanty@proton.me>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: goatbeat-celery
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Celery submitter for Goatbeat.
|
|
5
|
+
Keywords: scheduler,cron,periodic-tasks,distributed,django-tasks,leader-election
|
|
6
|
+
Author: Louis Midson LAJEANTY
|
|
7
|
+
Author-email: Louis Midson LAJEANTY <midsonlajeanty@proton.me>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Framework :: Celery
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Dist: goatbeat-core==0.1.0
|
|
19
|
+
Requires-Dist: celery>=5.5
|
|
20
|
+
Requires-Python: >=3.13
|
|
21
|
+
Project-URL: Homepage, https://github.com/goatlabshq/goatbeat
|
|
22
|
+
Project-URL: Documentation, https://goatlabshq.github.io/goatbeat/
|
|
23
|
+
Project-URL: Issues, https://github.com/goatlabshq/goatbeat/issues
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# goatbeat-celery
|
|
27
|
+
|
|
28
|
+
Celery submitter for Goatbeat. Part of [Goatbeat](https://github.com/goatlabshq/goatbeat).
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "goatbeat-celery"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Celery submitter for Goatbeat."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.13"
|
|
9
|
+
keywords = [
|
|
10
|
+
"scheduler",
|
|
11
|
+
"cron",
|
|
12
|
+
"periodic-tasks",
|
|
13
|
+
"distributed",
|
|
14
|
+
"django-tasks",
|
|
15
|
+
"leader-election",
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Framework :: Celery",
|
|
19
|
+
"Development Status :: 3 - Alpha",
|
|
20
|
+
"Intended Audience :: Developers",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Programming Language :: Python :: 3.14",
|
|
24
|
+
"Topic :: System :: Distributed Computing",
|
|
25
|
+
"Typing :: Typed",
|
|
26
|
+
]
|
|
27
|
+
dependencies = [
|
|
28
|
+
"goatbeat-core==0.1.0",
|
|
29
|
+
"celery>=5.5",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[[project.authors]]
|
|
33
|
+
name = "Louis Midson LAJEANTY"
|
|
34
|
+
email = "midsonlajeanty@proton.me"
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/goatlabshq/goatbeat"
|
|
38
|
+
Documentation = "https://goatlabshq.github.io/goatbeat/"
|
|
39
|
+
Issues = "https://github.com/goatlabshq/goatbeat/issues"
|
|
40
|
+
|
|
41
|
+
[build-system]
|
|
42
|
+
requires = ["uv_build>=0.12,<0.13"]
|
|
43
|
+
build-backend = "uv_build"
|
|
44
|
+
|
|
45
|
+
[tool.uv.build-backend]
|
|
46
|
+
module-name = "goatbeat.celery"
|
|
47
|
+
|
|
48
|
+
[tool.uv.sources.goatbeat-core]
|
|
49
|
+
workspace = true
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "goatbeat-celery"
|
|
3
|
+
version = "0.1.0" # x-release-please-version
|
|
4
|
+
description = "Celery submitter for Goatbeat."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [{ name = "Louis Midson LAJEANTY", email = "midsonlajeanty@proton.me" }]
|
|
9
|
+
requires-python = ">=3.13"
|
|
10
|
+
keywords = ["scheduler", "cron", "periodic-tasks", "distributed", "django-tasks", "leader-election"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Framework :: Celery",
|
|
13
|
+
"Development Status :: 3 - Alpha",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Programming Language :: Python :: 3.14",
|
|
18
|
+
"Topic :: System :: Distributed Computing",
|
|
19
|
+
"Typing :: Typed",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"goatbeat-core==0.1.0", # x-release-please-version
|
|
23
|
+
"celery>=5.5",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/goatlabshq/goatbeat"
|
|
28
|
+
Documentation = "https://goatlabshq.github.io/goatbeat/"
|
|
29
|
+
Issues = "https://github.com/goatlabshq/goatbeat/issues"
|
|
30
|
+
|
|
31
|
+
[build-system]
|
|
32
|
+
requires = ["uv_build>=0.12,<0.13"]
|
|
33
|
+
build-backend = "uv_build"
|
|
34
|
+
|
|
35
|
+
[tool.uv.build-backend]
|
|
36
|
+
module-name = "goatbeat.celery"
|
|
37
|
+
|
|
38
|
+
[tool.uv.sources]
|
|
39
|
+
goatbeat-core = { workspace = true }
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from kombu.exceptions import KombuError, OperationalError
|
|
2
|
+
|
|
3
|
+
from celery import Celery
|
|
4
|
+
from goatbeat.core.errors import SubmissionError
|
|
5
|
+
from goatbeat.core.execution import SubmissionReceipt
|
|
6
|
+
from goatbeat.core.submission import TaskSubmission
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CelerySubmitter:
|
|
10
|
+
"""The task path is the Celery task name (Celery's default for ``@app.task``)."""
|
|
11
|
+
|
|
12
|
+
def __init__(self, app: Celery) -> None:
|
|
13
|
+
self._app = app
|
|
14
|
+
|
|
15
|
+
def submit(self, submission: TaskSubmission) -> SubmissionReceipt:
|
|
16
|
+
routing = submission.routing
|
|
17
|
+
if routing.backend is not None:
|
|
18
|
+
raise SubmissionError("Celery has no task backends to choose from; route by queue")
|
|
19
|
+
try:
|
|
20
|
+
self._app.send_task(
|
|
21
|
+
submission.task.path,
|
|
22
|
+
args=list(submission.task.args),
|
|
23
|
+
kwargs=dict(submission.task.kwargs),
|
|
24
|
+
task_id=submission.idempotency_key.value,
|
|
25
|
+
queue=routing.queue,
|
|
26
|
+
priority=routing.priority,
|
|
27
|
+
)
|
|
28
|
+
except (KombuError, OperationalError, OSError) as error:
|
|
29
|
+
raise SubmissionError(f"Celery broker refused the task: {error}") from error
|
|
30
|
+
return SubmissionReceipt(submission.idempotency_key.value)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
from goatbeat.core.json import ensure_json
|
|
6
|
+
from goatbeat.core.tasks import TaskCall
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from celery import Task
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def call[**P, R](task: Task[P, R], /, *args: P.args, **kwargs: P.kwargs) -> TaskCall:
|
|
13
|
+
return TaskCall(
|
|
14
|
+
path=task.name,
|
|
15
|
+
args=tuple(ensure_json(value) for value in args),
|
|
16
|
+
kwargs={name: ensure_json(value) for name, value in kwargs.items()},
|
|
17
|
+
)
|