Skip to main content

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: Support for multiple tasks running simultaneously
  • 📊 Real-time Monitoring: Real-time task status and output viewing
  • 🛠️ Resource Monitoring: CPU, memory, and disk usage monitoring
  • 📝 Log Management: Automatic task output and log recording
  • 🔧 Configuration Management: Simple configuration file management
  • 📧 Email Notifications: Automatic email notifications when tasks complete (requires configuration)

Installation

System Requirements

  • Python 3.7+
  • tmux (required)

Check tmux

Before installation, ensure tmux is installed on your system:

# Check if tmux is installed
command -v tmux

# If not installed, install tmux first
# Ubuntu/Debian:
sudo apt-get install tmux

# CentOS/RHEL:
sudo yum install tmux

# macOS:
brew install tmux

Quick Installation

# Clone repository
git clone <repository-url>
cd task_manager

# Run installation script
chmod +x install.sh
./install.sh

Manual Installation

# Install Python dependencies
pip install -r requirements.txt

# Install package
pip install -e .

# Initialize configuration
task config init

Install from PyPI

# Install from PyPI
pip install lite-slrum

# Initialize configuration
task config init

Usage

Basic Commands

# Run new task
task run "Task Name" "command to execute"

# List all tasks
task list

# Monitor task output in real-time
task monitor <task_id>

# Stop task
task kill <task_id>

# View task status
task status <task_id>

# View task output
task output <task_id>

# Clean up old tasks
task cleanup

# View help
task -h

Examples

# Run a 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 running tasks
task list --resources

# Monitor specific task
task monitor 00001

# Stop all running tasks
task kill --all

Configuration

Email Notifications

To enable email notifications, you need to configure three files:

1. Email Configuration File

Create ~/.task_manager/config/email_config.json:

{
    "enabled": true,
    "to_email": "your-email@example.com"
}

2. Google API Credentials

  1. Go to Google Cloud Console
  2. Create a new project or select existing one
  3. Enable Gmail API
  4. Create OAuth 2.0 credentials
  5. Download credentials file as credentials.json
  6. Place it in ~/.task_manager/config/credentials.json

3. Gmail Token

Use the following command to get the token:

# Login via Google API to get token
task config google_api login

Quick Import Method

If you already have the configuration files:

# Import email configuration
task config email ~/my_email_config.json

# Import Gmail token
task config token ~/my_token.json

# Import Google API credentials
task config google_api file ~/credentials.json

Configuration Management

# Initialize configuration files
task config init

# Show current configuration
task config show

# Test email configuration
task config test

# Import email configuration
task config email <config_file>

# Import Gmail token
task config token <token_file>

# Setup Google API credentials
task config google_api file <credentials_file>

# Login via Google API
task config google_api login

Command Reference

Global Options

  • -h, --help: Show help information
  • -v, --version: Show version information

Commands

task run <name> <command> [priority] [max_retries]

Run new task.

Parameters:

  • name: Task name
  • command: Command to execute
  • priority: Task priority (0-10, default 0)
  • max_retries: Maximum retry count (default 0)

Examples:

task run "Train Model" "python train.py"
task run "Important Task" "python important.py" 10
task run "May Fail" "python unstable.py" 0 3

task list [options]

List all tasks.

Options:

  • --status <status>: Filter tasks by status
  • --resources: Show system resource usage

Examples:

task list                    # List all tasks
task list --status running   # Show only running tasks
task list --resources        # Show tasks and resource info

task kill <task_id> [--force] | task kill --all [--force]

Stop task.

Parameters:

  • task_id: Task ID to stop
  • --all: Stop all running tasks
  • --force: Force stop task

Examples:

task kill 00001              # Stop task 00001
task kill 00001 --force      # Force stop task 00001
task kill --all              # Stop all running tasks

task monitor <task_id> [--lines N] [--refresh SECONDS]

Real-time task monitoring.

Parameters:

  • task_id: Task ID to monitor
  • --lines N: Show last N lines of output (default 50)
  • --refresh S: Refresh interval in seconds (default 2.0)

Examples:

task monitor 00001                    # Monitor task 00001
task monitor 00001 --lines 100        # Show last 100 lines
task monitor 00001 --refresh 1.0      # Refresh every second

task status <task_id>

View task status.

Parameters:

  • task_id: Task ID to view status

Examples:

task status 00001    # View status of task 00001

task output <task_id> [--lines N]

View task output.

Parameters:

  • task_id: Task ID to view output
  • --lines N: Show last N lines of output (default 50)

Examples:

task output 00001              # View output of task 00001
task output 00001 --lines 100  # Show last 100 lines

task cleanup [hours]

Clean up completed tasks.

Parameters:

  • hours: Clean up tasks completed more than specified hours ago (default 24)

Examples:

task cleanup        # Clean up tasks older than 24 hours
task cleanup 12     # Clean up tasks older than 12 hours
task cleanup 0      # Clean up all completed tasks

task logs <task_id> [lines]

View task logs.

Parameters:

  • task_id: Task ID to view logs
  • lines: Show last N lines of logs (default 100)

Examples:

task logs 00001        # View logs of task 00001
task logs 00001 50     # Show last 50 lines

task email <action>

Email notification management.

Actions:

  • enable: Enable email notifications
  • disable: Disable email notifications
  • show: Show current email configuration
  • test: Test email sending

Examples:

task email enable    # Enable email notifications
task email disable   # Disable email notifications
task email show      # View current configuration
task email test      # Send test email

task config <action> [file_path]

Configuration management.

Actions:

  • init: Initialize configuration files
  • email <config_file>: Configure email settings
  • token <token_file>: Configure Gmail token
  • google_api file <creds_file>: Configure Google API credentials
  • google_api login: Login via Google API to get token
  • show: Show current configuration
  • test: Test email sending

Examples:

task config init
task config email ~/my_email_config.json
task config token ~/my_token.json
task config google_api file ~/credentials.json
task config google_api login
task config show

Task Status

Tasks can have the following statuses:

  • pending: Waiting to start
  • running: Currently running
  • completed: Successfully completed
  • failed: Failed to complete
  • killed: 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
│   ├── 00001.log
│   └── 00002.log
└── tasks.json              # Task database

Uninstallation

# Run uninstall script
chmod +x uninstall.sh
./uninstall.sh

# Or manually uninstall
pip uninstall lite-slrum
rm -rf ~/.task_manager

Troubleshooting

Common Issues

  1. tmux not found: Install tmux using your package manager
  2. Permission denied: Make sure you have execute permissions for scripts
  3. Email not working: Check Gmail API configuration and token validity
  4. Task not starting: Check if tmux session name conflicts exist

Log Files

  • Task logs: ~/.task_manager/logs/<task_id>.log
  • System logs: Check terminal output for error messages

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Created by zheng

Changelog

v1.0.4 (2025-09-10)

  • Initial release
  • Basic task management functionality
  • tmux integration
  • Email notifications
  • Resource monitoring
  • Configuration management

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

lite_slurm-1.0.4.tar.gz (25.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lite_slurm-1.0.4-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file lite_slurm-1.0.4.tar.gz.

File metadata

  • Download URL: lite_slurm-1.0.4.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lite_slurm-1.0.4.tar.gz
Algorithm Hash digest
SHA256 19846f827eb84d0b4fee334857d0d1400500a8db0b0c20244f8189f3490c6532
MD5 b1315d1e105a0e4030f3e4c628c978a1
BLAKE2b-256 e476ff0ebe846f096b1d5d4fec9352376c44431d423ab23928c3853e409554c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for lite_slurm-1.0.4.tar.gz:

Publisher: publish.yml on zz9tf/slurm-like-task-manager

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lite_slurm-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: lite_slurm-1.0.4-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.7

File hashes

Hashes for lite_slurm-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 841de8d6487a6f2e0e7c58cbe00f37f96d6c3f94aa6459440a905173dc20750d
MD5 5715065c1b1bfc17598c38375723818d
BLAKE2b-256 c1749592c038cd4938708b8dd61f9e54fc9669c43d680ab427a39d25e03ebdd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for lite_slurm-1.0.4-py3-none-any.whl:

Publisher: publish.yml on zz9tf/slurm-like-task-manager

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page