pemexe 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.
- pemexe-0.1.0/LICENSE +21 -0
- pemexe-0.1.0/PKG-INFO +275 -0
- pemexe-0.1.0/README.md +258 -0
- pemexe-0.1.0/pem/__init__.py +0 -0
- pemexe-0.1.0/pem/cli.py +385 -0
- pemexe-0.1.0/pem/core/__init__.py +0 -0
- pemexe-0.1.0/pem/core/executor.py +82 -0
- pemexe-0.1.0/pem/core/scheduler.py +251 -0
- pemexe-0.1.0/pem/db/__init__.py +0 -0
- pemexe-0.1.0/pem/db/database.py +14 -0
- pemexe-0.1.0/pem/db/models.py +51 -0
- pemexe-0.1.0/pem/settings.py +3 -0
- pemexe-0.1.0/pemexe.egg-info/PKG-INFO +275 -0
- pemexe-0.1.0/pemexe.egg-info/SOURCES.txt +18 -0
- pemexe-0.1.0/pemexe.egg-info/dependency_links.txt +1 -0
- pemexe-0.1.0/pemexe.egg-info/entry_points.txt +2 -0
- pemexe-0.1.0/pemexe.egg-info/requires.txt +4 -0
- pemexe-0.1.0/pemexe.egg-info/top_level.txt +1 -0
- pemexe-0.1.0/pyproject.toml +33 -0
- pemexe-0.1.0/setup.cfg +4 -0
pemexe-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Arian Omrani
|
|
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.
|
pemexe-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pemexe
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 🚀 Python Execution Manager - A powerful, modern tool for managing, scheduling, and executing Python scripts and projects with comprehensive logging, flexible scheduling, and dependency management. Perfect for DevOps, data science, and automation workflows.
|
|
5
|
+
Author: Arian Omrani
|
|
6
|
+
Project-URL: Homepage, https://github.com/arian24b/pem
|
|
7
|
+
Project-URL: Issues, https://github.com/arian24b/pem/issues
|
|
8
|
+
Keywords: python,scheduler,automation,devops,task-runner,cron,execution,management,scripts,projects,cli,background-jobs,logging,dependencies
|
|
9
|
+
Requires-Python: >=3.13
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: apscheduler>=3.11.0
|
|
13
|
+
Requires-Dist: sqlalchemy>=2.0.41
|
|
14
|
+
Requires-Dist: typer>=0.16.0
|
|
15
|
+
Requires-Dist: uv>=0.8.2
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# PEM - Python Execution Manager 🚀
|
|
19
|
+
|
|
20
|
+
**A powerful, modern Python tool for managing, scheduling, and executing Python scripts and projects with ease.**
|
|
21
|
+
|
|
22
|
+
[](https://www.python.org/downloads/)
|
|
23
|
+
[](LICENSE)
|
|
24
|
+
[](https://github.com/astral-sh/uv)
|
|
25
|
+
|
|
26
|
+
## ✨ What is PEM?
|
|
27
|
+
|
|
28
|
+
PEM is your all-in-one solution for Python execution management. Whether you're running one-off scripts, managing complex projects, or scheduling automated tasks, PEM makes it simple and reliable.
|
|
29
|
+
|
|
30
|
+
### 🎯 Perfect for:
|
|
31
|
+
- **DevOps Engineers** managing deployment scripts and automation
|
|
32
|
+
- **Data Scientists** running scheduled data processing jobs
|
|
33
|
+
- **Python Developers** organizing and executing multiple projects
|
|
34
|
+
- **System Administrators** automating maintenance tasks
|
|
35
|
+
- **Anyone** who needs reliable Python script execution with logging
|
|
36
|
+
|
|
37
|
+
## 🌟 Key Features
|
|
38
|
+
|
|
39
|
+
### 📋 **Job Management**
|
|
40
|
+
- **Two Job Types**: Handle both standalone scripts and full Python projects
|
|
41
|
+
- **Dependency Management**: Automatically install and manage script dependencies using `uv`
|
|
42
|
+
- **Smart Execution**: Uses `uv run` for fast, isolated script execution
|
|
43
|
+
- **Project Support**: Full support for Python projects with virtual environments
|
|
44
|
+
|
|
45
|
+
### ⏰ **Flexible Scheduling**
|
|
46
|
+
- **Multiple Schedule Types**:
|
|
47
|
+
- `once` - Run at a specific date/time
|
|
48
|
+
- `interval` - Run every X seconds/minutes/hours/days
|
|
49
|
+
- `cron` - Use cron expressions for complex schedules
|
|
50
|
+
- `until_done` - Keep retrying until the job succeeds
|
|
51
|
+
- **Background Execution**: All scheduled jobs run in the background
|
|
52
|
+
- **Persistent Storage**: Schedules survive system restarts
|
|
53
|
+
|
|
54
|
+
### 📊 **Comprehensive Logging & Tracking**
|
|
55
|
+
- **Detailed Logs**: Every execution is logged with timestamps and output
|
|
56
|
+
- **Execution History**: Track all job runs with status, exit codes, and timing
|
|
57
|
+
- **SQLite Database**: Local storage for jobs, schedules, and execution history
|
|
58
|
+
- **Real-time Status**: See what's running, what succeeded, and what failed
|
|
59
|
+
|
|
60
|
+
### 🛠 **Developer-Friendly CLI**
|
|
61
|
+
- **Intuitive Commands**: Simple, memorable command structure
|
|
62
|
+
- **Rich Output**: Colored terminal output with emojis for better UX
|
|
63
|
+
- **Flexible Options**: Extensive command-line options for all use cases
|
|
64
|
+
- **Built with Typer**: Modern, type-safe CLI framework
|
|
65
|
+
|
|
66
|
+
## 🚀 Quick Start
|
|
67
|
+
|
|
68
|
+
### Installation
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Install PEM
|
|
72
|
+
pip install pem
|
|
73
|
+
|
|
74
|
+
# Or using uv (recommended)
|
|
75
|
+
uv add pem
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Basic Usage
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Run a Python script with dependencies
|
|
82
|
+
pem run my-data-script --script --path ./data_processor.py --with pandas --with requests
|
|
83
|
+
|
|
84
|
+
# Add a project job
|
|
85
|
+
pem run my-web-app --project --path ./my-flask-app --add-only
|
|
86
|
+
|
|
87
|
+
# Schedule a job to run every hour
|
|
88
|
+
pem schedule my-data-script --type interval --hours 1
|
|
89
|
+
|
|
90
|
+
# List all jobs
|
|
91
|
+
pem list
|
|
92
|
+
|
|
93
|
+
# View job execution history
|
|
94
|
+
pem history my-data-script
|
|
95
|
+
|
|
96
|
+
# Check scheduler status
|
|
97
|
+
pem status
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 📖 Detailed Usage
|
|
101
|
+
|
|
102
|
+
### Managing Jobs
|
|
103
|
+
|
|
104
|
+
#### Script Jobs
|
|
105
|
+
Perfect for standalone Python scripts with specific dependencies:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Add and run a script with dependencies
|
|
109
|
+
pem run data-processor \
|
|
110
|
+
--script \
|
|
111
|
+
--path ./scripts/process_data.py \
|
|
112
|
+
--with pandas \
|
|
113
|
+
--with requests \
|
|
114
|
+
--with beautifulsoup4
|
|
115
|
+
|
|
116
|
+
# Just add the job without running
|
|
117
|
+
pem run backup-script --script --path ./backup.py --add-only
|
|
118
|
+
|
|
119
|
+
# Run an existing job
|
|
120
|
+
pem run backup-script --run-only
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### Project Jobs
|
|
124
|
+
For full Python projects with their own environments:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Add a Python project
|
|
128
|
+
pem run my-api --project --path ./my-fastapi-project --add-only
|
|
129
|
+
|
|
130
|
+
# Run the project (will use project's own dependencies)
|
|
131
|
+
pem run my-api --run-only
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Scheduling Jobs
|
|
135
|
+
|
|
136
|
+
#### One-time Execution
|
|
137
|
+
```bash
|
|
138
|
+
# Run once at a specific time
|
|
139
|
+
pem schedule backup-job --type once --date "2025-12-31 23:59:59"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Interval-based Scheduling
|
|
143
|
+
```bash
|
|
144
|
+
# Every 30 minutes
|
|
145
|
+
pem schedule data-sync --type interval --minutes 30
|
|
146
|
+
|
|
147
|
+
# Every 2 hours
|
|
148
|
+
pem schedule hourly-report --type interval --hours 2
|
|
149
|
+
|
|
150
|
+
# Every day
|
|
151
|
+
pem schedule daily-backup --type interval --days 1
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### Cron-style Scheduling
|
|
155
|
+
```bash
|
|
156
|
+
# Every weekday at 9 AM
|
|
157
|
+
pem schedule morning-report --type cron --cron-hour 9 --cron-dow 1-5
|
|
158
|
+
|
|
159
|
+
# Every Monday at midnight
|
|
160
|
+
pem schedule weekly-cleanup --type cron --cron-hour 0 --cron-dow 1
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### Retry Until Success
|
|
164
|
+
```bash
|
|
165
|
+
# Keep trying every 5 minutes until it succeeds (max 20 attempts)
|
|
166
|
+
pem schedule critical-task --type until_done --retry-interval 300 --max-retries 20
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Monitoring & Management
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# List all jobs
|
|
173
|
+
pem list
|
|
174
|
+
|
|
175
|
+
# Show job details
|
|
176
|
+
pem show my-job
|
|
177
|
+
|
|
178
|
+
# View execution history
|
|
179
|
+
pem history my-job
|
|
180
|
+
|
|
181
|
+
# Check what's scheduled and running
|
|
182
|
+
pem status
|
|
183
|
+
|
|
184
|
+
# Enable/disable jobs
|
|
185
|
+
pem enable my-job
|
|
186
|
+
pem disable my-job
|
|
187
|
+
|
|
188
|
+
# Remove jobs
|
|
189
|
+
pem remove my-job
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## 🏗 Architecture
|
|
193
|
+
|
|
194
|
+
PEM is built with modern Python best practices:
|
|
195
|
+
|
|
196
|
+
- **SQLAlchemy**: Robust database ORM for job and execution tracking
|
|
197
|
+
- **APScheduler**: Reliable job scheduling with multiple backends
|
|
198
|
+
- **Typer**: Type-safe, intuitive CLI framework
|
|
199
|
+
- **uv**: Fast Python package management and script execution
|
|
200
|
+
- **AsyncIO**: Efficient asynchronous execution
|
|
201
|
+
|
|
202
|
+
## 📁 Project Structure
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
pem/
|
|
206
|
+
├── pem/
|
|
207
|
+
│ ├── cli.py # Command-line interface
|
|
208
|
+
│ ├── main.py # Application entry point
|
|
209
|
+
│ ├── settings.py # Configuration
|
|
210
|
+
│ ├── core/
|
|
211
|
+
│ │ ├── executor.py # Job execution engine
|
|
212
|
+
│ │ └── scheduler.py # Background scheduling
|
|
213
|
+
│ └── db/
|
|
214
|
+
│ ├── database.py # Database configuration
|
|
215
|
+
│ └── models.py # SQLAlchemy models
|
|
216
|
+
├── logs/ # Execution logs
|
|
217
|
+
├── pem.db # SQLite database
|
|
218
|
+
└── pyproject.toml # Project configuration
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## 🔧 Configuration
|
|
222
|
+
|
|
223
|
+
PEM works out of the box with sensible defaults:
|
|
224
|
+
|
|
225
|
+
- **Database**: SQLite (`pem.db`) in the current directory
|
|
226
|
+
- **Logs**: Stored in `./logs/` directory
|
|
227
|
+
- **Virtual Environments**: Created in project directories as `.pem_venv`
|
|
228
|
+
|
|
229
|
+
## 🤝 Contributing
|
|
230
|
+
|
|
231
|
+
We welcome contributions! Here's how to get started:
|
|
232
|
+
|
|
233
|
+
1. Fork the repository
|
|
234
|
+
2. Create a feature branch: `git checkout -b my-new-feature`
|
|
235
|
+
3. Make your changes and add tests
|
|
236
|
+
4. Run the test suite: `pytest`
|
|
237
|
+
5. Submit a pull request
|
|
238
|
+
|
|
239
|
+
## 📝 License
|
|
240
|
+
|
|
241
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
242
|
+
|
|
243
|
+
## 🙋♀️ Support
|
|
244
|
+
|
|
245
|
+
- **Issues**: [GitHub Issues](https://github.com/arian24b/pem/issues)
|
|
246
|
+
- **Discussions**: [GitHub Discussions](https://github.com/arian24b/pem/discussions)
|
|
247
|
+
|
|
248
|
+
## 🚀 Why Choose PEM?
|
|
249
|
+
|
|
250
|
+
### vs. Cron
|
|
251
|
+
- ✅ Cross-platform (works on Windows, macOS, Linux)
|
|
252
|
+
- ✅ Dependency management built-in
|
|
253
|
+
- ✅ Detailed logging and execution history
|
|
254
|
+
- ✅ Easy job management with CLI
|
|
255
|
+
- ✅ Python-native (no shell scripting needed)
|
|
256
|
+
|
|
257
|
+
### vs. Other Task Runners
|
|
258
|
+
- ✅ Specifically designed for Python
|
|
259
|
+
- ✅ No complex configuration files
|
|
260
|
+
- ✅ Built-in dependency isolation
|
|
261
|
+
- ✅ Simple CLI interface
|
|
262
|
+
- ✅ Local database storage (no external dependencies)
|
|
263
|
+
|
|
264
|
+
### vs. Manual Script Running
|
|
265
|
+
- ✅ Automated scheduling
|
|
266
|
+
- ✅ Execution history and monitoring
|
|
267
|
+
- ✅ Dependency management
|
|
268
|
+
- ✅ Error handling and retries
|
|
269
|
+
- ✅ Centralized job management
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
**Made with ❤️ by [Arian Omrani](https://github.com/arian24b)**
|
|
274
|
+
|
|
275
|
+
*PEM - Making Python execution management simple, reliable, and powerful.*
|
pemexe-0.1.0/README.md
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# PEM - Python Execution Manager 🚀
|
|
2
|
+
|
|
3
|
+
**A powerful, modern Python tool for managing, scheduling, and executing Python scripts and projects with ease.**
|
|
4
|
+
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://github.com/astral-sh/uv)
|
|
8
|
+
|
|
9
|
+
## ✨ What is PEM?
|
|
10
|
+
|
|
11
|
+
PEM is your all-in-one solution for Python execution management. Whether you're running one-off scripts, managing complex projects, or scheduling automated tasks, PEM makes it simple and reliable.
|
|
12
|
+
|
|
13
|
+
### 🎯 Perfect for:
|
|
14
|
+
- **DevOps Engineers** managing deployment scripts and automation
|
|
15
|
+
- **Data Scientists** running scheduled data processing jobs
|
|
16
|
+
- **Python Developers** organizing and executing multiple projects
|
|
17
|
+
- **System Administrators** automating maintenance tasks
|
|
18
|
+
- **Anyone** who needs reliable Python script execution with logging
|
|
19
|
+
|
|
20
|
+
## 🌟 Key Features
|
|
21
|
+
|
|
22
|
+
### 📋 **Job Management**
|
|
23
|
+
- **Two Job Types**: Handle both standalone scripts and full Python projects
|
|
24
|
+
- **Dependency Management**: Automatically install and manage script dependencies using `uv`
|
|
25
|
+
- **Smart Execution**: Uses `uv run` for fast, isolated script execution
|
|
26
|
+
- **Project Support**: Full support for Python projects with virtual environments
|
|
27
|
+
|
|
28
|
+
### ⏰ **Flexible Scheduling**
|
|
29
|
+
- **Multiple Schedule Types**:
|
|
30
|
+
- `once` - Run at a specific date/time
|
|
31
|
+
- `interval` - Run every X seconds/minutes/hours/days
|
|
32
|
+
- `cron` - Use cron expressions for complex schedules
|
|
33
|
+
- `until_done` - Keep retrying until the job succeeds
|
|
34
|
+
- **Background Execution**: All scheduled jobs run in the background
|
|
35
|
+
- **Persistent Storage**: Schedules survive system restarts
|
|
36
|
+
|
|
37
|
+
### 📊 **Comprehensive Logging & Tracking**
|
|
38
|
+
- **Detailed Logs**: Every execution is logged with timestamps and output
|
|
39
|
+
- **Execution History**: Track all job runs with status, exit codes, and timing
|
|
40
|
+
- **SQLite Database**: Local storage for jobs, schedules, and execution history
|
|
41
|
+
- **Real-time Status**: See what's running, what succeeded, and what failed
|
|
42
|
+
|
|
43
|
+
### 🛠 **Developer-Friendly CLI**
|
|
44
|
+
- **Intuitive Commands**: Simple, memorable command structure
|
|
45
|
+
- **Rich Output**: Colored terminal output with emojis for better UX
|
|
46
|
+
- **Flexible Options**: Extensive command-line options for all use cases
|
|
47
|
+
- **Built with Typer**: Modern, type-safe CLI framework
|
|
48
|
+
|
|
49
|
+
## 🚀 Quick Start
|
|
50
|
+
|
|
51
|
+
### Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Install PEM
|
|
55
|
+
pip install pem
|
|
56
|
+
|
|
57
|
+
# Or using uv (recommended)
|
|
58
|
+
uv add pem
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Basic Usage
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Run a Python script with dependencies
|
|
65
|
+
pem run my-data-script --script --path ./data_processor.py --with pandas --with requests
|
|
66
|
+
|
|
67
|
+
# Add a project job
|
|
68
|
+
pem run my-web-app --project --path ./my-flask-app --add-only
|
|
69
|
+
|
|
70
|
+
# Schedule a job to run every hour
|
|
71
|
+
pem schedule my-data-script --type interval --hours 1
|
|
72
|
+
|
|
73
|
+
# List all jobs
|
|
74
|
+
pem list
|
|
75
|
+
|
|
76
|
+
# View job execution history
|
|
77
|
+
pem history my-data-script
|
|
78
|
+
|
|
79
|
+
# Check scheduler status
|
|
80
|
+
pem status
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 📖 Detailed Usage
|
|
84
|
+
|
|
85
|
+
### Managing Jobs
|
|
86
|
+
|
|
87
|
+
#### Script Jobs
|
|
88
|
+
Perfect for standalone Python scripts with specific dependencies:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Add and run a script with dependencies
|
|
92
|
+
pem run data-processor \
|
|
93
|
+
--script \
|
|
94
|
+
--path ./scripts/process_data.py \
|
|
95
|
+
--with pandas \
|
|
96
|
+
--with requests \
|
|
97
|
+
--with beautifulsoup4
|
|
98
|
+
|
|
99
|
+
# Just add the job without running
|
|
100
|
+
pem run backup-script --script --path ./backup.py --add-only
|
|
101
|
+
|
|
102
|
+
# Run an existing job
|
|
103
|
+
pem run backup-script --run-only
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### Project Jobs
|
|
107
|
+
For full Python projects with their own environments:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Add a Python project
|
|
111
|
+
pem run my-api --project --path ./my-fastapi-project --add-only
|
|
112
|
+
|
|
113
|
+
# Run the project (will use project's own dependencies)
|
|
114
|
+
pem run my-api --run-only
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Scheduling Jobs
|
|
118
|
+
|
|
119
|
+
#### One-time Execution
|
|
120
|
+
```bash
|
|
121
|
+
# Run once at a specific time
|
|
122
|
+
pem schedule backup-job --type once --date "2025-12-31 23:59:59"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### Interval-based Scheduling
|
|
126
|
+
```bash
|
|
127
|
+
# Every 30 minutes
|
|
128
|
+
pem schedule data-sync --type interval --minutes 30
|
|
129
|
+
|
|
130
|
+
# Every 2 hours
|
|
131
|
+
pem schedule hourly-report --type interval --hours 2
|
|
132
|
+
|
|
133
|
+
# Every day
|
|
134
|
+
pem schedule daily-backup --type interval --days 1
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Cron-style Scheduling
|
|
138
|
+
```bash
|
|
139
|
+
# Every weekday at 9 AM
|
|
140
|
+
pem schedule morning-report --type cron --cron-hour 9 --cron-dow 1-5
|
|
141
|
+
|
|
142
|
+
# Every Monday at midnight
|
|
143
|
+
pem schedule weekly-cleanup --type cron --cron-hour 0 --cron-dow 1
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### Retry Until Success
|
|
147
|
+
```bash
|
|
148
|
+
# Keep trying every 5 minutes until it succeeds (max 20 attempts)
|
|
149
|
+
pem schedule critical-task --type until_done --retry-interval 300 --max-retries 20
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Monitoring & Management
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# List all jobs
|
|
156
|
+
pem list
|
|
157
|
+
|
|
158
|
+
# Show job details
|
|
159
|
+
pem show my-job
|
|
160
|
+
|
|
161
|
+
# View execution history
|
|
162
|
+
pem history my-job
|
|
163
|
+
|
|
164
|
+
# Check what's scheduled and running
|
|
165
|
+
pem status
|
|
166
|
+
|
|
167
|
+
# Enable/disable jobs
|
|
168
|
+
pem enable my-job
|
|
169
|
+
pem disable my-job
|
|
170
|
+
|
|
171
|
+
# Remove jobs
|
|
172
|
+
pem remove my-job
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## 🏗 Architecture
|
|
176
|
+
|
|
177
|
+
PEM is built with modern Python best practices:
|
|
178
|
+
|
|
179
|
+
- **SQLAlchemy**: Robust database ORM for job and execution tracking
|
|
180
|
+
- **APScheduler**: Reliable job scheduling with multiple backends
|
|
181
|
+
- **Typer**: Type-safe, intuitive CLI framework
|
|
182
|
+
- **uv**: Fast Python package management and script execution
|
|
183
|
+
- **AsyncIO**: Efficient asynchronous execution
|
|
184
|
+
|
|
185
|
+
## 📁 Project Structure
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
pem/
|
|
189
|
+
├── pem/
|
|
190
|
+
│ ├── cli.py # Command-line interface
|
|
191
|
+
│ ├── main.py # Application entry point
|
|
192
|
+
│ ├── settings.py # Configuration
|
|
193
|
+
│ ├── core/
|
|
194
|
+
│ │ ├── executor.py # Job execution engine
|
|
195
|
+
│ │ └── scheduler.py # Background scheduling
|
|
196
|
+
│ └── db/
|
|
197
|
+
│ ├── database.py # Database configuration
|
|
198
|
+
│ └── models.py # SQLAlchemy models
|
|
199
|
+
├── logs/ # Execution logs
|
|
200
|
+
├── pem.db # SQLite database
|
|
201
|
+
└── pyproject.toml # Project configuration
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## 🔧 Configuration
|
|
205
|
+
|
|
206
|
+
PEM works out of the box with sensible defaults:
|
|
207
|
+
|
|
208
|
+
- **Database**: SQLite (`pem.db`) in the current directory
|
|
209
|
+
- **Logs**: Stored in `./logs/` directory
|
|
210
|
+
- **Virtual Environments**: Created in project directories as `.pem_venv`
|
|
211
|
+
|
|
212
|
+
## 🤝 Contributing
|
|
213
|
+
|
|
214
|
+
We welcome contributions! Here's how to get started:
|
|
215
|
+
|
|
216
|
+
1. Fork the repository
|
|
217
|
+
2. Create a feature branch: `git checkout -b my-new-feature`
|
|
218
|
+
3. Make your changes and add tests
|
|
219
|
+
4. Run the test suite: `pytest`
|
|
220
|
+
5. Submit a pull request
|
|
221
|
+
|
|
222
|
+
## 📝 License
|
|
223
|
+
|
|
224
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
225
|
+
|
|
226
|
+
## 🙋♀️ Support
|
|
227
|
+
|
|
228
|
+
- **Issues**: [GitHub Issues](https://github.com/arian24b/pem/issues)
|
|
229
|
+
- **Discussions**: [GitHub Discussions](https://github.com/arian24b/pem/discussions)
|
|
230
|
+
|
|
231
|
+
## 🚀 Why Choose PEM?
|
|
232
|
+
|
|
233
|
+
### vs. Cron
|
|
234
|
+
- ✅ Cross-platform (works on Windows, macOS, Linux)
|
|
235
|
+
- ✅ Dependency management built-in
|
|
236
|
+
- ✅ Detailed logging and execution history
|
|
237
|
+
- ✅ Easy job management with CLI
|
|
238
|
+
- ✅ Python-native (no shell scripting needed)
|
|
239
|
+
|
|
240
|
+
### vs. Other Task Runners
|
|
241
|
+
- ✅ Specifically designed for Python
|
|
242
|
+
- ✅ No complex configuration files
|
|
243
|
+
- ✅ Built-in dependency isolation
|
|
244
|
+
- ✅ Simple CLI interface
|
|
245
|
+
- ✅ Local database storage (no external dependencies)
|
|
246
|
+
|
|
247
|
+
### vs. Manual Script Running
|
|
248
|
+
- ✅ Automated scheduling
|
|
249
|
+
- ✅ Execution history and monitoring
|
|
250
|
+
- ✅ Dependency management
|
|
251
|
+
- ✅ Error handling and retries
|
|
252
|
+
- ✅ Centralized job management
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
**Made with ❤️ by [Arian Omrani](https://github.com/arian24b)**
|
|
257
|
+
|
|
258
|
+
*PEM - Making Python execution management simple, reliable, and powerful.*
|
|
File without changes
|