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 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:

  1. Create email config (~/.task_manager/config/email_config.json):

    {
        "enabled": true,
        "to_email": "your-email@example.com"
    }
    
  2. 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
  3. 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 name
  • command: Command to execute
  • priority: 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 notifications
  • disable: Disable notifications
  • show: Show current config
  • test: Send test email

Task Status

  • pending: Waiting to start
  • running: Currently executing
  • completed: Successfully finished
  • failed: Failed with error
  • 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
│   └── <task_id>.log
└── tasks.json               # Task database

Troubleshooting

  • tmux not found: Install with sudo apt-get install tmux or brew 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

lite_slurm-1.0.6.tar.gz (25.7 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.6-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

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

Hashes for lite_slurm-1.0.6.tar.gz
Algorithm Hash digest
SHA256 3cbd99a950b2ab8239ea12aded31d964c3c21f5135d22eec584b9c6f70b1a814
MD5 36c1ae3fce926557de57de51625346b3
BLAKE2b-256 faba89084808f20c468007a2cfa6d9ea1621453aa676194efed69457f1a34336

See more details on using hashes here.

Provenance

The following attestation bundles were made for lite_slurm-1.0.6.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.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

Hashes for lite_slurm-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8cf52554bf8a5fb2c528143f68aa3c63d625e5c0f03f5704cffffaeb4f57e129
MD5 75c054e0dc368701ff35d8f023eba048
BLAKE2b-256 02ec52b40656b86b1b054eff8ec36d0e33c34764993930a3d8172882e7af3a66

See more details on using hashes here.

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

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