queuemgr 1.0.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.
Files changed (84) hide show
  1. queuemgr-1.0.0/LICENSE +21 -0
  2. queuemgr-1.0.0/MANIFEST.in +15 -0
  3. queuemgr-1.0.0/PKG-INFO +148 -0
  4. queuemgr-1.0.0/QUICK_START.md +118 -0
  5. queuemgr-1.0.0/README.md +103 -0
  6. queuemgr-1.0.0/SERVICE_README.md +350 -0
  7. queuemgr-1.0.0/docs/AI_PROMPTS_FOR_CONTRIBUTORS.md +57 -0
  8. queuemgr-1.0.0/docs/CODING_AND_NAMING_GUIDELINES.md +60 -0
  9. queuemgr-1.0.0/docs/PROJECT_STANDARDS.md +59 -0
  10. queuemgr-1.0.0/docs/tech_spec.md +382 -0
  11. queuemgr-1.0.0/install.sh +85 -0
  12. queuemgr-1.0.0/pyproject.toml +74 -0
  13. queuemgr-1.0.0/queuemgr/__init__.py +13 -0
  14. queuemgr-1.0.0/queuemgr/constants.py +70 -0
  15. queuemgr-1.0.0/queuemgr/core/__init__.py +6 -0
  16. queuemgr-1.0.0/queuemgr/core/exceptions.py +61 -0
  17. queuemgr-1.0.0/queuemgr/core/ipc.py +38 -0
  18. queuemgr-1.0.0/queuemgr/core/ipc_manager.py +54 -0
  19. queuemgr-1.0.0/queuemgr/core/ipc_operations.py +352 -0
  20. queuemgr-1.0.0/queuemgr/core/registry.py +263 -0
  21. queuemgr-1.0.0/queuemgr/core/types.py +75 -0
  22. queuemgr-1.0.0/queuemgr/examples/__init__.py +6 -0
  23. queuemgr-1.0.0/queuemgr/examples/data_analyzer.py +188 -0
  24. queuemgr-1.0.0/queuemgr/examples/error_handling_job.py +135 -0
  25. queuemgr-1.0.0/queuemgr/examples/full_app_example.py +155 -0
  26. queuemgr-1.0.0/queuemgr/examples/integration_examples/cli_integration.py +319 -0
  27. queuemgr-1.0.0/queuemgr/examples/integration_examples/flask_api.py +206 -0
  28. queuemgr-1.0.0/queuemgr/examples/integration_examples/flask_integration.py +16 -0
  29. queuemgr-1.0.0/queuemgr/examples/integration_examples/flask_routes.py +109 -0
  30. queuemgr-1.0.0/queuemgr/examples/integration_examples/systemd_integration.py +278 -0
  31. queuemgr-1.0.0/queuemgr/examples/jobs/__init__.py +14 -0
  32. queuemgr-1.0.0/queuemgr/examples/jobs/api_call_job.py +82 -0
  33. queuemgr-1.0.0/queuemgr/examples/jobs/data_processing_job.py +72 -0
  34. queuemgr-1.0.0/queuemgr/examples/jobs/file_operation_job.py +78 -0
  35. queuemgr-1.0.0/queuemgr/examples/large_data_generator.py +234 -0
  36. queuemgr-1.0.0/queuemgr/examples/large_result_job.py +114 -0
  37. queuemgr-1.0.0/queuemgr/examples/proc_manager_example.py +150 -0
  38. queuemgr-1.0.0/queuemgr/examples/progress_job.py +137 -0
  39. queuemgr-1.0.0/queuemgr/examples/registry_example.py +161 -0
  40. queuemgr-1.0.0/queuemgr/examples/result_job.py +351 -0
  41. queuemgr-1.0.0/queuemgr/examples/service_example.py +380 -0
  42. queuemgr-1.0.0/queuemgr/examples/simple_job.py +125 -0
  43. queuemgr-1.0.0/queuemgr/examples/simple_manager_example.py +132 -0
  44. queuemgr-1.0.0/queuemgr/exceptions.py +160 -0
  45. queuemgr-1.0.0/queuemgr/jobs/__init__.py +6 -0
  46. queuemgr-1.0.0/queuemgr/jobs/base.py +15 -0
  47. queuemgr-1.0.0/queuemgr/jobs/base_core.py +304 -0
  48. queuemgr-1.0.0/queuemgr/jobs/exceptions.py +47 -0
  49. queuemgr-1.0.0/queuemgr/proc_api.py +297 -0
  50. queuemgr-1.0.0/queuemgr/proc_config.py +22 -0
  51. queuemgr-1.0.0/queuemgr/proc_ipc.py +105 -0
  52. queuemgr-1.0.0/queuemgr/proc_manager.py +16 -0
  53. queuemgr-1.0.0/queuemgr/proc_manager_core.py +399 -0
  54. queuemgr-1.0.0/queuemgr/process_commands.py +57 -0
  55. queuemgr-1.0.0/queuemgr/process_config.py +20 -0
  56. queuemgr-1.0.0/queuemgr/process_context.py +38 -0
  57. queuemgr-1.0.0/queuemgr/process_core.py +335 -0
  58. queuemgr-1.0.0/queuemgr/process_manager.py +17 -0
  59. queuemgr-1.0.0/queuemgr/queue/__init__.py +6 -0
  60. queuemgr-1.0.0/queuemgr/queue/exceptions.py +58 -0
  61. queuemgr-1.0.0/queuemgr/queue/job_queue.py +336 -0
  62. queuemgr-1.0.0/queuemgr/simple_api.py +281 -0
  63. queuemgr-1.0.0/queuemgr.egg-info/PKG-INFO +148 -0
  64. queuemgr-1.0.0/queuemgr.egg-info/SOURCES.txt +82 -0
  65. queuemgr-1.0.0/queuemgr.egg-info/dependency_links.txt +1 -0
  66. queuemgr-1.0.0/queuemgr.egg-info/entry_points.txt +4 -0
  67. queuemgr-1.0.0/queuemgr.egg-info/requires.txt +13 -0
  68. queuemgr-1.0.0/queuemgr.egg-info/top_level.txt +2 -0
  69. queuemgr-1.0.0/queuemgr.service +30 -0
  70. queuemgr-1.0.0/requirements.txt +9 -0
  71. queuemgr-1.0.0/setup.cfg +4 -0
  72. queuemgr-1.0.0/setup.py +70 -0
  73. queuemgr-1.0.0/tests/__init__.py +6 -0
  74. queuemgr-1.0.0/tests/core/test_ipc.py +269 -0
  75. queuemgr-1.0.0/tests/core/test_registry.py +344 -0
  76. queuemgr-1.0.0/tests/core/test_types.py +191 -0
  77. queuemgr-1.0.0/tests/jobs/test_base.py +20 -0
  78. queuemgr-1.0.0/tests/jobs/test_base_initialization.py +133 -0
  79. queuemgr-1.0.0/tests/jobs/test_base_job_loop.py +216 -0
  80. queuemgr-1.0.0/tests/jobs/test_base_process_control.py +163 -0
  81. queuemgr-1.0.0/tests/queue/test_job_queue.py +18 -0
  82. queuemgr-1.0.0/tests/queue/test_job_queue_basic.py +181 -0
  83. queuemgr-1.0.0/tests/queue/test_job_queue_operations.py +242 -0
  84. queuemgr-1.0.0/tests/test_exceptions.py +184 -0
queuemgr-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Vasiliy Zdanovskiy
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,15 @@
1
+ include README.md
2
+ include LICENSE
3
+ include SERVICE_README.md
4
+ include QUICK_START.md
5
+ include requirements.txt
6
+ include install.sh
7
+ include queuemgr.service
8
+ recursive-include queuemgr/examples *.py
9
+ recursive-include docs *.md
10
+ recursive-include tests *.py
11
+ global-exclude __pycache__
12
+ global-exclude *.py[co]
13
+ global-exclude *.log
14
+ global-exclude *.pid
15
+ global-exclude *.jsonl
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: queuemgr
3
+ Version: 1.0.0
4
+ Summary: Full-featured job queue system with multiprocessing support for Linux
5
+ Home-page: https://github.com/vasilyvz/queuemgr
6
+ Author: Vasiliy Zdanovskiy
7
+ Author-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/vasilyvz/queuemgr
10
+ Project-URL: Repository, https://github.com/vasilyvz/queuemgr
11
+ Project-URL: Documentation, https://github.com/vasilyvz/queuemgr#readme
12
+ Project-URL: Bug Tracker, https://github.com/vasilyvz/queuemgr/issues
13
+ Keywords: job-queue,multiprocessing,task-scheduler,linux,systemd
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Topic :: System :: Distributed Computing
25
+ Classifier: Topic :: System :: Systems Administration
26
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
27
+ Classifier: Topic :: Scientific/Engineering
28
+ Requires-Python: >=3.10
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
33
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
34
+ Requires-Dist: black>=23.0.0; extra == "dev"
35
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
36
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
37
+ Provides-Extra: web
38
+ Requires-Dist: flask>=2.0.0; extra == "web"
39
+ Provides-Extra: examples
40
+ Requires-Dist: requests>=2.25.0; extra == "examples"
41
+ Dynamic: author
42
+ Dynamic: home-page
43
+ Dynamic: license-file
44
+ Dynamic: requires-python
45
+
46
+ # Queue Manager
47
+
48
+ A Python-based job queue system with per-job processes and signal variables.
49
+
50
+ ## Features
51
+
52
+ - **Per-Job Processes**: Each job runs in its own OS process for isolation
53
+ - **Signal Variables**: Jobs communicate via shared state protected by mutexes
54
+ - **Registry Persistence**: Job states and results are persisted to a registry
55
+ - **Process Control**: Start, stop, and delete jobs with graceful termination
56
+ - **Progress Tracking**: Real-time progress updates and status monitoring
57
+ - **Error Handling**: Comprehensive error handling and recovery mechanisms
58
+
59
+ ## Installation
60
+
61
+ ```bash
62
+ pip install queuemgr
63
+ ```
64
+
65
+ ## Quick Start
66
+
67
+ ```python
68
+ from queuemgr.queue.job_queue import JobQueue
69
+ from queuemgr.core.registry import JsonlRegistry
70
+ from queuemgr.jobs.base import QueueJobBase
71
+ from queuemgr.core.types import JobStatus
72
+ from queuemgr.core.ipc import update_job_state
73
+
74
+ class MyJob(QueueJobBase):
75
+ def execute(self):
76
+ # Your job logic here
77
+ for i in range(100):
78
+ update_job_state(
79
+ self._shared_state,
80
+ progress=i,
81
+ description=f"Processing item {i}"
82
+ )
83
+
84
+ def on_start(self):
85
+ update_job_state(self._shared_state, description="Job started")
86
+
87
+ def on_stop(self):
88
+ update_job_state(self._shared_state, description="Job stopped")
89
+
90
+ def on_end(self):
91
+ update_job_state(self._shared_state, description="Job completed")
92
+
93
+ def on_error(self, exc):
94
+ update_job_state(self._shared_state, description=f"Job failed: {exc}")
95
+
96
+ # Create queue and job
97
+ registry = JsonlRegistry("my_registry.jsonl")
98
+ queue = JobQueue(registry)
99
+ job = MyJob("my-job-1", {"param": "value"})
100
+
101
+ # Add and start job
102
+ queue.add_job(job)
103
+ queue.start_job("my-job-1")
104
+
105
+ # Monitor progress
106
+ status = queue.get_job_status("my-job-1")
107
+ print(f"Status: {status.status}, Progress: {status.progress}%")
108
+ ```
109
+
110
+ ## Examples
111
+
112
+ See the `examples/` directory for complete examples:
113
+
114
+ - `simple_job.py` - Basic job creation and execution
115
+ - `error_handling_job.py` - Error handling and recovery
116
+ - `progress_job.py` - Long-running job with progress updates
117
+ - `registry_example.py` - Registry functionality and job history
118
+
119
+ ## Development
120
+
121
+ ```bash
122
+ # Install development dependencies
123
+ pip install -e ".[dev]"
124
+
125
+ # Run tests
126
+ pytest
127
+
128
+ # Run tests with coverage
129
+ pytest --cov=queuemgr
130
+
131
+ # Format code
132
+ black queuemgr tests
133
+
134
+ # Lint code
135
+ flake8 queuemgr tests
136
+
137
+ # Type check
138
+ mypy queuemgr
139
+ ```
140
+
141
+ ## License
142
+
143
+ MIT License - see LICENSE file for details.
144
+
145
+ ## Author
146
+
147
+ Vasiliy Zdanovskiy - vasilyvz@gmail.com
148
+ # vvz-queuemgr
@@ -0,0 +1,118 @@
1
+ # 🚀 Queue Manager - Быстрый старт
2
+
3
+ ## Что это?
4
+
5
+ Queue Manager - это полнофункциональная система управления очередями заданий для Linux с поддержкой multiprocessing, systemd интеграцией и веб-интерфейсом.
6
+
7
+ ## ⚡ Быстрая установка
8
+
9
+ ```bash
10
+ # Клонируйте репозиторий
11
+ git clone https://github.com/YOUR_USERNAME/queuemgr.git
12
+ cd queuemgr
13
+
14
+ # Установите сервис (требуются права root)
15
+ sudo ./install.sh
16
+ ```
17
+
18
+ ## 🎯 Основные возможности
19
+
20
+ - **🚀 Автоматическое управление процессами** - каждое задание выполняется в отдельном процессе
21
+ - **📊 Мониторинг в реальном времени** - отслеживание статуса и прогресса заданий
22
+ - **🖥️ Множественные интерфейсы** - CLI, веб-интерфейс, systemd сервис
23
+ - **⚙️ Systemd интеграция** - автозапуск и управление через systemctl
24
+ - **🔧 Обработка ошибок** - автоматическое восстановление и graceful shutdown
25
+ - **📈 Масштабируемость** - поддержка множества параллельных заданий
26
+
27
+ ## 🛠️ Типы заданий
28
+
29
+ - **Обработка данных** - большие датасеты, ETL процессы
30
+ - **Файловые операции** - копирование, перемещение, архивирование
31
+ - **API вызовы** - интеграция с внешними сервисами
32
+ - **Операции с БД** - запросы, обновления, миграции
33
+ - **Мониторинг** - сбор метрик, алерты, отчеты
34
+
35
+ ## 📋 Управление сервисом
36
+
37
+ ```bash
38
+ # Статус сервиса
39
+ sudo systemctl status queuemgr
40
+
41
+ # Запуск/остановка
42
+ sudo systemctl start queuemgr
43
+ sudo systemctl stop queuemgr
44
+
45
+ # Просмотр логов
46
+ sudo journalctl -u queuemgr -f
47
+ ```
48
+
49
+ ## 🖥️ Интерфейсы
50
+
51
+ ### CLI
52
+ ```bash
53
+ # Управление заданиями
54
+ /opt/queuemgr/.venv/bin/python -m queuemgr.service.cli job list
55
+ /opt/queuemgr/.venv/bin/python -m queuemgr.service.cli job add
56
+ /opt/queuemgr/.venv/bin/python -m queuemgr.service.cli monitor
57
+ ```
58
+
59
+ ### Веб-интерфейс
60
+ ```bash
61
+ # Запуск веб-интерфейса
62
+ /opt/queuemgr/.venv/bin/python -m queuemgr.service.web
63
+
64
+ # Откройте в браузере: http://localhost:5000
65
+ ```
66
+
67
+ ## 📚 Примеры использования
68
+
69
+ ```python
70
+ from queuemgr.proc_api import proc_queue_system
71
+ from queuemgr.jobs.base import QueueJobBase
72
+
73
+ class MyJob(QueueJobBase):
74
+ def execute(self):
75
+ print(f"Выполняю задание {self.job_id}")
76
+ # Ваша логика здесь
77
+
78
+ def on_start(self):
79
+ print("Задание запущено")
80
+
81
+ def on_end(self):
82
+ print("Задание завершено")
83
+
84
+ # Использование
85
+ with proc_queue_system() as queue:
86
+ queue.add_job(MyJob, "my-job-1", {"param": "value"})
87
+ queue.start_job("my-job-1")
88
+ ```
89
+
90
+ ## 📖 Документация
91
+
92
+ - [Полная документация](SERVICE_README.md)
93
+ - [Техническая спецификация](docs/tech_spec.md)
94
+ - [Примеры использования](queuemgr/examples/)
95
+
96
+ ## 🎯 Готово к продакшну
97
+
98
+ - ✅ Все тесты проходят
99
+ - ✅ Код отформатирован и проверен
100
+ - ✅ Полная документация
101
+ - ✅ Примеры использования
102
+ - ✅ Systemd интеграция
103
+ - ✅ Обработка ошибок
104
+
105
+ ## 🤝 Вклад в проект
106
+
107
+ 1. Fork репозитория
108
+ 2. Создайте feature branch
109
+ 3. Внесите изменения
110
+ 4. Создайте Pull Request
111
+
112
+ ## 📄 Лицензия
113
+
114
+ MIT License - см. файл LICENSE
115
+
116
+ ---
117
+
118
+ **Queue Manager** - надежная система управления очередями заданий для Linux! 🚀
@@ -0,0 +1,103 @@
1
+ # Queue Manager
2
+
3
+ A Python-based job queue system with per-job processes and signal variables.
4
+
5
+ ## Features
6
+
7
+ - **Per-Job Processes**: Each job runs in its own OS process for isolation
8
+ - **Signal Variables**: Jobs communicate via shared state protected by mutexes
9
+ - **Registry Persistence**: Job states and results are persisted to a registry
10
+ - **Process Control**: Start, stop, and delete jobs with graceful termination
11
+ - **Progress Tracking**: Real-time progress updates and status monitoring
12
+ - **Error Handling**: Comprehensive error handling and recovery mechanisms
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pip install queuemgr
18
+ ```
19
+
20
+ ## Quick Start
21
+
22
+ ```python
23
+ from queuemgr.queue.job_queue import JobQueue
24
+ from queuemgr.core.registry import JsonlRegistry
25
+ from queuemgr.jobs.base import QueueJobBase
26
+ from queuemgr.core.types import JobStatus
27
+ from queuemgr.core.ipc import update_job_state
28
+
29
+ class MyJob(QueueJobBase):
30
+ def execute(self):
31
+ # Your job logic here
32
+ for i in range(100):
33
+ update_job_state(
34
+ self._shared_state,
35
+ progress=i,
36
+ description=f"Processing item {i}"
37
+ )
38
+
39
+ def on_start(self):
40
+ update_job_state(self._shared_state, description="Job started")
41
+
42
+ def on_stop(self):
43
+ update_job_state(self._shared_state, description="Job stopped")
44
+
45
+ def on_end(self):
46
+ update_job_state(self._shared_state, description="Job completed")
47
+
48
+ def on_error(self, exc):
49
+ update_job_state(self._shared_state, description=f"Job failed: {exc}")
50
+
51
+ # Create queue and job
52
+ registry = JsonlRegistry("my_registry.jsonl")
53
+ queue = JobQueue(registry)
54
+ job = MyJob("my-job-1", {"param": "value"})
55
+
56
+ # Add and start job
57
+ queue.add_job(job)
58
+ queue.start_job("my-job-1")
59
+
60
+ # Monitor progress
61
+ status = queue.get_job_status("my-job-1")
62
+ print(f"Status: {status.status}, Progress: {status.progress}%")
63
+ ```
64
+
65
+ ## Examples
66
+
67
+ See the `examples/` directory for complete examples:
68
+
69
+ - `simple_job.py` - Basic job creation and execution
70
+ - `error_handling_job.py` - Error handling and recovery
71
+ - `progress_job.py` - Long-running job with progress updates
72
+ - `registry_example.py` - Registry functionality and job history
73
+
74
+ ## Development
75
+
76
+ ```bash
77
+ # Install development dependencies
78
+ pip install -e ".[dev]"
79
+
80
+ # Run tests
81
+ pytest
82
+
83
+ # Run tests with coverage
84
+ pytest --cov=queuemgr
85
+
86
+ # Format code
87
+ black queuemgr tests
88
+
89
+ # Lint code
90
+ flake8 queuemgr tests
91
+
92
+ # Type check
93
+ mypy queuemgr
94
+ ```
95
+
96
+ ## License
97
+
98
+ MIT License - see LICENSE file for details.
99
+
100
+ ## Author
101
+
102
+ Vasiliy Zdanovskiy - vasilyvz@gmail.com
103
+ # vvz-queuemgr