"Runce and done! No repeats, no retreats!" πββοΈπ¨
π Guaranteed Singleton Execution β’ π Process Tracking β’ β±οΈ Lifecycle Management
If you find this project helpful, consider supporting me:
- π« No Duplicates: Each command runs exactly once per unique ID
- π Process Tracking: View all managed processes with status
- β±οΈ Execution Time: Track how long processes have been running
- π Log Management: Automatic stdout/stderr capture
- π Clean Termination: Proper process killing
pip install runcerunce <command> [options] [arguments]
Runs a new singleton process.
runce run [options] ARG...
Options:
--id <run_id>: Unique run identifier (required).--cwd <cwd>: Working directory for the command.-t <tail>/--tail <tail>: Tail the output (n lines). Use-t -1to print the entire output.--overwrite: Overwrite existing entry if it exists.--run-after <command>: Run a command after the main command finishes.--split: Dont merge stdout and stderr
Example:
runce run --id my-unique-task sleep 60Lists all managed processes.
runce ls [options]Options:
-f <format>/--format <format>: Format of the output line (see examples below).
Example:
runce ls
runce ls -f "{pid}\t{name}\t{command}"Checks the status of processes.
runce status [options] [ID...]Options:
-f <format>/--format <format>: Format of the output line.
Example:
runce status my-unique-taskKills running processes.
runce kill [options] ID...Options:
--dry-run: Perform a dry run (don't actually kill).--remove: Remove the entry after killing.
Example:
runce kill my-unique-taskCleans up entries for non-existing processes.
runce clean [ID...]Example:
runce cleanTails the output of processes.
runce tail [options] [ID...]Options:
-n <lines>/--lines <lines>: Number of lines to tail.--header <format>: Header format.-x/--only-existing: Only show existing processes.-t/--tab: Prefix tab space to each line.
Example:
runce tail my-unique-task
runce tail -n 20 my-unique-taskRestarts a process.
runce restart [options] ID...Options:
-t <tail>/--tail <tail>: Tail the output after restarting.
Example:
runce restart my-unique-taskrunce run --id api-server -- python api.py$ runce list
PID NAME STATUS ELAPSED COMMAND
1234 api-server β
Live 01:23:45 python api.py
5678 worker β Gone 00:45:30 python worker.py$ runce run --id daily-job -- python daily.py
π Started: PID:5678(β
Live) daily-job
$ runce run --id daily-job -- python daily.py
π¨ Already running: PID:5678(β
Live) daily-jobThe -f / --format option in the ls and status commands allows you to customize the output format. You can use the following placeholders:
{pid}: Process ID{name}: Run ID / Name{pid_status}: Process status ("β Live" or "π» Gone"){elapsed}: Elapsed time{command}: The command being executed
RunCE stores process information in JSON files within a temporary directory (/tmp/runce.v1 on Linux). Before starting a new process, it checks for existing entries with the same ID to prevent duplicates.
# Install in development mode
pip install -e .
# Run tests
pytest
# Lint code
flake8 runce