fastpluggy-tasks-worker 0.2.20__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.
- fastpluggy_tasks_worker-0.2.20/MANIFEST.in +12 -0
- fastpluggy_tasks_worker-0.2.20/PKG-INFO +134 -0
- fastpluggy_tasks_worker-0.2.20/README.md +123 -0
- fastpluggy_tasks_worker-0.2.20/fastpluggy_tasks_worker.egg-info/PKG-INFO +134 -0
- fastpluggy_tasks_worker-0.2.20/fastpluggy_tasks_worker.egg-info/SOURCES.txt +79 -0
- fastpluggy_tasks_worker-0.2.20/fastpluggy_tasks_worker.egg-info/dependency_links.txt +1 -0
- fastpluggy_tasks_worker-0.2.20/fastpluggy_tasks_worker.egg-info/entry_points.txt +2 -0
- fastpluggy_tasks_worker-0.2.20/fastpluggy_tasks_worker.egg-info/requires.txt +3 -0
- fastpluggy_tasks_worker-0.2.20/fastpluggy_tasks_worker.egg-info/top_level.txt +1 -0
- fastpluggy_tasks_worker-0.2.20/pyproject.toml +29 -0
- fastpluggy_tasks_worker-0.2.20/setup.cfg +4 -0
- fastpluggy_tasks_worker-0.2.20/src/__init__.py +1 -0
- fastpluggy_tasks_worker-0.2.20/src/config.py +40 -0
- fastpluggy_tasks_worker-0.2.20/src/executor/__init__.py +0 -0
- fastpluggy_tasks_worker-0.2.20/src/executor/thread_executor.py +225 -0
- fastpluggy_tasks_worker-0.2.20/src/log_handler.py +122 -0
- fastpluggy_tasks_worker-0.2.20/src/models/__init__.py +0 -0
- fastpluggy_tasks_worker-0.2.20/src/models/context.py +31 -0
- fastpluggy_tasks_worker-0.2.20/src/models/notification.py +16 -0
- fastpluggy_tasks_worker-0.2.20/src/models/report.py +35 -0
- fastpluggy_tasks_worker-0.2.20/src/models/scheduled.py +99 -0
- fastpluggy_tasks_worker-0.2.20/src/notifiers/__init__.py +0 -0
- fastpluggy_tasks_worker-0.2.20/src/notifiers/base.py +77 -0
- fastpluggy_tasks_worker-0.2.20/src/notifiers/console.py +18 -0
- fastpluggy_tasks_worker-0.2.20/src/notifiers/database.py +93 -0
- fastpluggy_tasks_worker-0.2.20/src/notifiers/loader.py +45 -0
- fastpluggy_tasks_worker-0.2.20/src/notifiers/registry.py +176 -0
- fastpluggy_tasks_worker-0.2.20/src/notifiers/webhook.py +17 -0
- fastpluggy_tasks_worker-0.2.20/src/plugin.py +165 -0
- fastpluggy_tasks_worker-0.2.20/src/repository/__init__.py +0 -0
- fastpluggy_tasks_worker-0.2.20/src/repository/context.py +47 -0
- fastpluggy_tasks_worker-0.2.20/src/repository/report.py +61 -0
- fastpluggy_tasks_worker-0.2.20/src/repository/schedule_monitoring.py +531 -0
- fastpluggy_tasks_worker-0.2.20/src/repository/scheduled.py +48 -0
- fastpluggy_tasks_worker-0.2.20/src/repository/task_events.py +30 -0
- fastpluggy_tasks_worker-0.2.20/src/router/__init__.py +29 -0
- fastpluggy_tasks_worker-0.2.20/src/router/api_notifier.py +24 -0
- fastpluggy_tasks_worker-0.2.20/src/router/api_registry.py +13 -0
- fastpluggy_tasks_worker-0.2.20/src/router/api_tasks.py +165 -0
- fastpluggy_tasks_worker-0.2.20/src/router/debug.py +85 -0
- fastpluggy_tasks_worker-0.2.20/src/router/front.py +264 -0
- fastpluggy_tasks_worker-0.2.20/src/router/front_lock.py +73 -0
- fastpluggy_tasks_worker-0.2.20/src/router/front_monitoring.py +28 -0
- fastpluggy_tasks_worker-0.2.20/src/router/front_notifier.py +33 -0
- fastpluggy_tasks_worker-0.2.20/src/router/front_schedule.py +210 -0
- fastpluggy_tasks_worker-0.2.20/src/router/metrics.py +81 -0
- fastpluggy_tasks_worker-0.2.20/src/runner.py +276 -0
- fastpluggy_tasks_worker-0.2.20/src/schema/__init__.py +0 -0
- fastpluggy_tasks_worker-0.2.20/src/schema/context.py +115 -0
- fastpluggy_tasks_worker-0.2.20/src/schema/dummy_celery.py +58 -0
- fastpluggy_tasks_worker-0.2.20/src/schema/notifier.py +6 -0
- fastpluggy_tasks_worker-0.2.20/src/schema/report.py +63 -0
- fastpluggy_tasks_worker-0.2.20/src/schema/request_input.py +20 -0
- fastpluggy_tasks_worker-0.2.20/src/schema/status.py +30 -0
- fastpluggy_tasks_worker-0.2.20/src/schema/task_event.py +48 -0
- fastpluggy_tasks_worker-0.2.20/src/services/__init__.py +0 -0
- fastpluggy_tasks_worker-0.2.20/src/services/celery_discovery.py +134 -0
- fastpluggy_tasks_worker-0.2.20/src/services/lock_manager.py +91 -0
- fastpluggy_tasks_worker-0.2.20/src/services/notification_service.py +115 -0
- fastpluggy_tasks_worker-0.2.20/src/services/task_discovery.py +179 -0
- fastpluggy_tasks_worker-0.2.20/src/static/css/notifier_modal.css +18 -0
- fastpluggy_tasks_worker-0.2.20/src/static/js/logs-handler.js +50 -0
- fastpluggy_tasks_worker-0.2.20/src/static/js/notifier_modal.js +221 -0
- fastpluggy_tasks_worker-0.2.20/src/static/js/task_form_builder.js +120 -0
- fastpluggy_tasks_worker-0.2.20/src/task_registry.py +127 -0
- fastpluggy_tasks_worker-0.2.20/src/tasks/__init__.py +0 -0
- fastpluggy_tasks_worker-0.2.20/src/tasks/maintenance.py +78 -0
- fastpluggy_tasks_worker-0.2.20/src/tasks/scheduler.py +113 -0
- fastpluggy_tasks_worker-0.2.20/src/tasks/watchdog.py +51 -0
- fastpluggy_tasks_worker-0.2.20/src/templates/dashboard.html.j2 +175 -0
- fastpluggy_tasks_worker-0.2.20/src/templates/graph.html.j2 +681 -0
- fastpluggy_tasks_worker-0.2.20/src/templates/monitoring/task_time.html.j2 +602 -0
- fastpluggy_tasks_worker-0.2.20/src/templates/notifier_modal.html.j2 +35 -0
- fastpluggy_tasks_worker-0.2.20/src/templates/scheduled_monitor.html.j2 +517 -0
- fastpluggy_tasks_worker-0.2.20/src/templates/task_details.html.j2 +182 -0
- fastpluggy_tasks_worker-0.2.20/src/templates/task_form.html.j2 +172 -0
- fastpluggy_tasks_worker-0.2.20/src/utils.py +36 -0
- fastpluggy_tasks_worker-0.2.20/src/widgets/__init__.py +1 -0
- fastpluggy_tasks_worker-0.2.20/src/widgets/task_form.py +59 -0
- fastpluggy_tasks_worker-0.2.20/src/widgets/task_run_button.py +67 -0
- fastpluggy_tasks_worker-0.2.20/tests/test_celery_discovery.py +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Include all Python files
|
|
2
|
+
recursive-include src *.py
|
|
3
|
+
|
|
4
|
+
# Include all template files
|
|
5
|
+
recursive-include src/templates *.html *.j2
|
|
6
|
+
|
|
7
|
+
# Include all static files (CSS, JS, etc.)
|
|
8
|
+
recursive-include src/static *
|
|
9
|
+
|
|
10
|
+
# Include README and license files
|
|
11
|
+
include README.md
|
|
12
|
+
include LICENSE
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fastpluggy-tasks-worker
|
|
3
|
+
Version: 0.2.20
|
|
4
|
+
Summary: Task Runner plugin for Fastpluggy
|
|
5
|
+
Author: FastPluggy Team
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: croniter
|
|
9
|
+
Requires-Dist: psutil
|
|
10
|
+
Requires-Dist: fastpluggy-crud-tools>=0.2.12
|
|
11
|
+
|
|
12
|
+
# FastPluggy Task Runner
|
|
13
|
+
|
|
14
|
+
A powerful and extensible **task execution framework** for Python, built on top of [FastPluggy](https://fastpluggy.xyz).
|
|
15
|
+
Easily register, run, monitor, and schedule background tasks with full support for retries, logging, live WebSocket updates, and notifications.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## ✨ Features
|
|
20
|
+
|
|
21
|
+
- 🔧 Task registration with metadata, retries, scheduling, and custom parameters
|
|
22
|
+
- 🧠 Dynamic form generation from metadata
|
|
23
|
+
- 📡 Live logs and WebSocket updates
|
|
24
|
+
- 📅 CRON-based scheduler with optional notification rules
|
|
25
|
+
- 🔁 Retry logic with auto-link to parent task
|
|
26
|
+
- 🔒 Non-concurrent task execution with lock tracking
|
|
27
|
+
- 🧩 Extensible notifier system (Console, Slack, Webhook...)
|
|
28
|
+
- 📊 Admin UI to manage tasks, schedules, locks, and reports
|
|
29
|
+
- 💾 Persistent task context and rehydration
|
|
30
|
+
- 📈 Task metrics from process/thread info
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 🛠️ How It Works
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from ..task_registry import task_registry
|
|
38
|
+
|
|
39
|
+
@task_registry.register(
|
|
40
|
+
description="Sync data every 5 mins",
|
|
41
|
+
schedule="*/5 * * * *",
|
|
42
|
+
max_retries=3,
|
|
43
|
+
allow_concurrent=False
|
|
44
|
+
)
|
|
45
|
+
def sync_data_task():
|
|
46
|
+
print("Sync running...")
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 📋 Roadmap
|
|
52
|
+
|
|
53
|
+
### ✅ Completed / In Progress
|
|
54
|
+
|
|
55
|
+
- [x] Task registration with metadata (`description`, `tags`, `max_retries`, `schedule`, `allow_concurrent`)
|
|
56
|
+
- [x] Dynamic task form rendering via metadata
|
|
57
|
+
- [x] Notification system with:
|
|
58
|
+
- Console / webhook / Slack (optional)
|
|
59
|
+
- Selectable events: `task_started`, `task_failed`, `logs`, etc.
|
|
60
|
+
- [x] Context/report tracking in DB
|
|
61
|
+
- [x] Task retry linking via `parent_task_id`
|
|
62
|
+
- [x] CRON-based scheduler loop
|
|
63
|
+
- [x] Web UI for:
|
|
64
|
+
- Task logs
|
|
65
|
+
- Task reports
|
|
66
|
+
- Scheduled tasks
|
|
67
|
+
- Locks
|
|
68
|
+
- Running task status
|
|
69
|
+
- [x] Lock manager (`TaskLockManager`) with DB tracking
|
|
70
|
+
- [x] Cancel button for live-running tasks
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### 📌 Upcoming Features
|
|
75
|
+
|
|
76
|
+
#### 🔁 Task Queue Enhancements
|
|
77
|
+
- [ ] Priority & rate-limit execution
|
|
78
|
+
- [ ] Per-user concurrency limits
|
|
79
|
+
- [ ] Task dependencies / DAG runner
|
|
80
|
+
|
|
81
|
+
#### 🧠 Task Registry & Detection
|
|
82
|
+
- [x] Auto-discovery of task definitions from modules
|
|
83
|
+
- [x] Celery-style shared task detection
|
|
84
|
+
- [ ] Dynamic execution via `run_by_name("slug", kwargs)`
|
|
85
|
+
|
|
86
|
+
#### 💾 Persistence & Rehydration
|
|
87
|
+
- [ ] Save function reference + args for replay/retry
|
|
88
|
+
- [x] Task dependency tree and retry visualization
|
|
89
|
+
|
|
90
|
+
#### 🌐 Remote Workers
|
|
91
|
+
- [ ] Register and manage remote workers
|
|
92
|
+
- [ ] Assign tasks based on tags/strategies
|
|
93
|
+
- [ ] Remote heartbeat & health monitoring
|
|
94
|
+
|
|
95
|
+
#### 📈 Observability
|
|
96
|
+
- [ ] Task metrics via `psutil` (CPU, memory, threads)
|
|
97
|
+
- [ ] UI views for thread/process diagnostics
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 📦 Tech Stack
|
|
102
|
+
|
|
103
|
+
- FastAPI + FastPluggy
|
|
104
|
+
- SQLAlchemy + SQLite/PostgreSQL
|
|
105
|
+
- WTForms + Jinja2 + Bootstrap (Tabler)
|
|
106
|
+
- WebSockets for real-time feedback
|
|
107
|
+
- Plugin-ready & modular architecture
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## 🧠 Philosophy
|
|
112
|
+
|
|
113
|
+
This runner is built to be:
|
|
114
|
+
|
|
115
|
+
- **Introspective**: auto-generate UIs from functions
|
|
116
|
+
- **Composable**: integrate with your FastPluggy app
|
|
117
|
+
- **Scalable**: support single-machine and multi-worker environments
|
|
118
|
+
- **Extensible**: notifiers, hooks, CRON, logs
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 📎 License
|
|
123
|
+
|
|
124
|
+
MIT – Use freely and contribute 💙
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 🚀 Contributions Welcome!
|
|
129
|
+
|
|
130
|
+
Open issues, send PRs, share ideas —
|
|
131
|
+
Let’s build the most pluggable Python task runner together.
|
|
132
|
+
|
|
133
|
+
### WArning :
|
|
134
|
+
not works with sqlite due to jsonb field needed
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# FastPluggy Task Runner
|
|
2
|
+
|
|
3
|
+
A powerful and extensible **task execution framework** for Python, built on top of [FastPluggy](https://fastpluggy.xyz).
|
|
4
|
+
Easily register, run, monitor, and schedule background tasks with full support for retries, logging, live WebSocket updates, and notifications.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## ✨ Features
|
|
9
|
+
|
|
10
|
+
- 🔧 Task registration with metadata, retries, scheduling, and custom parameters
|
|
11
|
+
- 🧠 Dynamic form generation from metadata
|
|
12
|
+
- 📡 Live logs and WebSocket updates
|
|
13
|
+
- 📅 CRON-based scheduler with optional notification rules
|
|
14
|
+
- 🔁 Retry logic with auto-link to parent task
|
|
15
|
+
- 🔒 Non-concurrent task execution with lock tracking
|
|
16
|
+
- 🧩 Extensible notifier system (Console, Slack, Webhook...)
|
|
17
|
+
- 📊 Admin UI to manage tasks, schedules, locks, and reports
|
|
18
|
+
- 💾 Persistent task context and rehydration
|
|
19
|
+
- 📈 Task metrics from process/thread info
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 🛠️ How It Works
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from ..task_registry import task_registry
|
|
27
|
+
|
|
28
|
+
@task_registry.register(
|
|
29
|
+
description="Sync data every 5 mins",
|
|
30
|
+
schedule="*/5 * * * *",
|
|
31
|
+
max_retries=3,
|
|
32
|
+
allow_concurrent=False
|
|
33
|
+
)
|
|
34
|
+
def sync_data_task():
|
|
35
|
+
print("Sync running...")
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 📋 Roadmap
|
|
41
|
+
|
|
42
|
+
### ✅ Completed / In Progress
|
|
43
|
+
|
|
44
|
+
- [x] Task registration with metadata (`description`, `tags`, `max_retries`, `schedule`, `allow_concurrent`)
|
|
45
|
+
- [x] Dynamic task form rendering via metadata
|
|
46
|
+
- [x] Notification system with:
|
|
47
|
+
- Console / webhook / Slack (optional)
|
|
48
|
+
- Selectable events: `task_started`, `task_failed`, `logs`, etc.
|
|
49
|
+
- [x] Context/report tracking in DB
|
|
50
|
+
- [x] Task retry linking via `parent_task_id`
|
|
51
|
+
- [x] CRON-based scheduler loop
|
|
52
|
+
- [x] Web UI for:
|
|
53
|
+
- Task logs
|
|
54
|
+
- Task reports
|
|
55
|
+
- Scheduled tasks
|
|
56
|
+
- Locks
|
|
57
|
+
- Running task status
|
|
58
|
+
- [x] Lock manager (`TaskLockManager`) with DB tracking
|
|
59
|
+
- [x] Cancel button for live-running tasks
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
### 📌 Upcoming Features
|
|
64
|
+
|
|
65
|
+
#### 🔁 Task Queue Enhancements
|
|
66
|
+
- [ ] Priority & rate-limit execution
|
|
67
|
+
- [ ] Per-user concurrency limits
|
|
68
|
+
- [ ] Task dependencies / DAG runner
|
|
69
|
+
|
|
70
|
+
#### 🧠 Task Registry & Detection
|
|
71
|
+
- [x] Auto-discovery of task definitions from modules
|
|
72
|
+
- [x] Celery-style shared task detection
|
|
73
|
+
- [ ] Dynamic execution via `run_by_name("slug", kwargs)`
|
|
74
|
+
|
|
75
|
+
#### 💾 Persistence & Rehydration
|
|
76
|
+
- [ ] Save function reference + args for replay/retry
|
|
77
|
+
- [x] Task dependency tree and retry visualization
|
|
78
|
+
|
|
79
|
+
#### 🌐 Remote Workers
|
|
80
|
+
- [ ] Register and manage remote workers
|
|
81
|
+
- [ ] Assign tasks based on tags/strategies
|
|
82
|
+
- [ ] Remote heartbeat & health monitoring
|
|
83
|
+
|
|
84
|
+
#### 📈 Observability
|
|
85
|
+
- [ ] Task metrics via `psutil` (CPU, memory, threads)
|
|
86
|
+
- [ ] UI views for thread/process diagnostics
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 📦 Tech Stack
|
|
91
|
+
|
|
92
|
+
- FastAPI + FastPluggy
|
|
93
|
+
- SQLAlchemy + SQLite/PostgreSQL
|
|
94
|
+
- WTForms + Jinja2 + Bootstrap (Tabler)
|
|
95
|
+
- WebSockets for real-time feedback
|
|
96
|
+
- Plugin-ready & modular architecture
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 🧠 Philosophy
|
|
101
|
+
|
|
102
|
+
This runner is built to be:
|
|
103
|
+
|
|
104
|
+
- **Introspective**: auto-generate UIs from functions
|
|
105
|
+
- **Composable**: integrate with your FastPluggy app
|
|
106
|
+
- **Scalable**: support single-machine and multi-worker environments
|
|
107
|
+
- **Extensible**: notifiers, hooks, CRON, logs
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## 📎 License
|
|
112
|
+
|
|
113
|
+
MIT – Use freely and contribute 💙
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 🚀 Contributions Welcome!
|
|
118
|
+
|
|
119
|
+
Open issues, send PRs, share ideas —
|
|
120
|
+
Let’s build the most pluggable Python task runner together.
|
|
121
|
+
|
|
122
|
+
### WArning :
|
|
123
|
+
not works with sqlite due to jsonb field needed
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fastpluggy-tasks-worker
|
|
3
|
+
Version: 0.2.20
|
|
4
|
+
Summary: Task Runner plugin for Fastpluggy
|
|
5
|
+
Author: FastPluggy Team
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: croniter
|
|
9
|
+
Requires-Dist: psutil
|
|
10
|
+
Requires-Dist: fastpluggy-crud-tools>=0.2.12
|
|
11
|
+
|
|
12
|
+
# FastPluggy Task Runner
|
|
13
|
+
|
|
14
|
+
A powerful and extensible **task execution framework** for Python, built on top of [FastPluggy](https://fastpluggy.xyz).
|
|
15
|
+
Easily register, run, monitor, and schedule background tasks with full support for retries, logging, live WebSocket updates, and notifications.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## ✨ Features
|
|
20
|
+
|
|
21
|
+
- 🔧 Task registration with metadata, retries, scheduling, and custom parameters
|
|
22
|
+
- 🧠 Dynamic form generation from metadata
|
|
23
|
+
- 📡 Live logs and WebSocket updates
|
|
24
|
+
- 📅 CRON-based scheduler with optional notification rules
|
|
25
|
+
- 🔁 Retry logic with auto-link to parent task
|
|
26
|
+
- 🔒 Non-concurrent task execution with lock tracking
|
|
27
|
+
- 🧩 Extensible notifier system (Console, Slack, Webhook...)
|
|
28
|
+
- 📊 Admin UI to manage tasks, schedules, locks, and reports
|
|
29
|
+
- 💾 Persistent task context and rehydration
|
|
30
|
+
- 📈 Task metrics from process/thread info
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 🛠️ How It Works
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from ..task_registry import task_registry
|
|
38
|
+
|
|
39
|
+
@task_registry.register(
|
|
40
|
+
description="Sync data every 5 mins",
|
|
41
|
+
schedule="*/5 * * * *",
|
|
42
|
+
max_retries=3,
|
|
43
|
+
allow_concurrent=False
|
|
44
|
+
)
|
|
45
|
+
def sync_data_task():
|
|
46
|
+
print("Sync running...")
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 📋 Roadmap
|
|
52
|
+
|
|
53
|
+
### ✅ Completed / In Progress
|
|
54
|
+
|
|
55
|
+
- [x] Task registration with metadata (`description`, `tags`, `max_retries`, `schedule`, `allow_concurrent`)
|
|
56
|
+
- [x] Dynamic task form rendering via metadata
|
|
57
|
+
- [x] Notification system with:
|
|
58
|
+
- Console / webhook / Slack (optional)
|
|
59
|
+
- Selectable events: `task_started`, `task_failed`, `logs`, etc.
|
|
60
|
+
- [x] Context/report tracking in DB
|
|
61
|
+
- [x] Task retry linking via `parent_task_id`
|
|
62
|
+
- [x] CRON-based scheduler loop
|
|
63
|
+
- [x] Web UI for:
|
|
64
|
+
- Task logs
|
|
65
|
+
- Task reports
|
|
66
|
+
- Scheduled tasks
|
|
67
|
+
- Locks
|
|
68
|
+
- Running task status
|
|
69
|
+
- [x] Lock manager (`TaskLockManager`) with DB tracking
|
|
70
|
+
- [x] Cancel button for live-running tasks
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### 📌 Upcoming Features
|
|
75
|
+
|
|
76
|
+
#### 🔁 Task Queue Enhancements
|
|
77
|
+
- [ ] Priority & rate-limit execution
|
|
78
|
+
- [ ] Per-user concurrency limits
|
|
79
|
+
- [ ] Task dependencies / DAG runner
|
|
80
|
+
|
|
81
|
+
#### 🧠 Task Registry & Detection
|
|
82
|
+
- [x] Auto-discovery of task definitions from modules
|
|
83
|
+
- [x] Celery-style shared task detection
|
|
84
|
+
- [ ] Dynamic execution via `run_by_name("slug", kwargs)`
|
|
85
|
+
|
|
86
|
+
#### 💾 Persistence & Rehydration
|
|
87
|
+
- [ ] Save function reference + args for replay/retry
|
|
88
|
+
- [x] Task dependency tree and retry visualization
|
|
89
|
+
|
|
90
|
+
#### 🌐 Remote Workers
|
|
91
|
+
- [ ] Register and manage remote workers
|
|
92
|
+
- [ ] Assign tasks based on tags/strategies
|
|
93
|
+
- [ ] Remote heartbeat & health monitoring
|
|
94
|
+
|
|
95
|
+
#### 📈 Observability
|
|
96
|
+
- [ ] Task metrics via `psutil` (CPU, memory, threads)
|
|
97
|
+
- [ ] UI views for thread/process diagnostics
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 📦 Tech Stack
|
|
102
|
+
|
|
103
|
+
- FastAPI + FastPluggy
|
|
104
|
+
- SQLAlchemy + SQLite/PostgreSQL
|
|
105
|
+
- WTForms + Jinja2 + Bootstrap (Tabler)
|
|
106
|
+
- WebSockets for real-time feedback
|
|
107
|
+
- Plugin-ready & modular architecture
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## 🧠 Philosophy
|
|
112
|
+
|
|
113
|
+
This runner is built to be:
|
|
114
|
+
|
|
115
|
+
- **Introspective**: auto-generate UIs from functions
|
|
116
|
+
- **Composable**: integrate with your FastPluggy app
|
|
117
|
+
- **Scalable**: support single-machine and multi-worker environments
|
|
118
|
+
- **Extensible**: notifiers, hooks, CRON, logs
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 📎 License
|
|
123
|
+
|
|
124
|
+
MIT – Use freely and contribute 💙
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 🚀 Contributions Welcome!
|
|
129
|
+
|
|
130
|
+
Open issues, send PRs, share ideas —
|
|
131
|
+
Let’s build the most pluggable Python task runner together.
|
|
132
|
+
|
|
133
|
+
### WArning :
|
|
134
|
+
not works with sqlite due to jsonb field needed
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
MANIFEST.in
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
fastpluggy_tasks_worker.egg-info/PKG-INFO
|
|
5
|
+
fastpluggy_tasks_worker.egg-info/SOURCES.txt
|
|
6
|
+
fastpluggy_tasks_worker.egg-info/dependency_links.txt
|
|
7
|
+
fastpluggy_tasks_worker.egg-info/entry_points.txt
|
|
8
|
+
fastpluggy_tasks_worker.egg-info/requires.txt
|
|
9
|
+
fastpluggy_tasks_worker.egg-info/top_level.txt
|
|
10
|
+
src/__init__.py
|
|
11
|
+
src/config.py
|
|
12
|
+
src/log_handler.py
|
|
13
|
+
src/plugin.py
|
|
14
|
+
src/runner.py
|
|
15
|
+
src/task_registry.py
|
|
16
|
+
src/utils.py
|
|
17
|
+
src/executor/__init__.py
|
|
18
|
+
src/executor/thread_executor.py
|
|
19
|
+
src/models/__init__.py
|
|
20
|
+
src/models/context.py
|
|
21
|
+
src/models/notification.py
|
|
22
|
+
src/models/report.py
|
|
23
|
+
src/models/scheduled.py
|
|
24
|
+
src/notifiers/__init__.py
|
|
25
|
+
src/notifiers/base.py
|
|
26
|
+
src/notifiers/console.py
|
|
27
|
+
src/notifiers/database.py
|
|
28
|
+
src/notifiers/loader.py
|
|
29
|
+
src/notifiers/registry.py
|
|
30
|
+
src/notifiers/webhook.py
|
|
31
|
+
src/repository/__init__.py
|
|
32
|
+
src/repository/context.py
|
|
33
|
+
src/repository/report.py
|
|
34
|
+
src/repository/schedule_monitoring.py
|
|
35
|
+
src/repository/scheduled.py
|
|
36
|
+
src/repository/task_events.py
|
|
37
|
+
src/router/__init__.py
|
|
38
|
+
src/router/api_notifier.py
|
|
39
|
+
src/router/api_registry.py
|
|
40
|
+
src/router/api_tasks.py
|
|
41
|
+
src/router/debug.py
|
|
42
|
+
src/router/front.py
|
|
43
|
+
src/router/front_lock.py
|
|
44
|
+
src/router/front_monitoring.py
|
|
45
|
+
src/router/front_notifier.py
|
|
46
|
+
src/router/front_schedule.py
|
|
47
|
+
src/router/metrics.py
|
|
48
|
+
src/schema/__init__.py
|
|
49
|
+
src/schema/context.py
|
|
50
|
+
src/schema/dummy_celery.py
|
|
51
|
+
src/schema/notifier.py
|
|
52
|
+
src/schema/report.py
|
|
53
|
+
src/schema/request_input.py
|
|
54
|
+
src/schema/status.py
|
|
55
|
+
src/schema/task_event.py
|
|
56
|
+
src/services/__init__.py
|
|
57
|
+
src/services/celery_discovery.py
|
|
58
|
+
src/services/lock_manager.py
|
|
59
|
+
src/services/notification_service.py
|
|
60
|
+
src/services/task_discovery.py
|
|
61
|
+
src/static/css/notifier_modal.css
|
|
62
|
+
src/static/js/logs-handler.js
|
|
63
|
+
src/static/js/notifier_modal.js
|
|
64
|
+
src/static/js/task_form_builder.js
|
|
65
|
+
src/tasks/__init__.py
|
|
66
|
+
src/tasks/maintenance.py
|
|
67
|
+
src/tasks/scheduler.py
|
|
68
|
+
src/tasks/watchdog.py
|
|
69
|
+
src/templates/dashboard.html.j2
|
|
70
|
+
src/templates/graph.html.j2
|
|
71
|
+
src/templates/notifier_modal.html.j2
|
|
72
|
+
src/templates/scheduled_monitor.html.j2
|
|
73
|
+
src/templates/task_details.html.j2
|
|
74
|
+
src/templates/task_form.html.j2
|
|
75
|
+
src/templates/monitoring/task_time.html.j2
|
|
76
|
+
src/widgets/__init__.py
|
|
77
|
+
src/widgets/task_form.py
|
|
78
|
+
src/widgets/task_run_button.py
|
|
79
|
+
tests/test_celery_discovery.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fastpluggy_plugin
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "fastpluggy-tasks-worker"
|
|
7
|
+
version = "0.2.20"
|
|
8
|
+
description = "Task Runner plugin for Fastpluggy"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "FastPluggy Team"}
|
|
13
|
+
]
|
|
14
|
+
dependencies = [
|
|
15
|
+
"croniter",
|
|
16
|
+
"psutil",
|
|
17
|
+
"fastpluggy-crud-tools>=0.2.12",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[tool.setuptools]
|
|
21
|
+
packages = ["fastpluggy_plugin.tasks_worker"]
|
|
22
|
+
package-dir = { "fastpluggy_plugin.tasks_worker" = "src" }
|
|
23
|
+
include-package-data = true
|
|
24
|
+
|
|
25
|
+
[tool.setuptools.package-data]
|
|
26
|
+
"fastpluggy_plugin.tasks_worker" = ["**/*","templates/**/*.html", "templates/**/*.j2", "static/**/*"]
|
|
27
|
+
|
|
28
|
+
[project.entry-points."fastpluggy.plugins"]
|
|
29
|
+
tasks_worker = "fastpluggy_plugin.tasks_worker.plugin:TaskRunnerPlugin"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .plugin import TaskRunnerPlugin
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from typing import Optional, List
|
|
2
|
+
|
|
3
|
+
from fastpluggy.core.config import BaseDatabaseSettings
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TasksRunnerSettings(BaseDatabaseSettings):
|
|
7
|
+
|
|
8
|
+
# Thread pool settings
|
|
9
|
+
thread_pool_max_workers: Optional[int] = None # None means use default (CPU count * 5)
|
|
10
|
+
|
|
11
|
+
# Scheduler
|
|
12
|
+
scheduler_enabled: bool = True
|
|
13
|
+
scheduler_frequency: float = 5
|
|
14
|
+
allow_create_schedule_task: bool = True
|
|
15
|
+
|
|
16
|
+
# notifier
|
|
17
|
+
external_notification_loaders: Optional[List[str]] = []
|
|
18
|
+
|
|
19
|
+
# Registry/Discover of tasks
|
|
20
|
+
enable_auto_task_discovery: bool = True # Enables scanning for task functions
|
|
21
|
+
# Celery
|
|
22
|
+
discover_celery_tasks: bool = True
|
|
23
|
+
celery_app_path: str = "myproject.worker:celery_app" # Path to the Celery app object
|
|
24
|
+
discover_celery_schedule_enabled_status: bool = False # default status for enabled on creation of ScheduledTaskDB
|
|
25
|
+
|
|
26
|
+
store_task_db: bool = True
|
|
27
|
+
#store_task_notif_db: bool = False
|
|
28
|
+
|
|
29
|
+
# Purge
|
|
30
|
+
purge_enabled :bool = True
|
|
31
|
+
purge_after_days: int = 30
|
|
32
|
+
|
|
33
|
+
# maybe add a module prefix
|
|
34
|
+
# class Config:
|
|
35
|
+
# env_prefix = "tasks_worker_"
|
|
36
|
+
watchdog_enabled: bool = True
|
|
37
|
+
#watchdog_frequency: float = 5
|
|
38
|
+
watchdog_timeout_minutes: int = 120
|
|
39
|
+
|
|
40
|
+
|
|
File without changes
|