A tmux-based task scheduling and monitoring tool
Project description
Task Management System
A tmux-based task scheduling and monitoring tool with support for concurrent execution, real-time monitoring, email notifications, and more.
Features
- 🚀 Concurrent execution of multiple tasks
- 📊 Real-time monitoring and status viewing
- 🛠️ System resource monitoring (CPU, memory, disk)
- 📝 Automatic log management
- 📧 Email notifications (optional)
- 🔧 Simple configuration management
Quick Start
Step 1: Install
# Install from PyPI
pip install lite-slurm
# Or install from source
git clone <repository-url>
cd slurm-like-task-manager
pip install -e .
Requirements: Python 3.7+ and tmux (install with sudo apt-get install tmux or brew install tmux)
Step 2: Initialize
task config init
Step 3: Run Your First Task
# Run a task
task run "My Task" "python my_script.py"
# List tasks
task list
# Monitor task output
task monitor <task_id>
# Stop task
task kill <task_id>
# Clean a task
task cleanup <task_id>
That's it! You're ready to use the task manager.
Installation
From PyPI
pip install lite-slurm
task config init
From Source
git clone <repository-url>
cd slurm-like-task-manager
pip install -r requirements.txt
pip install -e .
task config init
System Requirements
- Python 3.7+
- tmux (install:
sudo apt-get install tmux/brew install tmux)
Usage
Basic Commands
# Run task
task run "Task Name" "command to execute"
# List tasks
task list # All tasks
task list --status running # Filter by status
task list --resources # Show system resources
# Monitor task
task monitor <task_id> # Real-time monitoring
task monitor <task_id> --lines 100 # Show last 100 lines
# Stop task
task kill <task_id> # Stop single task
task kill <task_id1> <task_id2> # Stop multiple tasks
task kill --all # Stop all running tasks
task kill <task_id> --force # Force stop (immediate kill)
# View task info
task status <task_id> # Task status
task output <task_id> # Task output
task logs <task_id> # Task logs
# Cleanup
task cleanup # Clean tasks older than 24h
task cleanup 12 # Clean tasks older than 12h
Examples
# Run training task
task run "Model Training" "python train.py --epochs 100"
# Run multiple tasks concurrently
task run "Data Processing" "python process_data.py"
task run "Feature Extraction" "python extract_features.py"
# Monitor and manage
task list --resources
task monitor 00001
task kill 00001 00002 00003 # Kill multiple tasks
Configuration
Email Notifications (Optional)
To enable email notifications:
-
Create email config (
~/.task_manager/config/email_config.json):{ "enabled": true, "to_email": "your-email@example.com" }
-
Setup Google API credentials:
- Get credentials from Google Cloud Console
- Enable Gmail API and create OAuth 2.0 credentials
- Save as
~/.task_manager/config/credentials.json
-
Get Gmail token:
task config google_api login
Quick import (if you have existing files):
task config email ~/email_config.json
task config token ~/token.json
task config google_api file ~/credentials.json
Configuration Commands
task config init # Initialize config
task config show # Show current config
task config test # Test email config
task config email <file> # Import email config
task config token <file> # Import token
task config google_api file <file> # Import credentials
task config google_api login # Login to get token
Command Reference
task run <name> <command> [priority] [-r|--realtime]
Run new task.
name: Task namecommand: Command to executepriority: Task priority (0-10, default 0)-r, --realtime: Enable real-time unbuffered output
Examples:
task run "Train Model" "python train.py"
task run "Important" "python script.py" 10
task run -r "Stream Logs" "python long.py"
task kill <task_id> [task_id2] ... [--force] | --all [--force]
Stop task(s).
task_id: Task ID(s) to stop (can specify multiple)--all: Stop all running tasks--force: Force kill immediately (without graceful shutdown)
Examples:
task kill 00001
task kill 00001 00002 00003
task kill 00001 --force
task kill --all
task monitor <task_id> [--lines N] [--refresh SECONDS]
Real-time task monitoring.
--lines N: Show last N lines (default: 50)--refresh S: Refresh interval in seconds (default: 2.0)
task list [--status <status>] [--resources]
List tasks.
--status <status>: Filter by status (pending, running, completed, failed, killed)--resources: Show system resource usage
task status <task_id>
View task status details.
task output <task_id> [--lines N]
View task output (default: last 50 lines).
task logs <task_id> [lines]
View task log file (default: last 100 lines).
task cleanup [-t/--time hours] [task_id1] [task_id2] ...
Clean up tasks.
-t, --time hours: Clean tasks older than N hours (default: 24)task_id: Clean specific task(s)
Examples:
task cleanup # Clean tasks older than 24h
task cleanup -t 48 # Clean tasks older than 48h
task cleanup 00001 00002 # Clean specific tasks
task email <action>
Email notification management.
enable: Enable notificationsdisable: Disable notificationsshow: Show current configtest: Send test email
Task Status
pending: Waiting to startrunning: Currently executingcompleted: Successfully finishedfailed: Failed with errorkilled: Manually stopped
File Structure
~/.task_manager/
├── config/
│ ├── email_config.json # Email configuration
│ ├── credentials.json # Google API credentials
│ └── token.json # Gmail token
├── logs/ # Task log files
│ └── <task_id>.log
└── tasks.json # Task database
Troubleshooting
- tmux not found: Install with
sudo apt-get install tmuxorbrew install tmux - Permission denied: Check script execute permissions
- Email not working: Verify Gmail API config and token validity
- Task not starting: Check for tmux session name conflicts
Logs location: ~/.task_manager/logs/<task_id>.log
Uninstallation
pip uninstall lite-slurm
rm -rf ~/.task_manager
License
MIT License
Author
Created by zheng
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lite_slurm-1.0.6.tar.gz.
File metadata
- Download URL: lite_slurm-1.0.6.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cbd99a950b2ab8239ea12aded31d964c3c21f5135d22eec584b9c6f70b1a814
|
|
| MD5 |
36c1ae3fce926557de57de51625346b3
|
|
| BLAKE2b-256 |
faba89084808f20c468007a2cfa6d9ea1621453aa676194efed69457f1a34336
|
Provenance
The following attestation bundles were made for lite_slurm-1.0.6.tar.gz:
Publisher:
publish.yml on zz9tf/slurm-like-task-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lite_slurm-1.0.6.tar.gz -
Subject digest:
3cbd99a950b2ab8239ea12aded31d964c3c21f5135d22eec584b9c6f70b1a814 - Sigstore transparency entry: 1442933385
- Sigstore integration time:
-
Permalink:
zz9tf/slurm-like-task-manager@155e9052618e1d43067d8f6eb573945009d29778 -
Branch / Tag:
refs/tags/v1.0.6 - Owner: https://github.com/zz9tf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@155e9052618e1d43067d8f6eb573945009d29778 -
Trigger Event:
push
-
Statement type:
File details
Details for the file lite_slurm-1.0.6-py3-none-any.whl.
File metadata
- Download URL: lite_slurm-1.0.6-py3-none-any.whl
- Upload date:
- Size: 26.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cf52554bf8a5fb2c528143f68aa3c63d625e5c0f03f5704cffffaeb4f57e129
|
|
| MD5 |
75c054e0dc368701ff35d8f023eba048
|
|
| BLAKE2b-256 |
02ec52b40656b86b1b054eff8ec36d0e33c34764993930a3d8172882e7af3a66
|
Provenance
The following attestation bundles were made for lite_slurm-1.0.6-py3-none-any.whl:
Publisher:
publish.yml on zz9tf/slurm-like-task-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lite_slurm-1.0.6-py3-none-any.whl -
Subject digest:
8cf52554bf8a5fb2c528143f68aa3c63d625e5c0f03f5704cffffaeb4f57e129 - Sigstore transparency entry: 1442933551
- Sigstore integration time:
-
Permalink:
zz9tf/slurm-like-task-manager@155e9052618e1d43067d8f6eb573945009d29778 -
Branch / Tag:
refs/tags/v1.0.6 - Owner: https://github.com/zz9tf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@155e9052618e1d43067d8f6eb573945009d29778 -
Trigger Event:
push
-
Statement type: